FreeCalypso > hg > freecalypso-sw
comparison target-utils/c139explore/backlight.c @ 949:df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 04 Nov 2015 00:46:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
948:c73516dd50bb | 949:df1dccc0ef9c |
---|---|
1 #include <sys/types.h> | |
2 #include <string.h> | |
3 #include "types.h" | |
4 #include "abbdefs.h" | |
5 | |
6 #define GPIO_OUT_REG (*(volatile u16 *) 0xfffe4802) | |
7 #define BACKLIGHT_GPIO_MASK 0x0002 | |
8 | |
9 #define AUXLED_KPBL_OFF 0x000 | |
10 #define AUXLED_KPBL_ON 0x002 | |
11 | |
12 void | |
13 cmd_dbl(argbulk) | |
14 char *argbulk; | |
15 { | |
16 char *argv[2]; | |
17 | |
18 if (parse_args(argbulk, 1, 1, argv, 0) < 0) | |
19 return; | |
20 if (!strcmp(argv[0], "on")) | |
21 GPIO_OUT_REG |= BACKLIGHT_GPIO_MASK; | |
22 else if (!strcmp(argv[0], "off")) | |
23 GPIO_OUT_REG &= ~BACKLIGHT_GPIO_MASK; | |
24 else | |
25 printf("ERROR: \"on\" or \"off\" argument expected\n"); | |
26 } | |
27 | |
28 void | |
29 cmd_kpbl(argbulk) | |
30 char *argbulk; | |
31 { | |
32 char *argv[2]; | |
33 | |
34 if (parse_args(argbulk, 1, 1, argv, 0) < 0) | |
35 return; | |
36 if (!strcmp(argv[0], "on")) | |
37 abb_reg_write(AUXLED, AUXLED_KPBL_ON); | |
38 else if (!strcmp(argv[0], "off")) | |
39 abb_reg_write(AUXLED, AUXLED_KPBL_OFF); | |
40 else | |
41 printf("ERROR: \"on\" or \"off\" argument expected\n"); | |
42 } |