\r
OPTDEFINES = -D__NEWLIB__\r
#OPTDEFINES += -DR0KET\r
-OPTDEFINES += -DHOB_REV2\r
#OPTDEFINES += -DUSBONLY\r
##########################################################################\r
# Project-specific files \r
}
void badge_init(void) {
-#define INPUT_PIN_CONFIG(spec, mode) do { \
- HOB_SET_PIN_FUNC(spec, GPIO); \
- gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Input); \
- gpioSetPullup(&HOB_IOCON(spec), (mode)); \
+#define INPUT_PIN_CONFIG(spec, mode) do { \
+ HOB_SET_PIN_FUNC(spec, GPIO); \
+ gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Input); \
+ gpioSetPullup(&HOB_IOCON(spec), (mode)); \
} while(0)
-#ifdef HOB_REV2
INPUT_PIN_CONFIG(HOB_BTN_UP , gpioPullupMode_PullUp);
INPUT_PIN_CONFIG(HOB_BTN_RIGHT , gpioPullupMode_PullUp);
INPUT_PIN_CONFIG(HOB_BTN_DOWN , gpioPullupMode_PullUp);
INPUT_PIN_CONFIG(HOB_BTN_LEFT , gpioPullupMode_PullUp);
INPUT_PIN_CONFIG(HOB_BTN_A , gpioPullupMode_PullUp);
INPUT_PIN_CONFIG(HOB_BTN_B , gpioPullupMode_PullUp);
-#else
- INPUT_PIN_CONFIG(HOB_BTN_UP , gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_RIGHT , gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_DOWN , gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_LEFT , gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_CENTER, gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_A , gpioPullupMode_PullDown);
- INPUT_PIN_CONFIG(HOB_BTN_B , gpioPullupMode_PullDown);
-#endif
#undef INPUT_PIN_CONFIG
-#define OUTPUT_PIN_CONFIG(spec, value) do { \
- HOB_SET_PIN_FUNC(spec, GPIO); \
- gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Output); \
- gpioSetValue(HOB_PORT(spec), HOB_PIN(spec), (value)); \
+#define OUTPUT_PIN_CONFIG(spec, value) do { \
+ HOB_SET_PIN_FUNC(spec, GPIO); \
+ gpioSetDir(HOB_PORT(spec), HOB_PIN(spec), gpioDirection_Output); \
+ gpioSetValue(HOB_PORT(spec), HOB_PIN(spec), (value)); \
} while(0)
OUTPUT_PIN_CONFIG(HOB_USB_CONNECT , 1);
OUTPUT_PIN_CONFIG(HOB_LCD_CS , 1);
OUTPUT_PIN_CONFIG(HOB_LCD_RST , 1);
OUTPUT_PIN_CONFIG(HOB_DATAFLASH_CS, 1);
-
-#ifdef HOB_REV2
OUTPUT_PIN_CONFIG(HOB_LED_LEFT , 0);
OUTPUT_PIN_CONFIG(HOB_LED_RIGHT , 0);
-#endif
#undef OUTPUT_PIN_CONFIG
### ### # # ^
- # # # # # # c ^
- # # # ??? ^ ????? ??????? ^
- # # # # # < ?? e ^
- ##### ### # # < ??? ?? ?? ?? ?? 01 ^
- ??? < ???? 23 ^
- ^ ????? C S M H S H 23 ^
- < < ????????????????????????????????????????????????23?^^^^
- ?S S? ??? < << 23^^^^^
- ?????? <<< k 23^^^^^
- ^ ^ ? ? ? ?? ??? ? S ? M M <<<< ><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<vvvvvv23^^^^^
- ^ ^#^ ^#^ ????? ?????????????????????<<<<<<<<<<<<<<<<<<^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23^^^^^
- P ^ M ^ M ^ M ^ M <#> <#^ <#^ C B B @ ^^ G ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23^^^^^
-########################################################################### ##########^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23^^^^^
+ # # # # # # c ^
+ # # # ???? ^^ ????? ????? ^
+ # # # # # ^ vv <?? ^
+ ##### ### # # < <??? ^^ ^^ ^^ ^
+ ??? < <???? <?> <?> <?> e ^
+ < <????? M ??? M ??? M ??? M 01 ^
+ < < <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv23vvvvv
+ ?S S? ??? < << <^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23^^^^^
+ c ?????? <<< 23
+ ^ ^ ? ? ? ?? ??? ? S ? M M <<<< k 23
+ ^ ^#^ ^#^ ????? <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv23vvvvv
+ P ^ M ^ M ^ M ^ M <#> <#^ <#^ C B B @ ^^ G ^ <^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23^^^^^
+########################################################################### ##########^^^^^^^^^^^^^^^^^^^^ 23
[tiles]
0 tube_top_left
1 tube_top_right
V bird
W bird_straight
X bird_dip
+[parameters]
+L 4
-vvv##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv??? >< 23 ><
-><^23^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^??? >< 23 ><
->< 23 <??? >< 23 ><
->< P c k <??? >< 23 ><
->< vvvvvvvvv> <???? >< 23 ><
->< ?^^^^^^^^^> <vvv> <???? >< 23 ><
->< <vvv> <^^^vvv> <???? >< ><
->< <vvvvvvvv> <^^^> < ??^^vvvv> <???? >< e ><
->< <^^^^^^^^> <vvvvv> < ??^^^^vvvv> <?????vvvvvvvvvvvvvvvvvvvv ><
->< ^ ^ ^^ ^^ ^? ^ ? <vv> <^^^^^> < ??^^^^vvvv> <^^^^^^^^^^^^^^^^^^^^^ ><
->< ^?^ ^?^ <?^ <?^ ^? ^? <^^> vvvvv> < ??^^^^vvvv> ><
->< <?> <?> <?> <?> ^??M ^?? M <^^^^^> < ??^^^^vvvv> ><
+vvv##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv???????????????????????? >< 23 ><
+><^23^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^??? ?????? >< 23 ><
+>< 23 <??? M ???????????? >< 23 ><
+>< P c k <??? M ????? ? >< 23 ><
+>< vvvvvvvvv> B <???? ????? M ? >< 23 ><
+>< ?^^^^^^^^^> B <vvv> <???? ?????????? ???? >< 23 ><
+>< <vvv> <^^^vvv> <???? ? ? >< ><
+>< <vvvvvvvv> B <^^^> < ??^^vvvv> <???? ? ? >< ><
+>< <^^^^^^^^> <vvvvv> < ??^^^^vvvv> <?????vvvvv ?vvvv vvvvvvvv e ><
+>< ^ ^ ^^ ^^ ^? ^ ? <vv> <^^^^^> < ??^^^^vvvv> <^^^^^^ ?^^^^ ^^^^^^^^ ><
+>< ^?^ ^?^ <?^ <?^ ^? ^? <^^> vvvvv> < ??^^^^vvvv> ?> ><
+>< <?> <?> <?> <?> ^??M ^?? M <^^^^^> < ??^^^^vvvv> B ?> M ><
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv> < ??^^^^vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv><
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^> < ??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^><
[tiles]
-
- @
-
-
+ 23
+ 23 @
+ 23
+ P
??? ?????
????? ??????^^^^^
- P RRRRRRR ?????
+ R R R R ?????
^^^^???? ??????^^ ??? R ???????? R
???? ????? ^ ^ ?????? ?????
R ??? R <?> <?>
uint32_t volatile *reg;
gpioPullupMode_t mode;
} const input_pins[] = {
-#ifdef HOB_REV2
- { RB_BTN0 , &RB_BTN0_IO , gpioPullupMode_PullDown },
- { RB_BTN1 , &RB_BTN1_IO , gpioPullupMode_PullDown },
- { RB_BTN2 , &RB_BTN2_IO , gpioPullupMode_PullDown },
- { RB_BTN3 , &RB_BTN3_IO , gpioPullupMode_PullDown },
- { RB_BTN4 , &RB_BTN4_IO , gpioPullupMode_PullDown },
- { RB_HB0 , &RB_HB0_IO , gpioPullupMode_PullDown },
- { RB_HB1 , &RB_HB1_IO , gpioPullupMode_PullDown },
- { RB_PWR_CHRG, &RB_PWR_CHRG_IO, gpioPullupMode_PullDown }
-#else
{ RB_BTN0 , &RB_BTN0_IO , gpioPullupMode_PullUp },
{ RB_BTN1 , &RB_BTN1_IO , gpioPullupMode_PullUp },
{ RB_BTN2 , &RB_BTN2_IO , gpioPullupMode_PullUp },
{ RB_HB0 , &RB_HB0_IO , gpioPullupMode_PullUp },
{ RB_HB1 , &RB_HB1_IO , gpioPullupMode_PullUp },
{ RB_PWR_CHRG, &RB_PWR_CHRG_IO, gpioPullupMode_PullUp }
-#endif
};
for(int i = 0; i < ARRAY_SIZE(input_pins); ++i) {
f_mount(0, &fs);
#ifdef USBONLY
+ if(badge_input_raw() & BADGE_EVENT_KEY_LEFT) {
+ gpioSetValue(HOB_PORT(HOB_LED_LEFT), HOB_PIN(HOB_LED_LEFT) , 1);
+ }
+ if(badge_input_raw() & BADGE_EVENT_KEY_RIGHT) {
+ gpioSetValue(HOB_PORT(HOB_LED_RIGHT), HOB_PIN(HOB_LED_RIGHT) , 1);
+ }
+
for(;;) usbmode();
#else
if(badge_input_raw() & BADGE_EVENT_KEY_DOWN) {
#include <lpc134x.h>
-#ifdef HOB_REV2
-
#define HOB_BTN_UP (1, 11)
#define HOB_BTN_RIGHT (1, 7)
#define HOB_BTN_DOWN (1, 6)
#define HOB_BTN_LEFT (1, 5)
-#define HOB_BTN_A (1, 9)
-#define HOB_BTN_B (1, 8)
+#define HOB_BTN_A (1, 8)
+#define HOB_BTN_B (1, 9)
#define HOB_LCD_CS (3, 0)
#define HOB_LCD_RST (3, 1)
#define HOB_USB_CONNECT (0, 6)
-
#define HOB_LED_LEFT (2, 8)
#define HOB_LED_RIGHT (2, 6)
-#else
-
-#define HOB_BTN_UP (3, 2)
-#define HOB_BTN_RIGHT (1, 5)
-#define HOB_BTN_DOWN (1, 6)
-#define HOB_BTN_LEFT (3, 3)
-#define HOB_BTN_CENTER (1, 7)
-#define HOB_BTN_A (1, 11)
-#define HOB_BTN_B (1, 4)
-
-#define HOB_LCD_CS (1, 0)
-#define HOB_LCD_RST (1, 1)
-#define HOB_LCD_BACKLIGHT (0, 1)
-
-#define HOB_DATAFLASH_CS (0, 7)
-
-#define HOB_RADIO_CE (2, 10)
-#define HOB_RADIO_CS (2, 9)
-#define HOB_RADIO_IRQ (2, 2)
-
-#define HOB_USB_CONNECT (0, 6)
-
-#endif
-
#define HOB_PIO0_0 nRESET_PIO0_0
#define HOB_PIO0_1 PIO0_1
#define HOB_PIO0_2 PIO0_2
#define HOB_BUILD_IOCON_MASK(pio, flag) HOB_BUILD_IOCON_MASK_I(pio, flag)
#define HOB_IOCON_MASK(spec, flag) HOB_BUILD_IOCON_MASK(HOB_PIO_SUFFIX(spec), flag)
-#define HOB_SET_PIN_FUNC(spec, func) do { \
- HOB_IOCON(spec) = \
- (HOB_IOCON(spec) & ~HOB_IOCON_MASK(spec, FUNC_MASK)) \
- | HOB_IOCON_MASK(spec, FUNC_ ## func); \
+#define HOB_SET_PIN_FUNC(spec, func) do { \
+ HOB_IOCON(spec) = \
+ (HOB_IOCON(spec) & ~HOB_IOCON_MASK(spec, FUNC_MASK)) \
+ | HOB_IOCON_MASK(spec, FUNC_ ## func); \
} while(0)
#endif
if (gpioGetValue(RB_BTN1) == 0) { result |= BADGE_EVENT_KEY_LEFT ; }
if (gpioGetValue(RB_HB0 ) == 0) { result |= BADGE_EVENT_KEY_BTN_A ; }
if (gpioGetValue(RB_HB1 ) == 0) { result |= BADGE_EVENT_KEY_BTN_B ; }
-#elif defined(HOB_REV2)
+#else
if (gpioGetValue(HOB_PORT(HOB_BTN_UP ), HOB_PIN(HOB_BTN_UP )) == 0) { result |= BADGE_EVENT_KEY_UP ; }
if (gpioGetValue(HOB_PORT(HOB_BTN_DOWN ), HOB_PIN(HOB_BTN_DOWN )) == 0) { result |= BADGE_EVENT_KEY_DOWN ; }
if (gpioGetValue(HOB_PORT(HOB_BTN_LEFT ), HOB_PIN(HOB_BTN_LEFT )) == 0) { result |= BADGE_EVENT_KEY_LEFT ; }
if (gpioGetValue(HOB_PORT(HOB_BTN_RIGHT ), HOB_PIN(HOB_BTN_RIGHT )) == 0) { result |= BADGE_EVENT_KEY_RIGHT ; }
if (gpioGetValue(HOB_PORT(HOB_BTN_A ), HOB_PIN(HOB_BTN_A )) == 0) { result |= BADGE_EVENT_KEY_BTN_A ; }
if (gpioGetValue(HOB_PORT(HOB_BTN_B ), HOB_PIN(HOB_BTN_B )) == 0) { result |= BADGE_EVENT_KEY_BTN_B ; }
-#else
- if (gpioGetValue(HOB_PORT(HOB_BTN_UP ), HOB_PIN(HOB_BTN_UP )) == 1) { result |= BADGE_EVENT_KEY_UP ; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_DOWN ), HOB_PIN(HOB_BTN_DOWN )) == 1) { result |= BADGE_EVENT_KEY_DOWN ; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_CENTER), HOB_PIN(HOB_BTN_CENTER)) == 1) { result |= BADGE_EVENT_KEY_CENTER; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_LEFT ), HOB_PIN(HOB_BTN_LEFT )) == 1) { result |= BADGE_EVENT_KEY_LEFT ; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_RIGHT ), HOB_PIN(HOB_BTN_RIGHT )) == 1) { result |= BADGE_EVENT_KEY_RIGHT ; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_A ), HOB_PIN(HOB_BTN_A )) == 1) { result |= BADGE_EVENT_KEY_BTN_A ; }
- if (gpioGetValue(HOB_PORT(HOB_BTN_B ), HOB_PIN(HOB_BTN_B )) == 1) { result |= BADGE_EVENT_KEY_BTN_B ; }
#endif
return result;