freemyipod r76 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r75‎ | r76 | r77 >
Date:03:59, 10 August 2010
Author:cmwslw
Status:new
Tags:
Comment:
Moved demo code to main.c.
Modified paths:
  • /embios/branches/4g_compat/init.c (modified) (history)
  • /embios/branches/4g_compat/main.c (modified) (history)

Diff [purge]

Index: embios/branches/4g_compat/init.c
@@ -24,7 +24,6 @@
2525 #include "global.h"
2626 #include "lcdconsole.h"
2727 #include "console.h"
28 -#include "accel.h"
2928
3029 static const char welcomestring[] INITCONST_ATTR = "emBIOS v" VERSION "\n";
3130
@@ -33,13 +32,6 @@
3433 {
3534 lcdconsole_init();
3635 cputs(1, welcomestring);
37 - while(1)
38 - {
39 - uint8_t x = accel_get_axis(0);
40 - uint8_t y = accel_get_axis(1);
41 - uint8_t z = accel_get_axis(2);
42 - cprintf(1, "x:%d y:%d z:%d\n", x, y, z);
43 - }
4436 // Never works so just comment it out:
4537 //if (fat32_init()) cputs(1, "fat32_init() failed!\n");
4638 }
Index: embios/branches/4g_compat/main.c
@@ -22,8 +22,29 @@
2323
2424
2525 #include "global.h"
 26+#include "console.h"
 27+#include "accel.h"
 28+#include "backlight.h"
2629
2730 void main()
2831 {
29 - panic("main() doesn't know what to do!");
30 -}
\ No newline at end of file
 32+ //panic("main() doesn't know what to do!");
 33+ demo();
 34+}
 35+
 36+void demo()
 37+{
 38+ backlight_off(32);
 39+ cputs(1, "\nAccelerometer data. Om nom nom!\n\n");
 40+ int i;
 41+ for(i = 0; i < 16; i++)
 42+ {
 43+ uint8_t x = accel_get_axis(0);
 44+ uint8_t y = accel_get_axis(1);
 45+ uint8_t z = accel_get_axis(2);
 46+ cprintf(1, "x:%3d y:%3d z:%3d\n", x, y, z);
 47+ }
 48+ cputs(1, "\nemBIOS is a hardware abstraction with\ndebugging.\n\nIt helps with writing drivers too.");
 49+ backlight_on(32);
 50+ while(1) {}
 51+}