Backlight bei Inaktivität aus.
[hackover2013-badge-firmware.git] / badge / init.c
1 #include "init.h"
2 #include "backlight.h"
3 #include "pinconfig.h"
4 #include "util/util.h"
5 #include "ui/display.h"
6
7 #include <core/wdt/wdt.h>
8 #include <core/gpio/gpio.h>
9
10 void badge_init(void) {
11 #define INPUT_PIN_CONFIG(spec, mode) do { \
12 HOB_SET_PIN_FUNC(spec, GPIO); \
13 gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Input); \
14 gpioSetPullup(&HOB_IOCON(spec), (mode)); \
15 } while(0)
16
17 INPUT_PIN_CONFIG(HOB_BTN_UP , gpioPullupMode_PullUp);
18 INPUT_PIN_CONFIG(HOB_BTN_RIGHT , gpioPullupMode_PullUp);
19 INPUT_PIN_CONFIG(HOB_BTN_DOWN , gpioPullupMode_PullUp);
20 INPUT_PIN_CONFIG(HOB_BTN_LEFT , gpioPullupMode_PullUp);
21 INPUT_PIN_CONFIG(HOB_BTN_A , gpioPullupMode_PullUp);
22 INPUT_PIN_CONFIG(HOB_BTN_B , gpioPullupMode_PullUp);
23
24 #undef INPUT_PIN_CONFIG
25
26 #define OUTPUT_PIN_CONFIG(spec, value) do { \
27 HOB_SET_PIN_FUNC(spec, GPIO); \
28 gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Output); \
29 gpioSetValue(HOB_PORT(spec), HOB_PIN(spec), (value)); \
30 } while(0)
31
32 OUTPUT_PIN_CONFIG(HOB_USB_CONNECT , 1);
33 OUTPUT_PIN_CONFIG(HOB_LCD_CS , 1);
34 OUTPUT_PIN_CONFIG(HOB_LCD_RST , 1);
35 OUTPUT_PIN_CONFIG(HOB_DATAFLASH_CS, 1);
36 OUTPUT_PIN_CONFIG(HOB_LED_LEFT , 0);
37 OUTPUT_PIN_CONFIG(HOB_LED_RIGHT , 0);
38
39 #undef OUTPUT_PIN_CONFIG
40
41 badge_backlight_init();
42 badge_display_init();
43 }
This page took 0.04766 seconds and 5 git commands to generate.