From 2c84b743972ec3999e74fbaedc28916d80568e79 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sat, 28 Jan 2012 19:42:44 +0100 Subject: [PATCH] Fix some warnings. --- firmware/basic/basic.h | 4 ++-- firmware/l0dable/1boot.c | 2 +- firmware/l0dable/jeopardy.c | 4 +++- firmware/l0dable/jump.c | 2 +- firmware/l0dable/nick_work.c | 3 ++- firmware/l0dable/people.c | 2 +- firmware/l0dable/pongo.c | 5 ++++- firmware/l0dable/r_player.c | 12 ++++++------ firmware/l0dable/scope.c | 2 +- firmware/main.c | 5 ++++- 10 files changed, 25 insertions(+), 16 deletions(-) diff --git a/firmware/basic/basic.h b/firmware/basic/basic.h index 4025232..694e778 100644 --- a/firmware/basic/basic.h +++ b/firmware/basic/basic.h @@ -171,12 +171,12 @@ uint16_t crc16(uint8_t * buf, int len); // menu.c struct MENU_DEF { - char *text; + const char *text; void (*callback)(void); }; struct MENU { - char *title; + const char *title; struct MENU_DEF entries[]; }; diff --git a/firmware/l0dable/1boot.c b/firmware/l0dable/1boot.c index a544663..06a6063 100644 --- a/firmware/l0dable/1boot.c +++ b/firmware/l0dable/1boot.c @@ -117,7 +117,7 @@ static bool screen_overview() { while (key != BTN_ENTER) { lcdClear(); lcdPrintln("Privacy:"); - lcdPrintln(levels[GLOBAL(privacy)]); + lcdPrintln(levels[(int)GLOBAL(privacy)]); lcdPrintln(""); lcdPrintln("Nickname:"); lcdPrintln(GLOBAL(nickname)); diff --git a/firmware/l0dable/jeopardy.c b/firmware/l0dable/jeopardy.c index c3b31d1..35b0c4c 100644 --- a/firmware/l0dable/jeopardy.c +++ b/firmware/l0dable/jeopardy.c @@ -90,6 +90,8 @@ void setLeft(); void setRight(); struct packet a; +void setJeopardy(); + void ram(void) { int priv = GLOBAL(privacy); @@ -103,7 +105,7 @@ void ram(void) nrf_config_set(&config); nrf_set_strength(3); - int rnd; +// int rnd; volatile uint16_t i; while( 1 ){ diff --git a/firmware/l0dable/jump.c b/firmware/l0dable/jump.c index a83d940..e1add11 100644 --- a/firmware/l0dable/jump.c +++ b/firmware/l0dable/jump.c @@ -221,7 +221,7 @@ static void draw_platforms() { } static void draw_player() { - bool* sprite; + const bool* sprite; if(game.player_y_vel > 0) { sprite = PLAYER_SPRITE_DOWN; } diff --git a/firmware/l0dable/nick_work.c b/firmware/l0dable/nick_work.c index 2875c3d..519fa4a 100644 --- a/firmware/l0dable/nick_work.c +++ b/firmware/l0dable/nick_work.c @@ -71,11 +71,12 @@ int melody_timeout; static void init_lilakit(void); static void tick_lilakit(void); +void melody_play(void); static void mainloop(); void handler(void); void ram(void) { - timer32Callback0 = handler; + timer32Callback0 = (uint32_t) handler; /* Enable the clock for CT32B0 */ SCB_SYSAHBCLKCTRL |= (SCB_SYSAHBCLKCTRL_CT32B0); diff --git a/firmware/l0dable/people.c b/firmware/l0dable/people.c index 4f85e17..28118f6 100644 --- a/firmware/l0dable/people.c +++ b/firmware/l0dable/people.c @@ -29,7 +29,7 @@ void ram(void) { if( nrf_rcv_pkt_time(64,sizeof(buf),buf) == 16 ){ buf[14] = 0; if( buf[1] == 0x23 || buf[1] == 0x24){ - lcdPrintln(buf+6); + lcdPrintln((char*)(buf+6)); //lcdPrintln("foo"); } lcdRefresh(); diff --git a/firmware/l0dable/pongo.c b/firmware/l0dable/pongo.c index 150ea22..891c05f 100644 --- a/firmware/l0dable/pongo.c +++ b/firmware/l0dable/pongo.c @@ -113,6 +113,9 @@ void init(); ** Code Section *********************************************/ +void init(); +void ram(); + void game(void) { init(); @@ -139,7 +142,7 @@ void game(void) } } -init() +void init() { // init ball ball1.size = PONG_BALL_SIZE; diff --git a/firmware/l0dable/r_player.c b/firmware/l0dable/r_player.c index c2602df..da538ca 100644 --- a/firmware/l0dable/r_player.c +++ b/firmware/l0dable/r_player.c @@ -34,11 +34,11 @@ struct packet{ uint8_t x; uint8_t y; uint8_t flags; - uint8_t text[16]; + char text[16]; }__attribute__((packed)) text; struct nick{ uint8_t flags; - uint8_t nick[18]; + char nick[18]; }__attribute__((packed)) nick; struct nickrequest{ uint8_t reserved[19]; @@ -55,7 +55,7 @@ struct packet{ uint8_t gameFlags; uint8_t interval; uint8_t jitter; - uint8_t gameTitle[8]; + char gameTitle[8]; }__attribute__((packed)) announce; struct join{ uint16_t gameId; @@ -93,7 +93,7 @@ uint16_t gameId; uint8_t interval; uint8_t jitter; uint8_t flags; -uint8_t *gameTitle; +char *gameTitle; void sendButton(uint8_t button); void sendJoin(uint32_t game); @@ -321,7 +321,7 @@ void processNickRequest( struct nickrequest *nq) p.id= id; p.ctr= ++ctr; p.c.nick.flags = 0; - uint8_t *nick = GLOBAL(nickname); + char *nick = GLOBAL(nickname); strcpy(p.c.nick.nick, nick); nrf_snd_pkt_crc(sizeof(p),(uint8_t*)&p); } @@ -374,7 +374,7 @@ void processText(struct text *t) if( t->flags & FLAGS_CLS ) lcdClear() ; lcdSetCrsr(t->x, t->y); - t->text[16] = 0; + t->text[16] = 0; // XXX:Actually ok, beause the CRC is there. But evil! lcdPrint(t->text); lcdRefresh(); } diff --git a/firmware/l0dable/scope.c b/firmware/l0dable/scope.c index 6b44ecb..7603be6 100644 --- a/firmware/l0dable/scope.c +++ b/firmware/l0dable/scope.c @@ -116,7 +116,7 @@ void ram(void) { case BTN_RIGHT: if (kok) { xs++; xs&=63; kok=0; } break; case BTN_UP: if (kok) { ch++; ch&=7; kok=0; } break; case BTN_DOWN: if (kok) { ch--; ch&=7; kok=0; } break; - case BTN_ENTER: return 0; + case BTN_ENTER: return; default: kok=1; } } diff --git a/firmware/main.c b/firmware/main.c index e94a188..15ed254 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -4,7 +4,10 @@ #include "core/pmu/pmu.h" #include "basic/basic.h" +#include "basic/config.h" #include "lcd/render.h" +#include "lcd/print.h" +#include "usb/usbmsc.h" #include "filesystem/ff.h" @@ -34,7 +37,7 @@ void wrapper(void); -int main(void) { +void main(void) { // Configure cpu and mandatory peripherals cpuInit(); // Configure the CPU // we do it later