Commit da611744 authored by Projects's avatar Projects

Fixed some warnings.

parent 5f40efa3
...@@ -215,7 +215,7 @@ void gps_get_direction(double *dir) ...@@ -215,7 +215,7 @@ void gps_get_direction(double *dir)
int gps_puts(const char *s) int gps_puts(const char *s)
{ {
while (*s++) { while (*s++) {
if (*s == EOF) if (*s == 0)
return EOF; return EOF;
LEUART_Tx(LEUART0, *s); LEUART_Tx(LEUART0, *s);
} }
......
...@@ -439,7 +439,7 @@ lsm303_smpl lsm303_calib_iron(lsm303_smpl *max, lsm303_smpl *min) ...@@ -439,7 +439,7 @@ lsm303_smpl lsm303_calib_iron(lsm303_smpl *max, lsm303_smpl *min)
#define LCD_W 100 #define LCD_W 100
#define LCD_0 60 #define LCD_0 60
int compass_xy(lsm303_smpl *max, lsm303_smpl *min, int *x, int *y) void compass_xy(lsm303_smpl *max, lsm303_smpl *min, int *x, int *y)
{ {
lsm303_smpl val; lsm303_smpl val;
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
#define LSM303_ZREF_H 0x3F /* ACC only */ #define LSM303_ZREF_H 0x3F /* ACC only */
typedef struct { typedef struct {
int16_t x, y, z int16_t x, y, z;
} lsm303_smpl; } lsm303_smpl;
/* Accelerometer config */ /* Accelerometer config */
...@@ -100,7 +100,7 @@ typedef struct { ...@@ -100,7 +100,7 @@ typedef struct {
#define LSM303_ACC_ST_NEG 0x08 #define LSM303_ACC_ST_NEG 0x08
#define LSM303_ACC_REBOOT 0x80 #define LSM303_ACC_REBOOT 0x80
#define LSM303_FIFO_EN 0x80 #define LSM303_FIFO_EN 0x80
typedef enum { typedef enum {
LSM303_ACC_ODR_PDOWN = 0x00, LSM303_ACC_ODR_PDOWN = 0x00,
LSM303_ACC_ODR_10_Hz = 0x10, LSM303_ACC_ODR_10_Hz = 0x10,
LSM303_ACC_ODR_50_Hz = 0x20, LSM303_ACC_ODR_50_Hz = 0x20,
...@@ -198,7 +198,7 @@ int lsm303_enableaxis(int dev, int mask); ...@@ -198,7 +198,7 @@ int lsm303_enableaxis(int dev, int mask);
int lsm303_fifo_mode(int dev, LSM303_FMODE_t mode, int en); int lsm303_fifo_mode(int dev, LSM303_FMODE_t mode, int en);
int lsm303_get_sample(int dev, lsm303_smpl *smpl); int lsm303_get_sample(int dev, lsm303_smpl *smpl);
lsm303_smpl lsm303_calib_iron(lsm303_smpl *max, lsm303_smpl *min); lsm303_smpl lsm303_calib_iron(lsm303_smpl *max, lsm303_smpl *min);
int compass_xy(lsm303_smpl *max, lsm303_smpl *min, int *x, int *y); void compass_xy(lsm303_smpl *max, lsm303_smpl *min, int *x, int *y);
int spi_read(uint8_t dev, uint8_t adr, uint8_t *dat); int spi_read(uint8_t dev, uint8_t adr, uint8_t *dat);
......
...@@ -279,7 +279,7 @@ void gfx_draw_bitmap_rotate(struct surface *surf, int x0, int y0, ...@@ -279,7 +279,7 @@ void gfx_draw_bitmap_rotate(struct surface *surf, int x0, int y0,
const struct rle_bitmap *b, int xr, int yr, int angle, float sina, float cosa) const struct rle_bitmap *b, int xr, int yr, int angle, float sina, float cosa)
{ {
int x = 0, y = 0, xt, yt; int x = 0, y = 0, xt, yt;
uint8_t *d = b->data; const uint8_t *d = b->data;
/*calculate sin/cos of angle only once*/ /*calculate sin/cos of angle only once*/
if(sina>1 || sina<-1) sina = small_sin(angle); if(sina>1 || sina<-1) sina = small_sin(angle);
......
...@@ -95,8 +95,8 @@ DEPFLAGS = -MMD -MP -MF $(@:.o=.d) ...@@ -95,8 +95,8 @@ DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
# #
override CFLAGS += -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb \ override CFLAGS += -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb \
-mfix-cortex-m3-ldrd -ffunction-sections \ -mfix-cortex-m3-ldrd -ffunction-sections \
-fdata-sections -fomit-frame-pointer -DGCC_ARMCM3 \ -fdata-sections -fomit-frame-pointer -DGCC_ARMCM3 -DFREERTOS $(DEPFLAGS) \
-DFREERTOS $(DEPFLAGS) -Wno-missing-field-initializers -Wno-unused-function -Wno-switch
override ASMFLAGS += -x assembler-with-cpp -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb override ASMFLAGS += -x assembler-with-cpp -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <gfx/ui.h> #include <gfx/ui.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <sincos.h> #include <sincos.h>
#include <stdio.h>
#ifdef DEBUG #ifdef DEBUG
#include <usbdbg.h> #include <usbdbg.h>
...@@ -45,7 +46,7 @@ lsm303_smpl iron; ...@@ -45,7 +46,7 @@ lsm303_smpl iron;
static void compass_redraw(struct ui_widget *w) static void compass_redraw(struct ui_widget *w)
{ {
static int angle, ff; static int angle;
int arr_h, arr_w, cir_h, cir_w; int arr_h, arr_w, cir_h, cir_w;
char buf[20]; char buf[20];
...@@ -85,6 +86,7 @@ static void compass_redraw(struct ui_widget *w) ...@@ -85,6 +86,7 @@ static void compass_redraw(struct ui_widget *w)
static void compass_event(struct ui_widget *w, const struct event *evt) static void compass_event(struct ui_widget *w, const struct event *evt)
{ {
(void) evt; // suppress warnings
w->flags |= WF_DIRTY; w->flags |= WF_DIRTY;
} }
...@@ -111,7 +113,7 @@ void compass_main(void *params) ...@@ -111,7 +113,7 @@ void compass_main(void *params)
lsm303_smpl acc, mag; lsm303_smpl acc, mag;
lsm303_smpl c_max, c_min; lsm303_smpl c_max, c_min;
int pitch, roll, xh, yh, th, x_comp, y_comp; int pitch, roll, xh, yh, th, x_comp, y_comp;
unsigned int x2, y2, z2; /*unsigned int x2, y2, z2;*/
float xy_mean; float xy_mean;
char buf[50]; char buf[50];
...@@ -168,9 +170,9 @@ void compass_main(void *params) ...@@ -168,9 +170,9 @@ void compass_main(void *params)
} }
if(!calib) { if(!calib) {
/* calculate pitch and roll from accelerometer */ /* calculate pitch and roll from accelerometer */
x2 = acc.x * acc.x; /*x2 = acc.x * acc.x;*/
y2 = acc.y * acc.y; /*y2 = acc.y * acc.y;*/
z2 = acc.z * acc.z; /*z2 = acc.z * acc.z;*/
pitch = -small_atan(acc.x, small_sqrt(acc.y*acc.y + acc.z*acc.z)); pitch = -small_atan(acc.x, small_sqrt(acc.y*acc.y + acc.z*acc.z));
roll = small_atan(acc.y, small_sqrt(acc.x*acc.x + acc.z*acc.z)); roll = small_atan(acc.y, small_sqrt(acc.x*acc.x + acc.z*acc.z));
sprintf(buf, "p: %d, r: %d\n\r", pitch, roll); sprintf(buf, "p: %d, r: %d\n\r", pitch, roll);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "drivers/vibra.h" #include "drivers/vibra.h"
#include <string.h> // for strcpy #include <string.h> // for strcpy
#include <stdio.h> // for sprintf
static char message[32] = "hello world"; static char message[32] = "hello world";
......
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
#include "application.h" #include "application.h"
#include "widgets/status_bar.h" #include "widgets/status_bar.h"
#include <drivers/lsm303c.h> #include <drivers/lsm303c.h>
#include <drivers/buzzer.h>
#include <drivers/vibra.h>
#include <sincos.h> #include <sincos.h>
#include <stdio.h>
#define S_WIN_X0 5 #define S_WIN_X0 5
#define S_WIN_Y0 25 #define S_WIN_Y0 25
...@@ -44,7 +47,7 @@ ...@@ -44,7 +47,7 @@
unsigned int win_x0, win_y0, win_x1, win_y1; unsigned int win_x0, win_y0, win_x1, win_y1;
unsigned int score, highscore; unsigned int score, highscore;
int mode; int mode;
int ball_x, ball_y; unsigned int ball_x, ball_y;
static void game_redraw(struct ui_widget *w) static void game_redraw(struct ui_widget *w)
{ {
...@@ -69,6 +72,7 @@ static void game_redraw(struct ui_widget *w) ...@@ -69,6 +72,7 @@ static void game_redraw(struct ui_widget *w)
static void game_event(struct ui_widget *w, const struct event *evt) static void game_event(struct ui_widget *w, const struct event *evt)
{ {
(void) evt; // suppress warnings
w->flags |= WF_DIRTY; w->flags |= WF_DIRTY;
} }
...@@ -94,9 +98,8 @@ void game_main(void *params) ...@@ -94,9 +98,8 @@ void game_main(void *params)
struct event evt; struct event evt;
lsm303_smpl acc; lsm303_smpl acc;
int fakap = 0; int fakap = 0;
char buf[30];
int old_x, old_y; int old_x, old_y;
int dir = 0, fact; int fact;
lsm303_init(); lsm303_init();
buzzer_set_freq(4000); buzzer_set_freq(4000);
......
...@@ -136,7 +136,6 @@ void gpscoord_main(void *params) ...@@ -136,7 +136,6 @@ void gpscoord_main(void *params)
(void) params; (void) params;
struct event evt; struct event evt;
int i = 0;
/* Init UI */ /* Init UI */
ui_clear(); ui_clear();
......
...@@ -48,6 +48,7 @@ static struct ui_widget reset_screen = { ...@@ -48,6 +48,7 @@ static struct ui_widget reset_screen = {
void reset_main(void *params) void reset_main(void *params)
{ {
(void) params; // suppress warnings
struct event evt; struct event evt;
/* Init UI */ /* Init UI */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <event.h> #include <event.h>
#include <math.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <drivers/gps.h> #include <drivers/gps.h>
...@@ -59,14 +59,14 @@ static void status_bar_event(struct ui_widget *w, const struct event *evt) ...@@ -59,14 +59,14 @@ static void status_bar_event(struct ui_widget *w, const struct event *evt)
memcpy(&gps_ico, &gps_searching, memcpy(&gps_ico, &gps_searching,
sizeof(struct rle_bitmap)); sizeof(struct rle_bitmap));
} else { } else {
memcpy(&gps_ico, 0, sizeof(struct rle_bitmap)); memset(&gps_ico, 0, sizeof(struct rle_bitmap));
} }
} }
w->flags |= WF_DIRTY; w->flags |= WF_DIRTY;
break; break;
case GPS_OFF: case GPS_OFF:
memcpy(&gps_ico, 0, sizeof(struct rle_bitmap)); memset(&gps_ico, 0, sizeof(struct rle_bitmap));
w->flags |= WF_DIRTY; w->flags |= WF_DIRTY;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment