Drei Extraleben, x 0 auch noch spielbar. Anzeigeschirm besser formatiert.
[hackover2013-badge-firmware.git] / badge / main.c
index ffa0be1..25a4356 100644 (file)
@@ -57,6 +57,7 @@
 #include "ui/display.h"
 #include "ui/sprite.h"
 #include "ui/event.h"
+#include "ui/font.h"
 #include "util/util.h"
 #include "jumpnrun/jumpnrun.h"
 
@@ -64,6 +65,9 @@
 
 #include "drivers/fatfs/ff.h"
 
+#include "badge/pinconfig.h"
+#include <funk/nrf24l01p.h>
+
 #ifdef R0KET
 
 #include "r0ketports.h"
@@ -104,6 +108,16 @@ 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 },
@@ -112,8 +126,9 @@ 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) {
     gpioSetDir(input_pins[i].port, input_pins[i].pin, gpioDirection_Input);
     gpioSetPullup(input_pins[i].reg, input_pins[i].mode);
@@ -190,25 +205,33 @@ int main(void)
   badge_init();
 #endif
 
-  {
-    //    f_mkfs(0, 1, 0);
-    badge_framebuffer fb;
-    int res = 0;
-    FATFS fatvol;
+  /*
+  nrf_init();
+
+  for(uint8_t i = 1; ; ++i) {
+    badge_framebuffer fb = { { { 0 } } };
 
-    while(FR_OK != f_mount(0, &fatvol)) {
-      f_mkfs(0, 1, 0);
+    fb.data[2][86] = 0xff;
+    fb.data[3][87] = nrf_read_reg(R_CONFIG);
+    fb.data[4][86] = 0xff;
+    for(uint8_t j = 0; j < i; j += 3) {
+      fb.data[3][j / 3] = 0xff;
     }
 
-    FIL fil;
-    if(FR_OK == (res = f_open(&fil, "sshot.dat", FA_OPEN_EXISTING | FA_READ))) {
-      UINT readbytes;
+    SCB_CLKOUTCLKDIV = i;
+    badge_framebuffer_flush(&fb);
+    systickDelay(200);
+  }
+  */
 
-      if(FR_OK != f_read(&fil, &fb, sizeof(fb), &readbytes)) {
-      }
+  FATFS fs;
+  f_mount(0, &fs);
 
-      f_close(&fil);
-    }
+  {
+    badge_framebuffer fb = { { { 0 } } };
+
+    fb.data[0][0] = badge_framebuffer_render_text(&fb, 2, 10, "foobar");
+    fb.data[0][1] = badge_framebuffer_render_number(&fb, 10, 18, 99);
 
     badge_framebuffer_flush(&fb);
   }
This page took 0.028223 seconds and 4 git commands to generate.