5 #include "ui/display.h"
7 #include <core/wdt/wdt.h>
8 #include <core/gpio/gpio.h>
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)); \
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
);
24 #undef INPUT_PIN_CONFIG
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)); \
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);
39 #undef OUTPUT_PIN_CONFIG
41 badge_backlight_init();
This page took 0.046913 seconds and 5 git commands to generate.