... | ... |
@@ -25,8 +25,9 @@ APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 |
25 | 25 |
# List all the source files here |
26 | 26 |
# eg if you have a source file foo.c then list it here |
27 | 27 |
OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \ |
28 |
- ../ui/oswald_watch_faces.c ../ui/Fonts.c ../ui/LcdDisplay.c \ |
|
28 |
+ ../ui/oswald_watch_faces.c \ |
|
29 | 29 |
../ui/oswald_strings.c ../ui/calendar.c \ |
30 |
+ ../ui/oswald_graphics.c ../ui/oswald_fonts.c \ |
|
30 | 31 |
../ui/embedvm.c |
31 | 32 |
|
32 | 33 |
SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \ |
... | ... |
@@ -41,7 +42,7 @@ SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \ |
41 | 42 |
# Include are located in the Include directory |
42 | 43 |
#INCLUDES = $(BT_STACK_INC) |
43 | 44 |
#INCLUDES = $(BT_SMALLTOOTH_INV) |
44 |
-INCLUDES = -I../ui/ -I../ui/bitmaps/ |
|
45 |
+INCLUDES = -I../ui/ |
|
45 | 46 |
|
46 | 47 |
# Add or subtract whatever MSPGCC flags you want. There are plenty more |
47 | 48 |
####################################################################################### |
... | ... |
@@ -2,10 +2,10 @@ |
2 | 2 |
#define _BT_HCI_H |
3 | 3 |
|
4 | 4 |
/* HCI Command OGF */ |
5 |
-#define HCI_LINK_CTRL_OGF 0x01 |
|
6 |
-#define HCI_LINK_POLICY_OGF 0x02 |
|
7 |
-#define HCI_HC_BB_OGF 0x03 |
|
8 |
-#define HCI_INFO_PARAM_OGF 0x04 |
|
5 |
+#define HCI_LINK_CTRL_OGF 0x01 |
|
6 |
+#define HCI_LINK_POLICY_OGF 0x02 |
|
7 |
+#define HCI_HC_BB_OGF 0x03 |
|
8 |
+#define HCI_INFO_PARAM_OGF 0x04 |
|
9 | 9 |
|
10 | 10 |
/* HCI Command OCF */ |
11 | 11 |
#define HCI_DISCONN_OCF 0x06 |
... | ... |
@@ -83,6 +83,8 @@ |
83 | 83 |
#define EHCILL_WAKE_UP_IND 0x32 |
84 | 84 |
#define EHCILL_WAKE_UP_ACK 0x33 |
85 | 85 |
|
86 |
+#define BT_PIN "4312" |
|
87 |
+ |
|
86 | 88 |
void bt_hci_init(void); |
87 | 89 |
void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, const void *data); |
88 | 90 |
void bt_acl_send(const uint16_t handle, const uint8_t PB, const uint8_t BC, const uint16_t channel, const uint16_t len, const void *dat); |
... | ... |
@@ -6,21 +6,6 @@ |
6 | 6 |
#include "LcdDisplay.h" |
7 | 7 |
|
8 | 8 |
|
9 |
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp) |
|
10 |
-{ |
|
11 |
- uint8_t x, y; |
|
12 |
- uint8_t *cb; |
|
13 |
- |
|
14 |
- // we only draw set pixel, unset pixel remain as they are |
|
15 |
- for (y=0; y<height; y++) { |
|
16 |
- for (x=0; x<width; x++) { |
|
17 |
- cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8)); |
|
18 |
- if (*cb & (1 << (x % 8))) |
|
19 |
- hal_lcd_set_pixel(xstart + x, ystart + y, TRUE); |
|
20 |
- } |
|
21 |
- } |
|
22 |
-} |
|
23 |
- |
|
24 | 9 |
void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend) |
25 | 10 |
{ |
26 | 11 |
int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
... | ... |
@@ -3,7 +3,6 @@ |
3 | 3 |
|
4 | 4 |
// #include "oswald_hal.h" |
5 | 5 |
|
6 |
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp); |
|
7 | 6 |
void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend); |
8 | 7 |
void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness); |
9 | 8 |
u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character); |
... | ... |
@@ -2,8 +2,10 @@ ACLOCAL_AMFLAGS = -I m4 |
2 | 2 |
|
3 | 3 |
bin_PROGRAMS = oswald-gui |
4 | 4 |
|
5 |
-oswald_gui_SOURCES = oswald-ui.c LcdDisplay.c Fonts.c oswald_main.c oswald_watch_faces.c oswald_strings.c oswald_screens.c \ |
|
6 |
-embedvm.c oswald_fonts.c oswald_graphics.c calendar.c |
|
5 |
+oswald_gui_SOURCES = oswald-ui.c oswald_main.c \ |
|
6 |
+ oswald_watch_faces.c oswald_strings.c oswald_screens.c \ |
|
7 |
+ embedvm.c oswald_graphics.c calendar.c oswald_fonts.c |
|
8 |
+ |
|
7 | 9 |
oswald_gui_CFLAGS = -g $(GTK_CFLAGS) |
8 | 10 |
oswald_gui_LDADD = $(GTK_LIBS) |
9 | 11 |
|
... | ... |
@@ -1,40 +1,40 @@ |
1 | 1 |
#include "oswald_fonts.h" |
2 | 2 |
|
3 |
-#include "fonts/4x6_horizontal_LSB_1.h" |
|
4 |
-#include "fonts/5x8_horizontal_LSB_1.h" |
|
5 |
-#include "fonts/5x12_horizontal_LSB_1.h" |
|
6 |
-#include "fonts/6x8_horizontal_LSB_1.h" |
|
7 |
-#include "fonts/6x10_horizontal_LSB_1.h" |
|
8 |
-#include "fonts/7x12b_horizontal_LSB_1.h" |
|
9 |
-#include "fonts/7x12_horizontal_LSB_1.h" |
|
10 |
-#include "fonts/8x8_horizontal_LSB_1.h" |
|
11 |
-#include "fonts/8x12_horizontal_LSB_1.h" |
|
12 |
-#include "fonts/8x14_horizontal_LSB_1.h" |
|
13 |
-#include "fonts/10x16_horizontal_LSB_1.h" |
|
14 |
-#include "fonts/12x16_horizontal_LSB_1.h" |
|
15 |
-#include "fonts/12x20_horizontal_LSB_1.h" |
|
16 |
-#include "fonts/16x26_horizontal_LSB_1.h" |
|
17 |
-#include "fonts/22x36_horizontal_LSB_1.h" |
|
18 |
-#include "fonts/24x40_horizontal_LSB_1.h" |
|
19 |
-#include "fonts/32x53_horizontal_LSB_1.h" |
|
3 |
+//#include "fonts/m4x6_horizontal_LSB_1.h" |
|
4 |
+//#include "fonts/m5x8_horizontal_LSB_1.h" |
|
5 |
+//#include "fonts/m5x12_horizontal_LSB_1.h" |
|
6 |
+#include "fonts/m6x8_horizontal_LSB_1.h" |
|
7 |
+//#include "fonts/m6x10_horizontal_LSB_1.h" |
|
8 |
+#include "fonts/m7x12b_horizontal_LSB_1.h" |
|
9 |
+//#include "fonts/m7x12_horizontal_LSB_1.h" |
|
10 |
+//#include "fonts/m8x8_horizontal_LSB_1.h" |
|
11 |
+//#include "fonts/m8x12_horizontal_LSB_1.h" |
|
12 |
+//#include "fonts/m8x14_horizontal_LSB_1.h" |
|
13 |
+//#include "fonts/m10x16_horizontal_LSB_1.h" |
|
14 |
+//#include "fonts/m12x16_horizontal_LSB_1.h" |
|
15 |
+//#include "fonts/m12x20_horizontal_LSB_1.h" |
|
16 |
+#include "fonts/m16x26_horizontal_LSB_1.h" |
|
17 |
+//#include "fonts/m22x36_horizontal_LSB_1.h" |
|
18 |
+//#include "fonts/m24x40_horizontal_LSB_1.h" |
|
19 |
+//#include "fonts/m32x53_horizontal_LSB_1.h" |
|
20 | 20 |
|
21 | 21 |
const oswald_font oswald_fonts[LAST_FONT] = { |
22 |
- { 4, 6, (char **)font_4x6}, |
|
23 |
- { 5, 8, (char **)font_5x8}, |
|
24 |
- { 5, 12, (char **)font_5x12}, |
|
25 |
- { 6, 8, (char **)font_6x8}, |
|
26 |
- { 6, 10, (char **)font_6x10}, |
|
27 |
- { 7, 12, (char **)font_7x12}, |
|
28 |
- { 7, 12, (char **)font_7x12b}, |
|
29 |
- { 8, 8, (char **)font_8x8}, |
|
30 |
- { 8, 12, (char **)font_8x12}, |
|
31 |
- { 8, 14, (char **)font_8x14}, |
|
32 |
- { 10, 16, (char **)font_10x16}, |
|
33 |
- { 12, 16, (char **)font_12x16}, |
|
34 |
- { 12, 20, (char **)font_12x20}, |
|
35 |
- { 16, 26, (char **)font_16x26}, |
|
36 |
- { 22, 36, (char **)font_22x36}, |
|
37 |
- { 24, 40, (char **)font_24x40}, |
|
38 |
- { 32, 53, (char **)font_32x53}, |
|
22 |
+// { 4, 6, (char *)font_4x6}, |
|
23 |
+// { 5, 8, (char *)font_5x8}, |
|
24 |
+// { 5, 12, (char *)font_5x12}, |
|
25 |
+ { 6, 8, (uint8_t *)font_6x8}, |
|
26 |
+// { 6, 10, (char *)font_6x10}, |
|
27 |
+// { 7, 12, (uint8_t *)font_7x12}, |
|
28 |
+ { 7, 12, (uint8_t *)font_7x12b}, |
|
29 |
+// { 8, 8, (char *)font_8x8}, |
|
30 |
+// { 8, 12, (char *)font_8x12}, |
|
31 |
+// { 8, 14, (char *)font_8x14}, |
|
32 |
+// { 10, 16, (char *)font_10x16}, |
|
33 |
+// { 12, 16, (char *)font_12x16}, |
|
34 |
+// { 12, 20, (char *)font_12x20}, |
|
35 |
+ { 16, 26, (uint8_t *)font_16x26}, |
|
36 |
+// { 22, 36, (char *)font_22x36}, |
|
37 |
+// { 24, 40, (char *)font_24x40}, |
|
38 |
+// { 32, 53, (char *)font_32x53}, |
|
39 | 39 |
}; |
40 | 40 |
|
... | ... |
@@ -4,30 +4,30 @@ |
4 | 4 |
#include "oswald.h" |
5 | 5 |
|
6 | 6 |
typedef enum { |
7 |
- FONT_4x6 = 0, |
|
8 |
- FONT_5x8, |
|
9 |
- FONT_5x12, |
|
10 |
- FONT_6x8, |
|
11 |
- FONT_6x10, |
|
7 |
+// FONT_4x6 = 0, |
|
8 |
+// FONT_5x8 = 0, |
|
9 |
+// FONT_5x12, |
|
10 |
+ FONT_6x8 = 0, |
|
11 |
+// FONT_6x10, |
|
12 |
+// FONT_7x12, |
|
12 | 13 |
FONT_7x12b, |
13 |
- FONT_7x12, |
|
14 |
- FONT_8x8, |
|
15 |
- FONT_8x12, |
|
16 |
- FONT_8x14, |
|
17 |
- FONT_10x16, |
|
18 |
- FONT_12x16, |
|
19 |
- FONT_12x20, |
|
14 |
+// FONT_8x8, |
|
15 |
+// FONT_8x12, |
|
16 |
+// FONT_8x14, |
|
17 |
+// FONT_10x16, |
|
18 |
+// FONT_12x16, |
|
19 |
+// FONT_12x20, |
|
20 | 20 |
FONT_16x26, |
21 |
- FONT_22x36, |
|
22 |
- FONT_24x40, |
|
23 |
- FONT_32x53, |
|
21 |
+// FONT_22x36, |
|
22 |
+// FONT_24x40, |
|
23 |
+// FONT_32x53, |
|
24 | 24 |
LAST_FONT |
25 | 25 |
} oswald_font_face; |
26 | 26 |
|
27 | 27 |
typedef struct { |
28 |
- u8t width; |
|
29 |
- u8t height; |
|
30 |
- char **data; |
|
28 |
+ uint8_t width; |
|
29 |
+ uint8_t height; |
|
30 |
+ uint8_t *data; |
|
31 | 31 |
} oswald_font; |
32 | 32 |
|
33 | 33 |
extern const oswald_font oswald_fonts[]; |
... | ... |
@@ -1,30 +1,80 @@ |
1 |
-#include "oswald-ui.h" |
|
1 |
+#include "oswald.h" |
|
2 | 2 |
#include "oswald_strings.h" |
3 | 3 |
#include "oswald_fonts.h" |
4 |
+#include "oswald_hal.h" |
|
4 | 5 |
|
5 | 6 |
#include "oswald_graphics.h" |
6 | 7 |
|
8 |
+// dummies for MW replacement stuff |
|
9 |
+ |
|
10 |
+void SetFont(etFontType Type) |
|
11 |
+{ |
|
12 |
+} |
|
13 |
+ |
|
14 |
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str) |
|
15 |
+{ |
|
16 |
+ return 1; |
|
17 |
+} |
|
18 |
+ |
|
19 |
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number) |
|
20 |
+{ |
|
21 |
+} |
|
22 |
+ |
|
23 |
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character) |
|
24 |
+{ |
|
25 |
+ return 1; |
|
26 |
+} |
|
27 |
+ |
|
28 |
+ |
|
29 |
+void oswald_draw_bitmap_offset(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 void *bmp) |
|
30 |
+{ |
|
31 |
+ unsigned int x, y; |
|
32 |
+ uint8_t *cb; |
|
33 |
+ |
|
34 |
+ if (bmp == NULL) |
|
35 |
+ return; |
|
36 |
+ |
|
37 |
+ // we only draw set pixel, unset pixel remain as they are |
|
38 |
+ for (y=yoff; y<height; y++) { |
|
39 |
+ for (x=xoff; x<width; x++) { |
|
40 |
+ cb = (uint8_t *)(bmp + (y * ((width / 8) + ((width % 8) ? 1 : 0))) + (x / 8)); |
|
41 |
+ if (*cb & (1 << (x % 8))) |
|
42 |
+ hal_lcd_set_pixel((xstart + x) - xoff, (ystart + y) - yoff, TRUE); |
|
43 |
+ } |
|
44 |
+ } |
|
45 |
+} |
|
7 | 46 |
|
8 | 47 |
#if 0 |
9 |
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp) |
|
48 |
+/*inline*/ void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp) |
|
10 | 49 |
{ |
11 |
- uint8_t x, y; |
|
50 |
+ unsigned int x, y; |
|
12 | 51 |
uint8_t *cb; |
13 | 52 |
|
14 | 53 |
// we only draw set pixel, unset pixel remain as they are |
15 | 54 |
for (y=0; y<height; y++) { |
16 | 55 |
for (x=0; x<width; x++) { |
17 |
- cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8)); |
|
56 |
+ cb = (uint8_t *)(bmp + (y * ((width / 8) + ((width % 8) ? 1 : 0))) + (x / 8)); |
|
18 | 57 |
if (*cb & (1 << (x % 8))) |
19 |
- hal_lcd_set_pixel(xstart + x, ystart + y, TRUE); |
|
58 |
+ hal_lcd_set_pixel((xstart + x), (ystart + y), TRUE); |
|
20 | 59 |
} |
21 | 60 |
} |
22 | 61 |
} |
62 |
+#else |
|
63 |
+void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp) |
|
64 |
+{ |
|
65 |
+ // seems we are triggering a MSPGCC compiler bug here... |
|
66 |
+ // if we do not do this trick then bmp becomes 0x00 when passed a livel higher! |
|
67 |
+ volatile unsigned int num; |
|
68 |
+ |
|
69 |
+ num = (unsigned int) bmp; |
|
70 |
+ |
|
71 |
+ oswald_draw_bitmap_offset(xstart, ystart, 0, 0, width, height, bmp); |
|
72 |
+} |
|
23 | 73 |
#endif |
24 | 74 |
|
25 |
-void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend) |
|
75 |
+void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend) |
|
26 | 76 |
{ |
27 |
- uint8_t x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
|
77 |
+ int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
|
28 | 78 |
|
29 | 79 |
dx = xend - xstart; |
30 | 80 |
dy = yend - ystart; |
... | ... |
@@ -64,10 +114,10 @@ void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend |
64 | 114 |
} |
65 | 115 |
hal_lcd_set_pixel(x, y, TRUE); |
66 | 116 |
} |
67 |
- hal_lcd_update_display(); |
|
117 |
+ // hal_lcd_update_display(); |
|
68 | 118 |
} |
69 | 119 |
|
70 |
-void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness) |
|
120 |
+void oswald_draw_line_ww(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness) |
|
71 | 121 |
{ |
72 | 122 |
int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; |
73 | 123 |
|
... | ... |
@@ -83,13 +133,19 @@ void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickne |
83 | 133 |
dy = -dy; |
84 | 134 |
|
85 | 135 |
if (dx>dy) { |
86 |
- pdx = incx; pdy = 0; |
|
87 |
- ddx=incx; ddy=incy; |
|
88 |
- es =dy; el =dx; |
|
136 |
+ pdx = incx; |
|
137 |
+ pdy = 0; |
|
138 |
+ ddx=incx; |
|
139 |
+ ddy=incy; |
|
140 |
+ es =dy; |
|
141 |
+ el =dx; |
|
89 | 142 |
} else { |
90 |
- pdx=0; pdy=incy; |
|
91 |
- ddx=incx; ddy=incy; |
|
92 |
- es =dx; el =dy; |
|
143 |
+ pdx=0; |
|
144 |
+ pdy=incy; |
|
145 |
+ ddx=incx; |
|
146 |
+ ddy=incy; |
|
147 |
+ es =dx; |
|
148 |
+ el =dy; |
|
93 | 149 |
} |
94 | 150 |
|
95 | 151 |
x = xstart; |
... | ... |
@@ -121,10 +177,10 @@ void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickne |
121 | 177 |
hal_lcd_set_pixel(x, y+i, TRUE); |
122 | 178 |
} |
123 | 179 |
} |
124 |
- hal_lcd_update_display(); |
|
180 |
+ // hal_lcd_update_display(); |
|
125 | 181 |
} |
126 | 182 |
|
127 |
-u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character) |
|
183 |
+uint8_t oswald_write_character(const uint8_t x, const uint8_t y, const oswald_font_face face, const uint8_t Character) |
|
128 | 184 |
{ |
129 | 185 |
#if 0 |
130 | 186 |
u8t CharacterHeight = GetCharacterHeight(); |
... | ... |
@@ -140,25 +196,44 @@ u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character) |
140 | 196 |
if (bitmap[ly] & (1<<lx)) { |
141 | 197 |
hal_lcd_set_pixel(lx+x, ly+y, TRUE); |
142 | 198 |
// printf("."); |
143 |
- } else { |
|
199 |
+ } /*else { |
|
144 | 200 |
hal_lcd_set_pixel(lx+x, ly+y, FALSE); |
145 | 201 |
// printf(" "); |
146 |
- } |
|
202 |
+ }*/ |
|
147 | 203 |
} |
148 | 204 |
// printf("\n"); |
149 | 205 |
} |
150 | 206 |
|
151 | 207 |
return CharacterWidth + GetFontSpacing(); |
152 |
-#endif |
|
153 |
- char *cdata = oswald_fonts[face].data[Character]; |
|
208 |
+#else |
|
209 |
+ uint8_t *cdata = oswald_fonts[face].data; |
|
210 |
+ int csize; |
|
211 |
+ |
|
212 |
+ if (Character == 32) // space / blank |
|
213 |
+ return oswald_fonts[face].width / 2; |
|
214 |
+ |
|
215 |
+ csize = ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0)) * oswald_fonts[face].height; |
|
216 |
+ //csize += (oswald_fonts[face].height / 8) + ((oswald_fonts[face].height % 8) ? 1 : 0); |
|
217 |
+ |
|
218 |
+ // g_printerr("fp = 0x%08lx cdata = 0x%08lx\n", font_7x12, cdata); |
|
154 | 219 |
|
155 |
- dbg_out("%c", cdata[1]); |
|
156 |
- return 0; |
|
220 |
+ cdata = (cdata + (csize * (int)Character)); |
|
221 |
+ |
|
222 |
+ //g_printerr("%02x\n", oswald_fonts[face].data[0][0]); |
|
223 |
+ //g_printerr("char %02x face %d %dx%d csize %d\n", Character, face, oswald_fonts[face].width, oswald_fonts[face].height, csize); |
|
224 |
+ //g_printerr("char %02x %02x %02x\n", (uint8_t)cdata[0], (uint8_t)cdata[1], (uint8_t)cdata[2]); |
|
225 |
+ |
|
226 |
+ // oswald_draw_bitmap(x, y, oswald_fonts[face].height, oswald_fonts[face].height, cdata); |
|
227 |
+ //oswald_draw_bitmap(x, y, ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0))*8, oswald_fonts[face].height, cdata); |
|
228 |
+ oswald_draw_bitmap_offset(x, y, (oswald_fonts[face].width % 8) > 0 ? (8-(oswald_fonts[face].width % 8)) : 0, 0, ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0))*8, oswald_fonts[face].height, cdata); |
|
229 |
+ |
|
230 |
+ return oswald_fonts[face].width; |
|
231 |
+#endif |
|
157 | 232 |
} |
158 | 233 |
|
159 |
-void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str) |
|
234 |
+void oswald_write_string(const uint8_t x, const uint8_t y, const oswald_font_face face, char *str) |
|
160 | 235 |
{ |
161 |
- register lx, i, strl; |
|
236 |
+ uint8_t lx, i, strl; |
|
162 | 237 |
|
163 | 238 |
strl = oswald_strlen(str); |
164 | 239 |
if (strl == 0) |
... | ... |
@@ -166,15 +241,15 @@ void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str) |
166 | 241 |
|
167 | 242 |
lx = x; |
168 | 243 |
for (i=0; i<strl; i++) { |
169 |
- lx += WriteLcdCharacter(lx, y, str[i]); |
|
244 |
+ lx += oswald_write_character(lx, y, face, str[i]); |
|
170 | 245 |
} |
171 | 246 |
} |
172 | 247 |
|
173 | 248 |
|
174 |
-void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number) |
|
249 |
+void oswald_write_number(const uint8_t x, const uint8_t y, const oswald_font_face face, const int16_t number) |
|
175 | 250 |
{ |
176 |
- register lx, i, strl; |
|
177 |
- u8t str[8]; |
|
251 |
+ uint8_t lx, i, strl; |
|
252 |
+ char str[8]; |
|
178 | 253 |
|
179 | 254 |
itoa(number, str, 10); |
180 | 255 |
strl = oswald_strlen(str); |
... | ... |
@@ -183,7 +258,8 @@ void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number) |
183 | 258 |
|
184 | 259 |
lx = x; |
185 | 260 |
for (i=0; i<strl; i++) { |
186 |
- lx += WriteLcdCharacter(lx, y, str[i]); |
|
261 |
+ lx += oswald_write_character(lx, y, face, str[i]); |
|
187 | 262 |
} |
188 | 263 |
} |
189 | 264 |
|
265 |
+ |
... | ... |
@@ -6,18 +6,20 @@ |
6 | 6 |
#include "oswald_fonts.h" |
7 | 7 |
|
8 | 8 |
#include "oswald_graphics.h" |
9 |
+#include "Fonts.h" |
|
9 | 10 |
|
11 |
+void oswald_draw_bitmap_offset(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 void *bmp); |
|
10 | 12 |
|
11 |
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp); |
|
13 |
+/*inline*/ void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp); |
|
12 | 14 |
|
13 |
-void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend); |
|
15 |
+void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend); |
|
14 | 16 |
|
15 |
-void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness); |
|
17 |
+void oswald_draw_line_ww(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness); |
|
16 | 18 |
|
17 |
-u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character); |
|
19 |
+uint8_t oswald_write_character(const uint8_t x, const uint8_t y, const oswald_font_face face, const uint8_t Character); |
|
18 | 20 |
|
19 |
-void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str); |
|
21 |
+void oswald_write_string(const uint8_t x, const uint8_t y, const oswald_font_face face, char *str); |
|
20 | 22 |
|
21 |
-void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number); |
|
23 |
+void oswald_write_number(const uint8_t x, const uint8_t y, const oswald_font_face face, const int16_t number); |
|
22 | 24 |
|
23 | 25 |
#endif |
... | ... |
@@ -3,20 +3,46 @@ |
3 | 3 |
#include "oswald.h" |
4 | 4 |
#include "oswald_main.h" |
5 | 5 |
#include "oswald_watch_faces.h" |
6 |
-#include "Fonts.h" |
|
7 |
-#include "LcdDisplay.h" |
|
6 |
+#include "oswald_graphics.h" |
|
8 | 7 |
#include "oswald_hal.h" |
9 | 8 |
|
10 | 9 |
#include "oswald_screens.h" |
11 | 10 |
|
12 |
-#include "timesetup_icon.xbm" |
|
13 |
-#include "stopwatch_icon.xbm" |
|
14 |
-#include "alarm_icon.xbm" |
|
15 |
-#include "startstopbutton_icon.xbm" |
|
16 |
-#include "lapsebutton_icon.xbm" |
|
17 |
-#include "upbutton_icon.xbm" |
|
18 |
-#include "downbutton_icon.xbm" |
|
19 |
-#include "Bluetooth_icon.xbm" |
|
11 |
+#include "LcdDisplay.h" |
|
12 |
+#include "Fonts.h" |
|
13 |
+ |
|
14 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
15 |
+__attribute__((__far__)) |
|
16 |
+#endif |
|
17 |
+#include "bitmaps/timesetup_icon.xbm" |
|
18 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
19 |
+__attribute__((__far__)) |
|
20 |
+#endif |
|
21 |
+#include "bitmaps/stopwatch_icon.xbm" |
|
22 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
23 |
+__attribute__((__far__)) |
|
24 |
+#endif |
|
25 |
+#include "bitmaps/alarm_icon.xbm" |
|
26 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
27 |
+__attribute__((__far__)) |
|
28 |
+#endif |
|
29 |
+#include "bitmaps/startstopbutton_icon.xbm" |
|
30 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
31 |
+__attribute__((__far__)) |
|
32 |
+#endif |
|
33 |
+#include "bitmaps/lapsebutton_icon.xbm" |
|
34 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
35 |
+__attribute__((__far__)) |
|
36 |
+#endif |
|
37 |
+#include "bitmaps/upbutton_icon.xbm" |
|
38 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
39 |
+__attribute__((__far__)) |
|
40 |
+#endif |
|
41 |
+#include "bitmaps/downbutton_icon.xbm" |
|
42 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
43 |
+__attribute__((__far__)) |
|
44 |
+#endif |
|
45 |
+#include "bitmaps/Bluetooth_icon.xbm" |
|
20 | 46 |
|
21 | 47 |
|
22 | 48 |
typedef struct { |
... | ... |
@@ -87,17 +113,20 @@ static accelscreen_data_t accel_screen = { |
87 | 113 |
void draw_accel_screen(accel_data_t *accel_data) |
88 | 114 |
{ |
89 | 115 |
hal_lcd_clear_display(); |
90 |
- SetFont(MetaWatch16); |
|
91 |
- WriteLcdString(2, 2, "X:"); |
|
92 |
- WriteLcdNumber(20, 2, accel_data->x); |
|
93 |
- WriteLcdString(2, 18, "Y:"); |
|
94 |
- WriteLcdNumber(20, 18, accel_data->y); |
|
95 |
- WriteLcdString(2, 34, "Z:"); |
|
96 |
- WriteLcdNumber(20, 34, accel_data->z); |
|
97 | 116 |
|
98 |
- WriteLcdString(2, 54, "Light:"); |
|
99 |
- WriteLcdNumber(40, 54, accel_data->z); |
|
117 |
+ oswald_write_string(0, 2, FONT_7x12b, "X:"); |
|
118 |
+ oswald_write_number(20, 2, FONT_7x12b, accel_data->x); |
|
119 |
+ oswald_write_string(0, 18, FONT_7x12b, "Y:"); |
|
120 |
+ oswald_write_number(20, 18, FONT_7x12b, accel_data->y); |
|
121 |
+#if 0 |
|
122 |
+ oswald_write_string(0, 34, FONT_8x12, "Z:"); |
|
123 |
+ oswald_write_number(20, 34, FONT_8x12, accel_data->z); |
|
100 | 124 |
|
125 |
+ oswald_write_string(0, 54, FONT_12x16, "Light:"); |
|
126 |
+ oswald_write_number(50, 54, FONT_12x16, accel_data->z); |
|
127 |
+ |
|
128 |
+ oswald_write_string(0, 70, FONT_12x20, "23:59"); |
|
129 |
+#endif |
|
101 | 130 |
hal_lcd_update_display(); |
102 | 131 |
} |
103 | 132 |
|
... | ... |
@@ -136,8 +165,7 @@ static datetime_setup_data_t dt_setup_screen = { |
136 | 165 |
void draw_datetime_setup_screen(datetime_setup_data_t *sdata) |
137 | 166 |
{ |
138 | 167 |
hal_lcd_clear_display(); |
139 |
-// SetFont(MetaWatch16); |
|
140 |
-// WriteLcdString(2, 2, "Set"); |
|
168 |
+ |
|
141 | 169 |
oswald_draw_bitmap(36, 0, timesetup_icon_width, timesetup_icon_height, timesetup_icon_bits); |
142 | 170 |
|
143 | 171 |
oswald_draw_bitmap(81, 6, upbutton_icon_width, upbutton_icon_height, upbutton_icon_bits); |
... | ... |
@@ -154,14 +182,7 @@ void draw_datetime_setup_screen(datetime_setup_data_t *sdata) |
154 | 182 |
WriteLcdCharacter(31, 30, (OswaldClk.minute / 10)); |
155 | 183 |
WriteLcdCharacter(43, 30, (OswaldClk.minute % 10)); |
156 | 184 |
} |
157 |
-/* |
|
158 |
- WriteLcdCharacter(55, 20, TIME_CHARACTER_COLON_INDEX); |
|
159 | 185 |
|
160 |
- if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) { |
|
161 |
- WriteLcdCharacter(60, 20, (OswaldClk.second / 10)); |
|
162 |
- WriteLcdCharacter(72, 20, (OswaldClk.second % 10)); |
|
163 |
- } |
|
164 |
-*/ |
|
165 | 186 |
SetFont(MetaWatch16); |
166 | 187 |
if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) { |
167 | 188 |
WriteLcdCharacter(59, 36, 0x30 + (OswaldClk.second / 10)); |
... | ... |
@@ -6,20 +6,48 @@ |
6 | 6 |
#include "Fonts.h" |
7 | 7 |
#include "LcdDisplay.h" |
8 | 8 |
#include "oswald_hal.h" |
9 |
+#include "oswald_graphics.h" |
|
9 | 10 |
|
10 | 11 |
#include "oswald_watch_faces.h" |
11 | 12 |
|
12 |
-#include "battery0_icon.xbm" |
|
13 |
-#include "battery25_icon.xbm" |
|
14 |
-#include "battery50_icon.xbm" |
|
15 |
-#include "battery75_icon.xbm" |
|
16 |
-#include "battery100_icon.xbm" |
|
17 |
-#include "charger_icon.xbm" |
|
18 |
-#include "bluetooth_icon.xbm" |
|
19 |
-#include "bluetooth_con_icon.xbm" |
|
13 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
14 |
+__attribute__((__far__)) |
|
15 |
+#endif |
|
16 |
+#include "bitmaps/battery0_icon.xbm" |
|
17 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
18 |
+__attribute__((__far__)) |
|
19 |
+#endif |
|
20 |
+#include "bitmaps/battery25_icon.xbm" |
|
21 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
22 |
+__attribute__((__far__)) |
|
23 |
+#endif |
|
24 |
+#include "bitmaps/battery50_icon.xbm" |
|
25 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
26 |
+__attribute__((__far__)) |
|
27 |
+#endif |
|
28 |
+#include "bitmaps/battery75_icon.xbm" |
|
29 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
30 |
+__attribute__((__far__)) |
|
31 |
+#endif |
|
32 |
+#include "bitmaps/battery100_icon.xbm" |
|
33 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
34 |
+__attribute__((__far__)) |
|
35 |
+#endif |
|
36 |
+#include "bitmaps/charger_icon.xbm" |
|
37 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
38 |
+__attribute__((__far__)) |
|
39 |
+#endif |
|
40 |
+#include "bitmaps/bluetooth_icon.xbm" |
|
41 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
42 |
+__attribute__((__far__)) |
|
43 |
+#endif |
|
44 |
+#include "bitmaps/bluetooth_con_icon.xbm" |
|
20 | 45 |
|
21 | 46 |
|
22 | 47 |
/* sine table, per degree, factor 100 */ |
48 |
+#if defined(__GNUC__) && (__MSP430X__ > 0) |
|
49 |
+__attribute__((__far__)) |
|
50 |
+#endif |
|
23 | 51 |
int16_t sintab[]={ |
24 | 52 |
0, 2, 3, 5, 7, 9, 10, 12, 14, 16, |
25 | 53 |
17, 19, 21, 22, 24, 26, 28, 29, 31, 33, |
... | ... |
@@ -92,15 +120,15 @@ void draw_status_icons(void) |
92 | 120 |
} |
93 | 121 |
} else { |
94 | 122 |
if (OswaldPowerState.percent > 75) |
95 |
- oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
123 |
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
96 | 124 |
else if (OswaldPowerState.percent > 50) |
97 |
- oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits); |
|
125 |
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery75_icon_width, battery75_icon_height, battery75_icon_bits); |
|
98 | 126 |
else if (OswaldPowerState.percent > 25) |
99 |
- oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits); |
|
127 |
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery50_icon_width, battery50_icon_height, battery50_icon_bits); |
|
100 | 128 |
else if (OswaldPowerState.percent > 5) |
101 |
- oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits); |
|
129 |
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery25_icon_width, battery25_icon_height, battery25_icon_bits); |
|
102 | 130 |
else |
103 |
- oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits); |
|
131 |
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery0_icon_width, battery0_icon_height, battery0_icon_bits); |
|
104 | 132 |
} |
105 | 133 |
|
106 | 134 |
if (hal_bluetooth_get_state() == BLUETOOTH_ON) |
... | ... |
@@ -133,9 +161,13 @@ void DrawLcdAnaClock(boolean show_seconds) |
133 | 161 |
|
134 | 162 |
hal_lcd_clear_display(); |
135 | 163 |
|
136 |
- SetFont(MetaWatch16); |
|
137 | 164 |
snprintf(tstr, 16, "%02d", OswaldClk.day); |
165 |
+#if 0 |
|
166 |
+ SetFont(MetaWatch16); |
|
138 | 167 |
WriteLcdString(70, 40, tstr); |
168 |
+#else |
|
169 |
+ oswald_write_string(70, 43, FONT_7x12b, tstr); |
|
170 |
+#endif |
|
139 | 171 |
|
140 | 172 |
// Marker |
141 | 173 |
// plot(R*cos(360° * i/N), R*sin(360° * i/N)) |
... | ... |
@@ -144,7 +176,7 @@ void DrawLcdAnaClock(boolean show_seconds) |
144 | 176 |
y = 47 + ((43 * f_sin((360 / 12) * i)) / 100); |
145 | 177 |
x2 = 47 + ((47 * f_cos((360 / 12) * i)) / 100); |
146 | 178 |
y2 = 47 + ((47 * f_sin((360 / 12) * i)) / 100); |
147 |
- DrawLcdLineBresenhamWW(x, y, x2, y2, 2); |
|
179 |
+ oswald_draw_line_ww(x, y, x2, y2, 2); |
|
148 | 180 |
// g_printerr("br %d,%d %d,%d\n", x,y,x2,y2); |
149 | 181 |
}; |
150 | 182 |
|
... | ... |
@@ -153,14 +185,14 @@ void DrawLcdAnaClock(boolean show_seconds) |
153 | 185 |
x = tmp; |
154 | 186 |
tmp = 47 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100); |
155 | 187 |
y = tmp; |
156 |
- DrawLcdLineBresenhamWW(47, 47, x, y, 2); |
|
188 |
+ oswald_draw_line_ww(47, 47, x, y, 2); |
|
157 | 189 |
|
158 | 190 |
// Minute |
159 | 191 |
tmp = 47 + ((40 * f_cos((360 / 60) * minute)) / 100); |
160 | 192 |
x = tmp; |
161 | 193 |
tmp = 47 + ((40 * f_sin((360 / 60) * minute)) / 100); |
162 | 194 |
y = tmp; |
163 |
- DrawLcdLineBresenhamWW(47, 47, x, y, 2); |
|
195 |
+ oswald_draw_line_ww(47, 47, x, y, 2); |
|
164 | 196 |
|
165 | 197 |
if (show_seconds) { |
166 | 198 |
// Seconds |
... | ... |
@@ -168,7 +200,7 @@ void DrawLcdAnaClock(boolean show_seconds) |
168 | 200 |
x = tmp; |
169 | 201 |
tmp = 47 + ((40 * f_sin((360 / 60) * seconds)) / 100); |
170 | 202 |
y = tmp; |
171 |
- DrawLcdLineBresenham(47, 47, x, y); |
|
203 |
+ oswald_draw_line(47, 47, x, y); |
|
172 | 204 |
}; |
173 | 205 |
|
174 | 206 |
draw_status_icons(); |
... | ... |
@@ -183,6 +215,7 @@ void DrawLcdDigitalClock(boolean show_seconds) |
183 | 215 |
char tstr[16]; |
184 | 216 |
int i; |
185 | 217 |
|
218 |
+#if 0 |
|
186 | 219 |
SetFont(MetaWatchTime); |
187 | 220 |
|
188 | 221 |
hal_lcd_clear_display(); |
... | ... |
@@ -226,27 +259,7 @@ void DrawLcdDigitalClock(boolean show_seconds) |
226 | 259 |
snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year); |
227 | 260 |
WriteLcdString(3, 25, tstr); |
228 | 261 |
|
229 |
-#if 0 |
|
230 |
- if (OswaldPowerState.source) |
|
231 |
- oswald_draw_bitmap(81, 4, charger_icon_width, charger_icon_height, charger_icon_bits); |
|
232 |
- |
|
233 |
- if (OswaldPowerState.percent > 75) |
|
234 |
- oswald_draw_bitmap(81, 4, battery100_icon_width, battery100_icon_height, battery100_icon_bits); |
|
235 |
- else if (OswaldPowerState.percent > 50) |
|
236 |
- oswald_draw_bitmap(81, 4, battery75_icon_width, battery75_icon_height, battery75_icon_bits); |
|
237 |
- else if (OswaldPowerState.percent > 25) |
|
238 |
- oswald_draw_bitmap(81, 4, battery50_icon_width, battery50_icon_height, battery50_icon_bits); |
|
239 |
- else if (OswaldPowerState.percent > 5) |
|
240 |
- oswald_draw_bitmap(81, 4, battery25_icon_width, battery25_icon_height, battery25_icon_bits); |
|
241 |
- else |
|
242 |
- oswald_draw_bitmap(81, 4, battery0_icon_width, battery0_icon_height, battery0_icon_bits); |
|
243 |
- |
|
244 |
- |
|
245 |
- if (hal_bluetooth_get_state() >= BLUETOOTH_ON) |
|
246 |
- oswald_draw_bitmap(81, 4, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits); |
|
247 |
-#else |
|
248 | 262 |
draw_status_icons(); |
249 |
-#endif |
|
250 | 263 |
|
251 | 264 |
gRow = 0; |
252 | 265 |
gColumn = 45; |
... | ... |
@@ -284,6 +297,34 @@ void DrawLcdDigitalClock(boolean show_seconds) |
284 | 297 |
break; |
285 | 298 |
}; |
286 | 299 |
}; |
300 |
+#endif |
|
301 |
+#else |
|
302 |
+ hal_lcd_clear_display(); |
|
303 |
+ snprintf(tstr, 16, "%02d", OswaldClk.hour); |
|
304 |
+ oswald_write_string(0, 0, FONT_16x26, tstr); |
|
305 |
+ oswald_write_character(26, 0, FONT_16x26, ':'); |
|
306 |
+ snprintf(tstr, 16, "%02d", OswaldClk.minute); |
|
307 |
+ oswald_write_string(36, 0, FONT_16x26, tstr); |
|
308 |
+ |
|
309 |
+ if (OswaldClk.day_first) |
|
310 |
+ snprintf(tstr, 16, "%d.%d.%d", OswaldClk.day, OswaldClk.month, OswaldClk.year); |
|
311 |
+ else |
|
312 |
+ snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year); |
|
313 |
+ oswald_write_string(0, 25, FONT_7x12b, tstr); |
|
314 |
+ |
|
315 |
+ gRow = 0; |
|
316 |
+ gColumn = 45; |
|
317 |
+ for (i=0; i<strlen(MainMessage); i++) { |
|
318 |
+ gRow += oswald_write_character(gRow, gColumn, FONT_6x8, MainMessage[i]); |
|
319 |
+ if (gRow > 90) { |
|
320 |
+ gRow = 0; |
|
321 |
+ gColumn += 9; |
|
322 |
+ } |
|
323 |
+ if (gColumn > 95) |
|
324 |
+ i = 255; |
|
325 |
+ } |
|
326 |
+ |
|
327 |
+ draw_status_icons(); |
|
287 | 328 |
#endif |
288 | 329 |
hal_lcd_update_display(); |
289 | 330 |
} |