... | ... |
@@ -17,10 +17,10 @@ MEMMODEL = -mmemory-model=huge -fdata-sections -ffunction-sections # -mdata-re |
17 | 17 |
# MEMMODEL = -mmemory-model=medium -misr20 |
18 | 18 |
#MEMMODEL = -mmemory-model=medium |
19 | 19 |
|
20 |
-#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 |
|
20 |
+APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 |
|
21 | 21 |
#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DWITH_BTSTACK |
22 | 22 |
#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DCC256x_TRANSP |
23 |
-APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2 |
|
23 |
+#APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2 |
|
24 | 24 |
|
25 | 25 |
# List all the source files here |
26 | 26 |
# eg if you have a source file foo.c then list it here |
... | ... |
@@ -48,9 +48,12 @@ SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \ |
48 | 48 |
#INCLUDES = $(BT_SMALLTOOTH_INV) |
49 | 49 |
INCLUDES = -I../ui/ |
50 | 50 |
|
51 |
+# BUILDNO = \"\#$(shell cat .buildno)-$(shell date +%y%m%d)\" |
|
52 |
+BUILDNO = \"$(shell date +%y%m%d)-\#$(shell cat .buildno)\" |
|
53 |
+ |
|
51 | 54 |
# Add or subtract whatever MSPGCC flags you want. There are plenty more |
52 | 55 |
####################################################################################### |
53 |
-CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG) |
|
56 |
+CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG) -DBUILDNO=$(BUILDNO) |
|
54 | 57 |
ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs |
55 | 58 |
LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map |
56 | 59 |
######################################################################################## |
... | ... |
@@ -76,7 +79,7 @@ DEPEND = $(SOURCES:.c=.d) |
76 | 79 |
# all the object files |
77 | 80 |
OBJECTS = $(SOURCES:.c=.o) |
78 | 81 |
|
79 |
-all: $(TARGET).elf $(TARGET).hex $(TARGET).txt |
|
82 |
+all: .buildno $(TARGET).elf $(TARGET).hex $(TARGET).txt |
|
80 | 83 |
|
81 | 84 |
prog: $(TARGET).hex |
82 | 85 |
mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex" |
... | ... |
@@ -126,3 +129,7 @@ clean: |
126 | 129 |
-$(RM) $(TARGET).* |
127 | 130 |
-$(RM) $(SOURCES:.c=.lst) |
128 | 131 |
-$(RM) $(DEPEND) |
132 |
+ |
|
133 |
+.buildno: $(OBJECTS) |
|
134 |
+ @if ! test -f .buildno; then echo 0 > .buildno; fi |
|
135 |
+ @echo $$(($$(cat .buildno) + 1)) > .buildno |
... | ... |
@@ -13,12 +13,29 @@ |
13 | 13 |
#include "mw_bt.h" |
14 | 14 |
#include "bt_hci.h" |
15 | 15 |
#include "bt_l2cap.h" |
16 |
+#include "bluetooth_init_cc256x.h" |
|
16 | 17 |
|
17 | 18 |
#include "oswald.h" |
18 | 19 |
#include "oswald_hal.h" |
19 | 20 |
|
20 | 21 |
#include "calendar.h" |
21 | 22 |
|
23 |
+ |
|
24 |
+const char *hal_get_version_string(void) |
|
25 |
+{ |
|
26 |
+ return MW_MAIN_VERSION; |
|
27 |
+} |
|
28 |
+ |
|
29 |
+const char *hal_get_buildno_string(void) |
|
30 |
+{ |
|
31 |
+ return BUILDNO; |
|
32 |
+} |
|
33 |
+ |
|
34 |
+const char *hal_get_radio_version_string(void) |
|
35 |
+{ |
|
36 |
+ return cc256x_version; |
|
37 |
+} |
|
38 |
+ |
|
22 | 39 |
void hal_lcd_set_pixel(uint8_t x, uint8_t y, uint8_t color) |
23 | 40 |
{ |
24 | 41 |
x %= 96; |
... | ... |
@@ -1,15 +1,23 @@ |
1 | 1 |
ACLOCAL_AMFLAGS = -I m4 |
2 | 2 |
|
3 |
-bin_PROGRAMS = oswald-gui |
|
3 |
+bin_PROGRAMS = .buildno oswald-gui |
|
4 | 4 |
|
5 | 5 |
oswald_gui_SOURCES = oswald-ui.c oswald_main.c \ |
6 | 6 |
oswald_watch_faces.c oswald_strings.c oswald_screens.c \ |
7 | 7 |
embedvm.c oswald_graphics.c calendar.c oswald_fonts.c |
8 | 8 |
|
9 |
-oswald_gui_CFLAGS = -g $(GTK_CFLAGS) |
|
9 |
+# BUILDNO = \"$(shell cat .buildno)\" |
|
10 |
+BUILDNO = \"$(shell date +%y%m%d)-\#$(shell cat .buildno)\" |
|
11 |
+ |
|
12 |
+oswald_gui_CFLAGS = -DBUILDNO=$(BUILDNO) -g $(GTK_CFLAGS) |
|
13 |
+ |
|
10 | 14 |
oswald_gui_LDADD = $(GTK_LIBS) |
11 | 15 |
|
12 | 16 |
EXTRA_DIST = config.rpath m4/ChangeLog \ |
13 | 17 |
AUTHORS \ |
14 | 18 |
COPYING \ |
15 | 19 |
README.txt |
20 |
+ |
|
21 |
+.buildno: $(oswald_gui_OBJECTS) |
|
22 |
+ @if ! test -f .buildno; then echo 0 > .buildno; fi |
|
23 |
+ @echo $$(($$(cat .buildno) + 1)) > .buildno |
... | ... |
@@ -94,6 +94,22 @@ void hal_bluetooth_send_data(const void *mdat, uint16_t mlen) |
94 | 94 |
g_printerr("write comm %d\n", mlen); |
95 | 95 |
} |
96 | 96 |
|
97 |
+const char *hal_get_version_string(void) |
|
98 |
+{ |
|
99 |
+ return "GTK v0.3"; |
|
100 |
+} |
|
101 |
+ |
|
102 |
+const char *hal_get_buildno_string(void) |
|
103 |
+{ |
|
104 |
+ return BUILDNO; |
|
105 |
+} |
|
106 |
+ |
|
107 |
+const char *hal_get_radio_version_string(void) |
|
108 |
+{ |
|
109 |
+ return "BlueZ"; |
|
110 |
+} |
|
111 |
+ |
|
112 |
+ |
|
97 | 113 |
static gint |
98 | 114 |
configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) |
99 | 115 |
{ |
... | ... |
@@ -311,19 +327,19 @@ static void create_mainwin(oswald_ui *ui) |
311 | 327 |
|
312 | 328 |
l = gtk_label_new("X:"); |
313 | 329 |
gtk_box_pack_start (GTK_BOX(hb), l, FALSE, FALSE, 5); |
314 |
- sc = gtk_hscale_new_with_range (0, 255, 1); |
|
330 |
+ sc = gtk_hscale_new_with_range (-128, 127, 1); |
|
315 | 331 |
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5); |
316 | 332 |
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelX_value_changed), ui); |
317 | 333 |
|
318 | 334 |
l = gtk_label_new("Y:"); |
319 | 335 |
gtk_box_pack_start (GTK_BOX(hb), l, FALSE, FALSE, 5); |
320 |
- sc = gtk_hscale_new_with_range (0, 255, 1); |
|
336 |
+ sc = gtk_hscale_new_with_range (-128, 127, 1); |
|
321 | 337 |
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5); |
322 | 338 |
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelY_value_changed), ui); |
323 | 339 |
|
324 | 340 |
l = gtk_label_new("Z:"); |
325 | 341 |
gtk_box_pack_start (GTK_BOX(hb), l, FALSE, FALSE, 5); |
326 |
- sc = gtk_hscale_new_with_range (0, 255, 1); |
|
342 |
+ sc = gtk_hscale_new_with_range (-128, 127, 1); |
|
327 | 343 |
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5); |
328 | 344 |
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelZ_value_changed), ui); |
329 | 345 |
|
... | ... |
@@ -4,6 +4,8 @@ |
4 | 4 |
#include <string.h> |
5 | 5 |
#include <stdint.h> |
6 | 6 |
|
7 |
+#define OSWALD_VERSION "v0.3" |
|
8 |
+ |
|
7 | 9 |
//#define DEBUG 1 |
8 | 10 |
#ifdef DEBUG |
9 | 11 |
#define dbg_out( args... ) fprintf(stderr, args) |
... | ... |
@@ -55,9 +57,10 @@ typedef enum { |
55 | 57 |
STOP_WATCH_SCREEN, |
56 | 58 |
BLUETOOTH_SCREEN, |
57 | 59 |
ACCEL_DISPLAY_SCREEN, |
58 |
- MENU_TEST_SCREEN, |
|
59 |
-// APPLICATION_SCREEN, |
|
60 |
+ INFO_SCREEN, |
|
60 | 61 |
LAST_SCREEN, // a marker for the last (not valid) screen) |
62 |
+ MENU_TEST_SCREEN, |
|
63 |
+ APPLICATION_SCREEN, |
|
61 | 64 |
DATETIME_SETTING_SCREEN, |
62 | 65 |
ALARM_SCREEN, |
63 | 66 |
SCREENS_END, |
... | ... |
@@ -103,9 +106,9 @@ typedef struct { |
103 | 106 |
} watch_state; |
104 | 107 |
|
105 | 108 |
typedef struct { |
106 |
- uint8_t x; |
|
107 |
- uint8_t y; |
|
108 |
- uint8_t z; |
|
109 |
+ int8_t x; |
|
110 |
+ int8_t y; |
|
111 |
+ int8_t z; |
|
109 | 112 |
} accel_data_t; |
110 | 113 |
|
111 | 114 |
#define POWER_SOURCE_BATTERY 0 |
... | ... |
@@ -6,6 +6,11 @@ |
6 | 6 |
#include "oswald_graphics.h" |
7 | 7 |
|
8 | 8 |
|
9 |
+void oswald_draw_pixel(const unsigned int xstart, const unsigned int ystart) |
|
10 |
+{ |
|
11 |
+ hal_lcd_set_pixel(xstart, ystart, TRUE); |
|
12 |
+} |
|
13 |
+ |
|
9 | 14 |
void oswald_draw_bitmap_opts(const unsigned int xstart, const unsigned int ystart, const unsigned int xoff, const unsigned int yoff, const unsigned int width, const unsigned int height, const unsigned int bmp_width, const unsigned int bmp_height, const void *bmp) |
10 | 15 |
{ |
11 | 16 |
unsigned int x, y; |
... | ... |
@@ -9,6 +9,8 @@ |
9 | 9 |
// #include "Fonts.h" |
10 | 10 |
|
11 | 11 |
|
12 |
+void oswald_draw_pixel(const unsigned int xstart, const unsigned int ystart); |
|
13 |
+ |
|
12 | 14 |
void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp); |
13 | 15 |
|
14 | 16 |
void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend); |
... | ... |
@@ -5,6 +5,10 @@ |
5 | 5 |
* these functions must be implemented for a concrete hardware |
6 | 6 |
*/ |
7 | 7 |
|
8 |
+const char *hal_get_version_string(void); |
|
9 |
+const char *hal_get_buildno_string(void); |
|
10 |
+const char *hal_get_radio_version_string(void); |
|
11 |
+ |
|
8 | 12 |
void hal_lcd_set_pixel(uint8_t x, uint8_t y, uint8_t color); |
9 | 13 |
void hal_lcd_clear_display(void); |
10 | 14 |
void hal_lcd_update_display(void); |
... | ... |
@@ -211,6 +211,9 @@ void oswald_init(void) |
211 | 211 |
OswaldScreens[ALARM_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_HALF_SEC_TIMER; |
212 | 212 |
OswaldScreens[ALARM_SCREEN].event_func = alarm_handle_events; |
213 | 213 |
|
214 |
+ OswaldScreens[INFO_SCREEN].event_mask = 0x00; // this one does not consume any events |
|
215 |
+ OswaldScreens[INFO_SCREEN].event_func = info_screen_handle_events; |
|
216 |
+ |
|
214 | 217 |
OswaldState.screen_id = IDLE_SCREEN; |
215 | 218 |
OswaldState.screen = &OswaldScreens[OswaldState.screen_id]; |
216 | 219 |
|
... | ... |
@@ -48,7 +48,21 @@ __attribute__((__far__)) |
48 | 48 |
#endif |
49 | 49 |
#include "bitmaps/Bluetooth_icon.xbm" |
50 | 50 |
|
51 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
52 |
+__attribute__((__far__)) |
|
53 |
+#endif |
|
54 |
+#include "bitmaps/info_icon.xbm" |
|
55 |
+ |
|
56 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
57 |
+__attribute__((__far__)) |
|
58 |
+#endif |
|
59 |
+#include "bitmaps/acc_icon.xbm" |
|
60 |
+ |
|
61 |
+ |
|
51 | 62 |
|
63 |
+/* |
|
64 |
+ * Common event handler part of the watch faces |
|
65 |
+ */ |
|
52 | 66 |
typedef struct { |
53 | 67 |
void (*screendraw_func)(boolean show_seconds); |
54 | 68 |
boolean show_seconds; |
... | ... |
@@ -117,6 +131,9 @@ event_ret_t idle_handle_events(uint16_t event, void *data) |
117 | 131 |
} |
118 | 132 |
|
119 | 133 |
|
134 |
+/* |
|
135 |
+ * Accelerometer and sensor display screen |
|
136 |
+ */ |
|
120 | 137 |
typedef struct { |
121 | 138 |
accel_data_t accdata; |
122 | 139 |
} accelscreen_data_t; |
... | ... |
@@ -128,15 +145,24 @@ void draw_accel_screen(accel_data_t *accel_data) |
128 | 145 |
{ |
129 | 146 |
hal_lcd_clear_display(); |
130 | 147 |
|
131 |
- oswald_write_string(0, 2, FONT_6x9, "X:"); |
|
132 |
- oswald_write_number(20, 2, FONT_6x9, accel_data->x); |
|
133 |
- oswald_write_string(0, 16, FONT_6x9, "Y:"); |
|
134 |
- oswald_write_number(20, 16, FONT_6x9, accel_data->y); |
|
135 |
- oswald_write_string(0, 32, FONT_6x9, "Z:"); |
|
136 |
- oswald_write_number(20, 32, FONT_6x9, accel_data->z); |
|
148 |
+ oswald_draw_bitmap(36, 0, acc_icon_width, acc_icon_height, acc_icon_bits); |
|
149 |
+ |
|
150 |
+ oswald_write_string(1, 40, FONT_6x9, "X:"); |
|
151 |
+ oswald_write_number(15, 40, FONT_6x9, accel_data->x); |
|
152 |
+ oswald_write_string(1, 52, FONT_6x9, "Y:"); |
|
153 |
+ oswald_write_number(15, 52, FONT_6x9, accel_data->y); |
|
154 |
+ oswald_write_string(1, 64, FONT_6x9, "Z:"); |
|
155 |
+ oswald_write_number(15, 64, FONT_6x9, accel_data->z); |
|
156 |
+ |
|
157 |
+ oswald_write_string(1, 85, FONT_6x9, "Light:"); |
|
158 |
+ oswald_write_number(50, 85, FONT_6x9, 0); |
|
137 | 159 |
|
138 |
- oswald_write_string(0, 54, FONT_6x9, "Light:"); |
|
139 |
- oswald_write_number(50, 54, FONT_6x9, accel_data->z); |
|
160 |
+ oswald_draw_line(40, 30, 92, 30); |
|
161 |
+ oswald_draw_line(92, 30, 92, 82); |
|
162 |
+ oswald_draw_line(40, 82, 92, 82); |
|
163 |
+ oswald_draw_line(40, 82, 40, 30); |
|
164 |
+ |
|
165 |
+ oswald_draw_pixel(41+25+((accel_data->x * 50) / (254)), 31+25+((accel_data->y * 50) / (254))); |
|
140 | 166 |
|
141 | 167 |
hal_lcd_update_display(); |
142 | 168 |
} |
... | ... |
@@ -168,6 +194,9 @@ event_ret_t accel_handle_events(uint16_t event, void *data) |
168 | 194 |
} |
169 | 195 |
|
170 | 196 |
|
197 |
+/* |
|
198 |
+ * Date / time setup screen |
|
199 |
+ */ |
|
171 | 200 |
typedef struct { |
172 | 201 |
uint8_t pos; |
173 | 202 |
boolean set_mode; |
... | ... |
@@ -366,9 +395,8 @@ event_ret_t datetime_setup_events(uint16_t event, void *data) |
366 | 395 |
|
367 | 396 |
|
368 | 397 |
/* |
369 |
- * Alarm setup |
|
398 |
+ * Alarm setup screen |
|
370 | 399 |
*/ |
371 |
- |
|
372 | 400 |
typedef struct { |
373 | 401 |
uint8_t pos; |
374 | 402 |
boolean set_mode; |
... | ... |
@@ -550,7 +578,6 @@ event_ret_t alarm_setup_events(uint16_t event, void *data) |
550 | 578 |
/* |
551 | 579 |
* Test menu |
552 | 580 |
*/ |
553 |
- |
|
554 | 581 |
typedef struct { |
555 | 582 |
uint8_t menu_pos; |
556 | 583 |
} test_menu_t; |
... | ... |
@@ -625,7 +652,6 @@ event_ret_t test_menu_handle_events(uint16_t event, void *data) |
625 | 652 |
/* |
626 | 653 |
* Stop Watch |
627 | 654 |
*/ |
628 |
- |
|
629 | 655 |
typedef struct { |
630 | 656 |
uint8_t hr; |
631 | 657 |
uint8_t min; |
... | ... |
@@ -786,7 +812,7 @@ event_ret_t stop_watch_handle_events(uint16_t event, void *data) |
786 | 812 |
|
787 | 813 |
|
788 | 814 |
/* |
789 |
- * when alarm is fired |
|
815 |
+ * Alarm screen, shown when alarm is fired |
|
790 | 816 |
*/ |
791 | 817 |
void draw_alarm_screen(void) |
792 | 818 |
{ |
... | ... |
@@ -832,7 +858,7 @@ event_ret_t alarm_handle_events(uint16_t event, void *data) |
832 | 858 |
|
833 | 859 |
|
834 | 860 |
/* |
835 |
- * Bluetooth screen |
|
861 |
+ * Bluetooth setup screen |
|
836 | 862 |
*/ |
837 | 863 |
typedef struct { |
838 | 864 |
uint8_t pos; |
... | ... |
@@ -1000,3 +1026,42 @@ event_ret_t bluetooth_screen_events(uint16_t event, void *data) |
1000 | 1026 |
return EVENT_RET_HANDLED; |
1001 | 1027 |
} |
1002 | 1028 |
|
1029 |
+ |
|
1030 |
+/* |
|
1031 |
+ * Info Screen |
|
1032 |
+ */ |
|
1033 |
+void draw_info_screen(accel_data_t *accel_data) |
|
1034 |
+{ |
|
1035 |
+ hal_lcd_clear_display(); |
|
1036 |
+ |
|
1037 |
+ oswald_draw_bitmap(36, 0, info_icon_width, info_icon_height, info_icon_bits); |
|
1038 |
+ |
|
1039 |
+ oswald_write_string(2, 29, FONT_DROID8x12, "Oswald"); |
|
1040 |
+ oswald_write_string(35, 29, FONT_DROID8x12, OSWALD_VERSION); |
|
1041 |
+ oswald_write_string(2, 41, FONT_DROID8x12, "HAL"); |
|
1042 |
+ oswald_write_string(35, 41, FONT_DROID8x12, (char *)hal_get_version_string()); |
|
1043 |
+ oswald_write_string(2, 53, FONT_DROID8x12, "Build"); |
|
1044 |
+ oswald_write_string(35, 53, FONT_DROID8x12, (char *)hal_get_buildno_string()); |
|
1045 |
+ oswald_write_string(2, 65, FONT_DROID8x12, "Radio"); |
|
1046 |
+ oswald_write_string(35, 65, FONT_DROID8x12, (char *)hal_get_radio_version_string()); |
|
1047 |
+ |
|
1048 |
+ hal_lcd_update_display(); |
|
1049 |
+} |
|
1050 |
+ |
|
1051 |
+event_ret_t info_screen_handle_events(uint16_t event, void *data) |
|
1052 |
+{ |
|
1053 |
+ switch (event) { |
|
1054 |
+ case EVENT_SCREEN_VISIBLE: |
|
1055 |
+ draw_info_screen(&accel_screen.accdata); |
|
1056 |
+ return EVENT_RET_HANDLED; |
|
1057 |
+ break; |
|
1058 |
+ case EVENT_USER_BUTTONS: |
|
1059 |
+ dbg_out("button event %d\n", *(int *)data); |
|
1060 |
+ break; |
|
1061 |
+ default: |
|
1062 |
+ return EVENT_RET_UNHANDLED; |
|
1063 |
+ break; |
|
1064 |
+ }; |
|
1065 |
+ return EVENT_RET_UNHANDLED; |
|
1066 |
+} |
|
1067 |
+ |