freemyipod r41 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r40‎ | r41 | r42 >
Date:09:08, 6 August 2010
Author:cmwslw
Status:new
Tags:
Comment:
Merged in some console changes from trunk (r14 and 15 mostly).
Modified paths:
  • /embios/branches/4g_compat/init.c (modified) (history)
  • /embios/branches/4g_compat/lcdconsole.c (modified) (history)
  • /embios/branches/4g_compat/lcdconsole.h (modified) (history)
  • /embios/branches/4g_compat/target/ipodnano4g/accel.c (modified) (history)
  • /embios/branches/4g_compat/target/ipodnano4g/accel.h (modified) (history)

Diff [purge]

Index: embios/branches/4g_compat/init.c
@@ -23,14 +23,23 @@
2424
2525 #include "global.h"
2626 #include "lcdconsole.h"
 27+#include "console.h"
 28+#include "accel.h"
2729
 30+static const char welcomestring[] INITCONST_ATTR = "emBIOS v" VERSION "\n";
 31+
2832 void init() INITCODE_ATTR;
2933 void init()
3034 {
3135 lcdconsole_init();
32 - lcdconsole_puts("emBIOS v" VERSION "\n\nStorage init...", 0, -1);
33 - lcdconsole_update();
34 - if (fat32_init()) lcdconsole_puts(" failed!\n", 0, -1);
35 - else lcdconsole_puts(" done\n", 0, -1);
36 - lcdconsole_update();
37 -}
\ No newline at end of file
 36+ 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+ }
 44+ // Never works so just comment it out:
 45+ //if (fat32_init()) cputs(1, "fat32_init() failed!\n");
 46+}
Index: embios/branches/4g_compat/target/ipodnano4g/accel.c
@@ -29,8 +29,3 @@
3030 uint8_t address = 0x29 + 2 * axis;
3131 return i2crecvbyte(0x3a, address);
3232 }
33 -
34 -float accel_get_axis_in_gs(uint8_t axis)
35 -{
36 - return accel_get_axis(axis) / 16;
37 -}
Index: embios/branches/4g_compat/target/ipodnano4g/accel.h
@@ -27,6 +27,5 @@
2828 #include "global.h"
2929
3030 uint8_t accel_get_axis(uint8_t axis);
31 -uint8_t accel_get_axis_in_gs(uint8_t axis);
3231
3332 #endif
Index: embios/branches/4g_compat/lcdconsole.c
@@ -48,7 +48,7 @@
4949 current_col = -1;
5050 }
5151
52 -void lcdconsole_putc(char string, int fgcolor, int bgcolor)
 52+void lcdconsole_putc_noblit(char string, int fgcolor, int bgcolor)
5353 {
5454 if (string == '\r') return;
5555 current_col++;
@@ -81,9 +81,9 @@
8282 fgcolor, bgcolor, string, LINEBYTES);
8383 }
8484
85 -void lcdconsole_puts(const char* string, int fgcolor, int bgcolor)
 85+void lcdconsole_puts_noblit(const char* string, int fgcolor, int bgcolor)
8686 {
87 - while (*string) lcdconsole_putc(*string++, fgcolor, bgcolor);
 87+ while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
8888 }
8989
9090 void lcdconsole_update()
@@ -90,3 +90,15 @@
9191 {
9292 displaylcd(0, LCD_WIDTH - 1, 0, LCD_HEIGHT - 1, framebuf, 0);
9393 }
 94+
 95+void lcdconsole_putc(char string, int fgcolor, int bgcolor)
 96+{
 97+ lcdconsole_putc_noblit(string, fgcolor, bgcolor);
 98+ lcdconsole_update();
 99+}
 100+
 101+void lcdconsole_puts(const char* string, int fgcolor, int bgcolor)
 102+{
 103+ while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
 104+ lcdconsole_update();
 105+}
Index: embios/branches/4g_compat/lcdconsole.h
@@ -39,6 +39,8 @@
4040 void lcdconsole_init();
4141 void lcdconsole_putc(char string, int fgcolor, int bgcolor) ICODE_ATTR;
4242 void lcdconsole_puts(const char* string, int fgcolor, int bgcolor) ICODE_ATTR;
 43+void lcdconsole_putc_noblit(char string, int fgcolor, int bgcolor) ICODE_ATTR;
 44+void lcdconsole_puts_noblit(const char* string, int fgcolor, int bgcolor) ICODE_ATTR;
4345 void lcdconsole_update() ICODE_ATTR;
4446
4547

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r14Implement preemptive multitasking kerneltheseven21:43, 31 July 2010