Pinconfig für Endbadge.
authorWintermute <wintermute@hannover.ccc.de>
Sat, 26 Oct 2013 17:02:13 +0000 (19:02 +0200)
committerWintermute <wintermute@hannover.ccc.de>
Sat, 26 Oct 2013 17:02:13 +0000 (19:02 +0200)
Makefile
badge/init.c
badge/jumpnrun/levels/23xentry.lv
badge/jumpnrun/levels/23xhq.lv
badge/jumpnrun/levels/skynet.lv
badge/main.c
badge/pinconfig.h
badge/ui/event.c

index 6a0817a..21b726e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,6 @@ DEBUGBUILD = FALSE
 \r
 OPTDEFINES = -D__NEWLIB__\r
 #OPTDEFINES += -DR0KET\r
-OPTDEFINES += -DHOB_REV2\r
 #OPTDEFINES += -DUSBONLY\r
 ##########################################################################\r
 # Project-specific files \r
index cc4d044..33d048d 100644 (file)
@@ -17,46 +17,33 @@ static void badge_init_backlight(void) {
 }
 
 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
 
index 234fbac..aa6f339 100644 (file)
@@ -1,17 +1,17 @@
   ###   ###  #   #                                                                                                                                                                                     ^
- #   # #   #  # #                                                                                                        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
@@ -42,3 +42,5 @@ G giraffe
 V bird
 W bird_straight
 X bird_dip
+[parameters]
+L 4
index 53a7e20..c5e3b47 100644 (file)
@@ -1,15 +1,15 @@
-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]
index c2ca21c..126e7a5 100644 (file)
@@ -1,10 +1,10 @@
-                                                                                                                                                                                                                                                                                 
-                                                            @                                                                                                                                                                                                                    
-                                                                                                                                                                                                                                                                                 
-                                                                                                                                                                                                                                                                                 
+  23                                                                                                                                                                                                                                                                             
+  23                                                        @                                                                                                                                                                                                                    
+  23                                                                                                                                                                                                                                                                             
+  P                                                                                                                                                                                                                                                                              
                                                                                                                          ???                                                                                                     ?????                                           
                                                       ?????                                                                                                                                             ??????^^^^^                                                              
-                                                                   P                                                    RRRRRRR                                                                                                             ?????                                
+                                                                                                                        R R R R                                                                                                             ?????                                
         ^^^^????                                                  ??????^^                                      ???                                                                                   R               ???????? R                                                 
  ????                                       ?????                                                                                                     ^               ^                     ??????                                                      ?????                    
                                                                            R                           ???   R                                       <?>             <?>                                                                                                         
index e3cdb79..9a7d5f1 100644 (file)
@@ -112,16 +112,6 @@ void rbInit() {
     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 },
@@ -130,7 +120,6 @@ void rbInit() {
     { 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) {
@@ -255,6 +244,13 @@ int main(void)
   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) {
index 1b4a1b9..e4fd791 100644 (file)
@@ -3,14 +3,12 @@
 
 #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
index c705a0e..55cbdbd 100644 (file)
@@ -30,21 +30,13 @@ uint8_t badge_input_raw(void) {
   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;
This page took 0.040047 seconds and 4 git commands to generate.