Browse code

Bluetooth handling, screen reworks for icons

Nils Faerber authored on 21/04/2013 23:10:13
Showing 31 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define Bluetooth_icon_width 24
2
+#define Bluetooth_icon_height 24
3
+static unsigned char Bluetooth_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x6c, 0x00,
5
+  0x10, 0xcc, 0x00, 0x30, 0x8c, 0x01, 0x60, 0x0c, 0x03, 0xc0, 0x0c, 0x06,
6
+  0x80, 0x0d, 0x03, 0x00, 0x8f, 0x01, 0x00, 0xce, 0x00, 0x00, 0x7c, 0x00,
7
+  0x00, 0x3c, 0x00, 0x00, 0x6e, 0x00, 0x00, 0xcf, 0x00, 0x80, 0x8d, 0x01,
8
+  0xc0, 0x0c, 0x03, 0x60, 0x0c, 0x06, 0x30, 0x0c, 0x03, 0x10, 0x8c, 0x01,
9
+  0x00, 0xcc, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x1c, 0x00,
10
+  };
... ...
@@ -5,6 +5,21 @@
5 5
 
6 6
 #include "LcdDisplay.h"
7 7
 
8
+void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
9
+{
10
+	uint8_t x, y;
11
+	uint8_t *cb;
12
+
13
+	// we only draw set pixel, unset pixel remain as they are
14
+	for (y=0; y<height; y++) {
15
+		for (x=0; x<width; x++) {
16
+			cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8));
17
+			if (*cb & (1 << (x % 8)))
18
+				hal_lcd_set_pixel(xstart + x, ystart + y, TRUE);
19
+		}
20
+	}
21
+}
22
+
8 23
 void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
9 24
 {
10 25
 	int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
... ...
@@ -3,6 +3,7 @@
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);
6 7
 void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend);
7 8
 void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness);
8 9
 u8t WriteLcdCharacter(u8t x, u8t y, u8t Character);
9 10
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+#define Oswald_width 80
2
+#define Oswald_height 96
3
+static const char Oswald_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
5
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
6
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 
7
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 
8
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 
9
+  0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
10
+  0x00, 0x00, 0xF8, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
11
+  0xF0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 
12
+  0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 
13
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 
14
+  0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
15
+  0x00, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
16
+  0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x01, 0x00, 0x00, 0xF8, 
17
+  0x3F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0x00, 0xF0, 0x7F, 0x00, 
18
+  0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, 
19
+  0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 
20
+  0xFF, 0x0F, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x3F, 
21
+  0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, 
22
+  0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x00, 0x80, 0x7F, 0x00, 
23
+  0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x03, 0x80, 0x3F, 0x00, 0x00, 0x00, 
24
+  0xE0, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x59, 
25
+  0xE9, 0xFF, 0x0F, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 
26
+  0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 
27
+  0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x83, 0x0F, 0x00, 
28
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x01, 0x0F, 0x00, 0x00, 0x00, 
29
+  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
30
+  0x00, 0x0C, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 
31
+  0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 
32
+  0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0x00, 
33
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x18, 0x00, 0x00, 0x00, 
34
+  0x00, 0x00, 0x00, 0x83, 0x07, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 
35
+  0x00, 0x83, 0x07, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, 
36
+  0x0F, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, 
37
+  0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC3, 0x07, 0x7C, 0x38, 0x00, 
38
+  0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, 
39
+  0x00, 0x00, 0x80, 0x87, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 
40
+  0x80, 0xCF, 0x07, 0x7C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCF, 
41
+  0x87, 0x7C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 
42
+  0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xF8, 0x03, 0x16, 0x00, 
43
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xF8, 0x03, 0x13, 0x00, 0x00, 0x00, 
44
+  0x00, 0x00, 0x00, 0x1A, 0xF0, 0x81, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 
45
+  0x00, 0x34, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 
46
+  0x01, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xF7, 0xCF, 
47
+  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x58, 0xFC, 0x1E, 0x00, 
48
+  0x00, 0x00, 0x00, 0x00, 0xE0, 0x9F, 0xFF, 0x67, 0xFE, 0x00, 0x00, 0x00, 
49
+  0x00, 0x00, 0xF8, 0xBF, 0xF0, 0x63, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 
50
+  0xFC, 0xFF, 0xE6, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xDF, 0xFF, 
51
+  0xDF, 0xA2, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x80, 0xE1, 0xEF, 0x00, 0xF1, 
52
+  0xB6, 0x63, 0x00, 0x00, 0x00, 0x40, 0x00, 0x74, 0x00, 0xF0, 0x13, 0x80, 
53
+  0x00, 0x00, 0x00, 0x70, 0x00, 0x96, 0x00, 0x9C, 0x21, 0x00, 0x01, 0x00, 
54
+  0x00, 0x48, 0xC0, 0x89, 0x03, 0x27, 0xC1, 0x00, 0x01, 0x00, 0x00, 0x64, 
55
+  0xD1, 0xC8, 0xFE, 0x66, 0x82, 0x11, 0x01, 0x00, 0x00, 0x3C, 0x33, 0x44, 
56
+  0x06, 0x3C, 0x02, 0x91, 0x03, 0x00, 0x00, 0x10, 0x11, 0x84, 0x03, 0x00, 
57
+  0x02, 0xB3, 0x04, 0x00, 0x00, 0xE0, 0x09, 0x04, 0x01, 0x00, 0x02, 0xB1, 
58
+  0x04, 0x00, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00, 0x02, 0x91, 0x05, 0x00, 
59
+  0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x07, 0x9E, 0x07, 0x00, 0x00, 0x00, 
60
+  0x00, 0x0C, 0x00, 0x00, 0x04, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 
61
+  0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 
62
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xA4, 0xC7, 0x07, 0x00, 
63
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x78, 0xF9, 0x0F, 0x00, 0x00, 0x00, 
64
+  0x00, 0x00, 0x00, 0xFE, 0x0F, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
65
+  0x00, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 
66
+  0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, 
67
+  0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, 0x1F, 0x00, 
68
+  0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 
69
+  0x00, 0x00, 0x00, 0xFF, 0x01, 0xFC, 0x2F, 0x10, 0x00, 0x00, 0x00, 0x00, 
70
+  0x80, 0xFF, 0x05, 0xF2, 0xF3, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xD4, 0xFC, 
71
+  0x04, 0x02, 0x3C, 0x00, 0x03, 0x00, 0x00, 0x80, 0xEF, 0x01, 0x0C, 0x8E, 
72
+  0x07, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x00, 0x07, 0x1E, 0xF9, 0x03, 0x00, 
73
+  0x04, 0x00, 0x00, 0x20, 0x00, 0xFC, 0xB1, 0x81, 0x00, 0x00, 0x06, 0x00, 
74
+  0x00, 0x10, 0x00, 0x30, 0xE0, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x10, 
75
+  0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x10, 0x00, 0x00, 
76
+  0xE0, 0x3C, 0x00, 0x80, 0x05, 0x00, 0x00, 0x38, 0x00, 0x00, 0xF8, 0x83, 
77
+  0x07, 0xE0, 0x02, 0x00, 0x00, 0x78, 0x00, 0x00, 0x6F, 0x7E, 0xFE, 0x3E, 
78
+  0x03, 0x00, 0x00, 0xD0, 0x01, 0x30, 0x30, 0xC0, 0x81, 0xC3, 0x01, 0x00, 
79
+  0x00, 0x20, 0xFF, 0x4F, 0x0F, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x00, 0xC0, 
80
+  0x09, 0xFA, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x07, 
81
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
82
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
83
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
84
+  };
0 85
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define alarm_icon_width 24
2
+#define alarm_icon_height 24
3
+static unsigned char alarm_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x38,
5
+  0x1e, 0xff, 0x78, 0xce, 0xff, 0x73, 0xe6, 0x00, 0x67, 0x70, 0x18, 0x0e,
6
+  0x38, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30,
7
+  0x0c, 0x18, 0x30, 0x0c, 0xf8, 0x31, 0x0c, 0xf8, 0x31, 0x0c, 0x00, 0x30,
8
+  0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x18, 0x38, 0x00, 0x1c,
9
+  0x70, 0x00, 0x0e, 0xe0, 0x00, 0x07, 0xc0, 0xff, 0x03, 0x00, 0xff, 0x00,
10
+  };
0 11
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define battery0_icon_width 15
2
+#define battery0_icon_height 20
3
+static unsigned char battery0_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22,
5
+  0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22,
6
+  0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x3e,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define battery100_icon_width 15
2
+#define battery100_icon_height 20
3
+static unsigned char battery100_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
5
+  0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
6
+  0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define battery25_icon_width 15
2
+#define battery25_icon_height 20
3
+static unsigned char battery25_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22,
5
+  0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22,
6
+  0x00, 0x22, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define battery50_icon_width 15
2
+#define battery50_icon_height 20
3
+static unsigned char battery50_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22,
5
+  0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
6
+  0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define battery75_icon_width 15
2
+#define battery75_icon_height 20
3
+static unsigned char battery75_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x22, 0x00, 0x22, 0x00, 0x3e,
5
+  0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
6
+  0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define bluetooth_icon_width 15
2
+#define bluetooth_icon_height 20
3
+static unsigned char bluetooth_icon_bits[] = {
4
+  0x10, 0x00, 0x30, 0x00, 0x54, 0x00, 0x38, 0x00, 0x54, 0x00, 0x30, 0x00,
5
+  0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define charger_icon_width 15
2
+#define charger_icon_height 20
3
+static unsigned char charger_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5
+  0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x7c, 0x00,
6
+  0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
7
+  0x10, 0x00, 0x10, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define downbutton_icon_width 15
2
+#define downbutton_icon_height 20
3
+static unsigned char downbutton_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
5
+  0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x80, 0x7f, 0x00, 0x3f,
6
+  0x00, 0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define lapsebutton_icon_width 15
2
+#define lapsebutton_icon_height 20
3
+static unsigned char lapsebutton_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61,
5
+  0x00, 0x63, 0x00, 0x67, 0xc0, 0x6f, 0xc0, 0x6f, 0x00, 0x67, 0x00, 0x63,
6
+  0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
... ...
@@ -35,7 +35,6 @@ void hal_lcd_set_pixel(gint x, gint y, gboolean state)
35 35
 	gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy+1);
36 36
 	gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix+1, iy+1);
37 37
 
38
-//	gtk_widget_queue_draw(ui_g->darea);
39 38
 }
40 39
 
41 40
 /* updates the actual LCD so that drawing becomes visible */
... ...
@@ -56,6 +55,45 @@ void hal_lcd_clear_display(void)
56 55
 	gtk_widget_queue_draw(ui_g->darea);
57 56
 }
58 57
 
58
+static bluetooth_state bt_state = BLUETOOTH_OFF;
59
+static boolean bt_visible = FALSE;
60
+
61
+bluetooth_state hal_bluetooth_set_state(bluetooth_state state)
62
+{
63
+	bt_state = state;
64
+	if (bt_state == BLUETOOTH_OFF)
65
+		bt_visible = FALSE;
66
+
67
+	return bt_state;
68
+}
69
+
70
+bluetooth_state hal_bluetooth_get_state(void)
71
+{
72
+	return bt_state;
73
+}
74
+
75
+uint8_t *hal_bluetooth_get_local_bdaddr(void)
76
+{
77
+	static uint8_t local_bdaddr[6] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
78
+
79
+	return local_bdaddr;
80
+}
81
+
82
+void hal_bluetooth_set_visible(boolean visible)
83
+{
84
+	bt_visible = visible;
85
+}
86
+
87
+boolean hal_bluetooth_get_visible(void)
88
+{
89
+	return bt_visible;
90
+}
91
+
92
+void hal_bluetooth_send_data(const void *mdat, uint16_t mlen)
93
+{
94
+	g_printerr("write comm %d\n", mlen);
95
+}
96
+
59 97
 static gint
60 98
 configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
61 99
 {
... ...
@@ -1,5 +1,7 @@
1 1
 #ifndef _OSWALD_H
2 2
 #define _OSWALD_H
3
+#include <stdio.h>
4
+#include <string.h>
3 5
 #include <stdint.h>
4 6
 
5 7
 //#define DEBUG 1
... ...
@@ -55,6 +57,7 @@ typedef enum {
55 57
 	IDLE_SCREEN = 0,
56 58
 	ALARM_SETUP_SCREEN,
57 59
 	STOP_WATCH_SCREEN,
60
+	BLUETOOTH_SCREEN,
58 61
 	ACCEL_DISPLAY_SCREEN,
59 62
 	MENU_TEST_SCREEN,
60 63
 //	APPLICATION_SCREEN,
... ...
@@ -5,21 +5,26 @@
5 5
 #include "oswald_graphics.h"
6 6
 
7 7
 
8
+#if 0
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)
9 10
 {
10 11
 	uint8_t x, y;
12
+	uint8_t *cb;
11 13
 
12 14
 	// we only draw set pixel, unset pixel remain as they are
13 15
 	for (y=0; y<height; y++) {
14 16
 		for (x=0; x<width; x++) {
15
-			hal_lcd_set_pixel(x, y, TRUE);
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);
16 20
 		}
17 21
 	}
18 22
 }
23
+#endif
19 24
 
20 25
 void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend)
21 26
 {
22
-	int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
27
+	uint8_t x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
23 28
  
24 29
 	dx = xend - xstart;
25 30
 	dy = yend - ystart;
... ...
@@ -8,6 +8,8 @@
8 8
 #include "oswald_graphics.h"
9 9
 
10 10
 
11
+void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp);
12
+
11 13
 void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend);
12 14
 
13 15
 void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness);
... ...
@@ -26,5 +26,11 @@ void hal_get_power_state(power_state *pwr);
26 26
 void hal_vibration_set_state(boolean state);
27 27
 boolean hal_vibration_get_state(void);
28 28
 
29
+bluetooth_state hal_bluetooth_set_state(bluetooth_state state);
30
+bluetooth_state hal_bluetooth_get_state(void);
31
+uint8_t *hal_bluetooth_get_local_bdaddr(void);
32
+void hal_bluetooth_set_visible(boolean visible);
33
+boolean hal_bluetooth_get_visible(void);
34
+void hal_bluetooth_send_data(const void *mdat, uint16_t mlen);
29 35
 #endif
30 36
 
... ...
@@ -18,6 +18,8 @@ watch_state OswaldState;
18 18
 watch_screen OswaldScreens[SCREENS_END];
19 19
 power_state OswaldPowerState;
20 20
 u8t backlight_safety_off = 0;
21
+char MainMessage[148];
22
+
21 23
 
22 24
 void oswald_change_to_screen(screen_number screen_id)
23 25
 {
... ...
@@ -152,6 +154,26 @@ void oswald_handle_ambientlight_event(u8t light_level)
152 154
 		OswaldState.screen->event_func(EVENT_AMBIENTLIGHT_UPDATE, &light_level);
153 155
 }
154 156
 
157
+void oswald_handle_comm_input(uint16_t mlen, const void *mdat)
158
+{
159
+	char *icmd = (char *) mdat;
160
+
161
+	if (icmd[0] == '$') {
162
+		if (strncmp(icmd, "$GRT", 4) == 0) { // get current RTC
163
+			char rtime[16];
164
+			snprintf(rtime, 10, "%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second);
165
+			hal_bluetooth_send_data(rtime, strlen(rtime));
166
+		} else if (strncmp(icmd, "$MSG", 4) == 0) { // message on main screen
167
+			char *msg = (icmd+4);
168
+			mlen -= 4;
169
+			memset(MainMessage, 0, 148);
170
+			strncpy(MainMessage, msg, (mlen > 147) ? 147 : mlen);
171
+		} else if (strncmp(icmd, "$MCL", 4) == 0) { // clear message
172
+			memset(MainMessage, 0, 148);
173
+		}
174
+	}
175
+}
176
+
155 177
 void oswald_init(void)
156 178
 {
157 179
 	OswaldScreens[IDLE_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_ONE_SEC_TIMER;
... ...
@@ -172,6 +194,9 @@ void oswald_init(void)
172 194
 	OswaldScreens[STOP_WATCH_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_CS_TIMER;
173 195
 	OswaldScreens[STOP_WATCH_SCREEN].event_func = stop_watch_handle_events;
174 196
 
197
+	OswaldScreens[BLUETOOTH_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_HALF_SEC_TIMER;
198
+	OswaldScreens[BLUETOOTH_SCREEN].event_func = bluetooth_screen_events;
199
+
175 200
 	OswaldScreens[ALARM_SCREEN].event_mask = EVENT_USER_BUTTONS | EVENT_HALF_SEC_TIMER;
176 201
 	OswaldScreens[ALARM_SCREEN].event_func = alarm_handle_events;
177 202
 
... ...
@@ -8,6 +8,7 @@ extern alarm_clk OswaldAlarm;
8 8
 extern power_state OswaldPowerState;
9 9
 extern watch_state OswaldState;
10 10
 extern watch_screen OswaldScreens[];
11
+extern char MainMessage[];
11 12
 
12 13
 /* gets triggered by OS timer function */
13 14
 void oswald_one_second_tick();
... ...
@@ -24,5 +25,5 @@ void oswald_one_second_tick(void);
24 25
 void oswald_halfsecond_tick(void);
25 26
 void oswald_centisecond_tick(void);
26 27
 void oswald_init(void);
27
-
28
+void oswald_handle_comm_input(uint16_t mlen, const void *mdat);
28 29
 #endif
... ...
@@ -9,6 +9,15 @@
9 9
 
10 10
 #include "oswald_screens.h"
11 11
 
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"
20
+
12 21
 
13 22
 typedef struct {
14 23
 	void (*screendraw_func)(boolean show_seconds);
... ...
@@ -85,6 +94,10 @@ void draw_accel_screen(accel_data_t *accel_data)
85 94
 	WriteLcdNumber(20, 18, accel_data->y);
86 95
 	WriteLcdString(2, 34, "Z:");
87 96
 	WriteLcdNumber(20, 34, accel_data->z);
97
+
98
+	WriteLcdString(2, 54, "Light:");
99
+	WriteLcdNumber(40, 54, accel_data->z);
100
+
88 101
 	hal_lcd_update_display();
89 102
 }
90 103
 
... ...
@@ -123,57 +136,67 @@ static datetime_setup_data_t dt_setup_screen = {
123 136
 void draw_datetime_setup_screen(datetime_setup_data_t *sdata)
124 137
 {
125 138
 	hal_lcd_clear_display();
126
-	SetFont(MetaWatch16);
127
-	WriteLcdString(2, 2, "Set");
139
+//	SetFont(MetaWatch16);
140
+//	WriteLcdString(2, 2, "Set");
141
+	oswald_draw_bitmap(36, 0, timesetup_icon_width, timesetup_icon_height, timesetup_icon_bits);
142
+
143
+	oswald_draw_bitmap(81, 6, upbutton_icon_width, upbutton_icon_height, upbutton_icon_bits);
144
+	oswald_draw_bitmap(81, 38, downbutton_icon_width, downbutton_icon_height, downbutton_icon_bits);
128 145
 
129 146
 	SetFont(MetaWatchTime);
130 147
 	if ((sdata->pos == 0 && sdata->on) || sdata->pos != 0) {
131
-		WriteLcdCharacter(2, 20, (OswaldClk.hour / 10));
132
-		WriteLcdCharacter(14, 20, (OswaldClk.hour % 10));
148
+		WriteLcdCharacter(2, 30, (OswaldClk.hour / 10));
149
+		WriteLcdCharacter(14, 30, (OswaldClk.hour % 10));
133 150
 	}
134
-	WriteLcdCharacter(26, 20, TIME_CHARACTER_COLON_INDEX);
151
+	WriteLcdCharacter(26, 30, TIME_CHARACTER_COLON_INDEX);
135 152
 
136 153
 	if ((sdata->pos == 1 && sdata->on) || sdata->pos != 1) {
137
-		WriteLcdCharacter(31, 20, (OswaldClk.minute / 10));
138
-		WriteLcdCharacter(43, 20, (OswaldClk.minute % 10));
154
+		WriteLcdCharacter(31, 30, (OswaldClk.minute / 10));
155
+		WriteLcdCharacter(43, 30, (OswaldClk.minute % 10));
139 156
 	}
140
-
157
+/*
141 158
 	WriteLcdCharacter(55, 20, TIME_CHARACTER_COLON_INDEX);
142 159
 
143 160
 	if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) {
144 161
 		WriteLcdCharacter(60, 20, (OswaldClk.second / 10));
145 162
 		WriteLcdCharacter(72, 20, (OswaldClk.second % 10));
146 163
 	}
147
-
164
+*/
148 165
 	SetFont(MetaWatch16);
166
+	if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) {
167
+		WriteLcdCharacter(59, 36, 0x30 + (OswaldClk.second / 10));
168
+		WriteLcdCharacter(66, 36, 0x30 + (OswaldClk.second % 10));
169
+	}
170
+
171
+
149 172
 	if ((sdata->pos == 3 && sdata->on) || sdata->pos != 3) {
150
-		WriteLcdNumber(2, 45, OswaldClk.day);
173
+		WriteLcdNumber(2, 55, OswaldClk.day);
151 174
 	}
152
-	WriteLcdString(18, 45, ".");
175
+	WriteLcdString(18, 55, ".");
153 176
 	if ((sdata->pos == 4 && sdata->on) || sdata->pos != 4) {
154
-		WriteLcdNumber(22, 45, OswaldClk.month);
177
+		WriteLcdNumber(22, 55, OswaldClk.month);
155 178
 	}
156
-	WriteLcdString(38, 45, ".");
179
+	WriteLcdString(38, 55, ".");
157 180
 	if ((sdata->pos == 5 && sdata->on) || sdata->pos != 5) {
158
-		WriteLcdNumber(42, 45, OswaldClk.year);
181
+		WriteLcdNumber(42, 55, OswaldClk.year);
159 182
 	}
160 183
 
161 184
 	SetFont(MetaWatch7);
162 185
 	if ((sdata->pos == 6 && sdata->on) || sdata->pos != 6) {
163 186
 		if (OswaldClk.clk24hr)
164
-			WriteLcdString(2, 66, "x");
187
+			WriteLcdString(2, 76, "x");
165 188
 		else
166
-			WriteLcdString(2, 66, "_");
189
+			WriteLcdString(2, 76, "_");
167 190
 	}
168
-	WriteLcdString(15, 66, "24hr");
191
+	WriteLcdString(15, 76, "24hr");
169 192
 
170 193
 	if ((sdata->pos == 7 && sdata->on) || sdata->pos != 7) {
171 194
 		if (OswaldClk.day_first)
172
-			WriteLcdString(2, 79, "x");
195
+			WriteLcdString(2, 89, "x");
173 196
 		else
174
-			WriteLcdString(2, 79, "_");
197
+			WriteLcdString(2, 89, "_");
175 198
 	}
176
-	WriteLcdString(15, 79, "dd.mm.  mm/dd");
199
+	WriteLcdString(15, 89, "dd.mm.  mm/dd");
177 200
 
178 201
 	hal_lcd_update_display();
179 202
 }
... ...
@@ -290,6 +313,11 @@ void datetime_setup_events(u16t event, void *data)
290 313
 	};
291 314
 }
292 315
 
316
+
317
+/*
318
+ * Alarm setup
319
+ */
320
+
293 321
 typedef struct {
294 322
 	u8t pos;
295 323
 	boolean on;
... ...
@@ -303,63 +331,47 @@ void draw_alarm_setup_screen(alarm_setup_data_t *sdata)
303 331
 {
304 332
 	hal_lcd_clear_display();
305 333
 
306
-	SetFont(MetaWatch16);
307
-	WriteLcdString(2, 2, "Alarm");
334
+	oswald_draw_bitmap(36, 0, alarm_icon_width, alarm_icon_height, alarm_icon_bits);
335
+
336
+	oswald_draw_bitmap(81, 6, upbutton_icon_width, upbutton_icon_height, upbutton_icon_bits);
337
+	oswald_draw_bitmap(81, 38, downbutton_icon_width, downbutton_icon_height, downbutton_icon_bits);
308 338
 
309 339
 	SetFont(MetaWatchTime);
310 340
 	if ((sdata->pos == 0 && sdata->on) || sdata->pos != 0) {
311
-		WriteLcdCharacter(2, 20, (OswaldAlarm.hour / 10));
312
-		WriteLcdCharacter(14, 20, (OswaldAlarm.hour % 10));
341
+		WriteLcdCharacter(22, 30, (OswaldAlarm.hour / 10));
342
+		WriteLcdCharacter(34, 30, (OswaldAlarm.hour % 10));
313 343
 	}
314
-	WriteLcdCharacter(26, 20, TIME_CHARACTER_COLON_INDEX);
344
+	WriteLcdCharacter(46, 30, TIME_CHARACTER_COLON_INDEX);
315 345
 
316 346
 	if ((sdata->pos == 1 && sdata->on) || sdata->pos != 1) {
317
-		WriteLcdCharacter(31, 20, (OswaldAlarm.minute / 10));
318
-		WriteLcdCharacter(43, 20, (OswaldAlarm.minute % 10));
347
+		WriteLcdCharacter(51, 30, (OswaldAlarm.minute / 10));
348
+		WriteLcdCharacter(63, 30, (OswaldAlarm.minute % 10));
319 349
 	}
320 350
 
321 351
 	SetFont(MetaWatchMonospaced10);
322
-	WriteLcdCharacter(3, 45, 'S');
323
-	WriteLcdCharacter(15, 45, 'M');
324
-	WriteLcdCharacter(27, 45, 'T');
325
-	WriteLcdCharacter(39, 45, 'W');
326
-	WriteLcdCharacter(51, 45, 'T');
327
-	WriteLcdCharacter(63, 45, 'F');
328
-	WriteLcdCharacter(75, 45, 'S');
352
+	WriteLcdCharacter(3, 55, 'S');
353
+	WriteLcdCharacter(15, 55, 'M');
354
+	WriteLcdCharacter(27, 55, 'T');
355
+	WriteLcdCharacter(39, 55, 'W');
356
+	WriteLcdCharacter(51, 55, 'T');
357
+	WriteLcdCharacter(63, 55, 'F');
358
+	WriteLcdCharacter(75, 55, 'S');
329 359
 
330 360
 	if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2)
331
-		WriteLcdCharacter(3, 55, (OswaldAlarm.wday & WDAY_SUNDAY) ? 'x' : '_');
361
+		WriteLcdCharacter(3, 65, (OswaldAlarm.wday & WDAY_SUNDAY) ? 'x' : '_');
332 362
 	if ((sdata->pos == 3 && sdata->on) || sdata->pos != 3)
333
-		WriteLcdCharacter(15, 55, (OswaldAlarm.wday & WDAY_MONDAY) ? 'x' : '_');
363
+		WriteLcdCharacter(15, 65, (OswaldAlarm.wday & WDAY_MONDAY) ? 'x' : '_');
334 364
 	if ((sdata->pos == 4 && sdata->on) || sdata->pos != 4)
335
-		WriteLcdCharacter(27, 55, (OswaldAlarm.wday & WDAY_TUESDAY) ? 'x' : '_');
365
+		WriteLcdCharacter(27, 65, (OswaldAlarm.wday & WDAY_TUESDAY) ? 'x' : '_');
336 366
 	if ((sdata->pos == 5 && sdata->on) || sdata->pos != 5)
337
-		WriteLcdCharacter(39, 55, (OswaldAlarm.wday & WDAY_WEDNESDAY) ? 'x' : '_');
367
+		WriteLcdCharacter(39, 65, (OswaldAlarm.wday & WDAY_WEDNESDAY) ? 'x' : '_');
338 368
 	if ((sdata->pos == 6 && sdata->on) || sdata->pos != 6)
339
-		WriteLcdCharacter(51, 55, (OswaldAlarm.wday & WDAY_THURSDAY) ? 'x' : '_');
369
+		WriteLcdCharacter(51, 65, (OswaldAlarm.wday & WDAY_THURSDAY) ? 'x' : '_');
340 370
 	if ((sdata->pos == 7 && sdata->on) || sdata->pos != 7)
341
-		WriteLcdCharacter(63, 55, (OswaldAlarm.wday & WDAY_FRIDAY) ? 'x' : '_');
371
+		WriteLcdCharacter(63, 65, (OswaldAlarm.wday & WDAY_FRIDAY) ? 'x' : '_');
342 372
 	if ((sdata->pos == 8 && sdata->on) || sdata->pos != 8)
343
-		WriteLcdCharacter(75, 55, (OswaldAlarm.wday & WDAY_SATURDAY) ? 'x' : '_');
373
+		WriteLcdCharacter(75, 65, (OswaldAlarm.wday & WDAY_SATURDAY) ? 'x' : '_');
344 374
 
345
-#if 0
346
-	SetFont(MetaWatch7);
347
-	if ((sdata->pos == 6 && sdata->on) || sdata->pos != 6) {
348
-		if (OswaldClk.clk24hr)
349
-			WriteLcdString(2, 66, "x");
350
-		else
351
-			WriteLcdString(2, 66, "_");
352
-	}
353
-	WriteLcdString(15, 66, "24hr");
354
-
355
-	if ((sdata->pos == 7 && sdata->on) || sdata->pos != 7) {
356
-		if (OswaldClk.day_first)
357
-			WriteLcdString(2, 79, "x");
358
-		else
359
-			WriteLcdString(2, 79, "_");
360
-	}
361
-	WriteLcdString(15, 79, "dd.mm.  mm/dd");
362
-#endif
363 375
 	hal_lcd_update_display();
364 376
 }
365 377
 
... ...
@@ -457,6 +469,10 @@ void alarm_setup_events(u16t event, void *data)
457 469
 }
458 470
 
459 471
 
472
+/*
473
+ * Test menu
474
+ */
475
+
460 476
 typedef struct {
461 477
 	u8t menu_pos;
462 478
 } test_menu_t;
... ...
@@ -512,6 +528,10 @@ void test_menu_handle_events(u16t event, void *data)
512 528
 }
513 529
 
514 530
 
531
+/*
532
+ * Stop Watch
533
+ */
534
+
515 535
 typedef struct {
516 536
 	u8t hr;
517 537
 	u8t min;
... ...
@@ -531,36 +551,19 @@ static void update_stop_watch_screen(stopwatch_data_t *sdata)
531 551
 	char tstr[16];
532 552
 	SetFont(MetaWatchMonospaced10);
533 553
 
534
-#if 0
535
-	WriteLcdNumber(0, 30, sdata->hr);
536
-	WriteLcdCharacter(14, 30, ':');
537
-	WriteLcdNumber(19, 30, sdata->min);
538
-	WriteLcdCharacter(33, 30, ':');
539
-	WriteLcdNumber(38, 30, sdata->sec);
540
-	WriteLcdCharacter(52, 30, '.');
541
-	WriteLcdNumber(57, 30, sdata->csec / 10);
542
-
543
-	WriteLcdNumber(0, 50, sdata->lapse_hr);
544
-	WriteLcdCharacter(14, 50, ':');
545
-	WriteLcdNumber(19, 50, sdata->lapse_min);
546
-	WriteLcdCharacter(33, 50, ':');
547
-	WriteLcdNumber(38, 50, sdata->lapse_sec);
548
-	WriteLcdCharacter(52, 50, '.');
549
-	WriteLcdNumber(57, 50, sdata->lapse_csec / 10);
550
-#else
551 554
 	snprintf(tstr, 16, "%02d:%02d:%02d.%1d", sdata->hr, sdata->min, sdata->sec, sdata->csec / 10);
552
-	WriteLcdString(0, 30, tstr);
555
+	WriteLcdString(5, 40, tstr);
553 556
 	snprintf(tstr, 16, "%02d:%02d:%02d.%02d", sdata->lapse_hr, sdata->lapse_min, sdata->lapse_sec, sdata->lapse_csec);
554
-	WriteLcdString(0, 50, tstr);
555
-#endif
557
+	WriteLcdString(5, 60, tstr);
556 558
 
557 559
 	hal_lcd_update_display();
558 560
 }
559 561
 
560 562
 static void draw_stop_watch_screen(stopwatch_data_t *sdata)
561 563
 {
562
-	SetFont(MetaWatch16);
563
-	WriteLcdString(2, 5, "StopWatch");
564
+	oswald_draw_bitmap(36, 0, stopwatch_icon_width, stopwatch_icon_height, stopwatch_icon_bits);
565
+	oswald_draw_bitmap(81, 6, startstopbutton_icon_width, startstopbutton_icon_height, startstopbutton_icon_bits);
566
+	oswald_draw_bitmap(81, 38, lapsebutton_icon_width, lapsebutton_icon_height, lapsebutton_icon_bits);
564 567
 
565 568
 	update_stop_watch_screen(sdata);
566 569
 }
... ...
@@ -640,12 +643,17 @@ void stop_watch_handle_events(u16t event, void *data)
640 643
 }
641 644
 
642 645
 
646
+/*
647
+ * when alarm is fired
648
+ */
643 649
 void draw_alarm_screen(void)
644 650
 {
645 651
 	hal_lcd_clear_display();
646 652
 
647
-	SetFont(MetaWatch16);
648
-	WriteLcdString(2, 2, "ALARM !");
653
+//	SetFont(MetaWatch16);
654
+//	WriteLcdString(2, 2, "ALARM !");
655
+	oswald_draw_bitmap(36, 20, alarm_icon_width, alarm_icon_height, alarm_icon_bits);
656
+
649 657
 
650 658
 	hal_lcd_update_display();
651 659
 }
... ...
@@ -677,3 +685,148 @@ void alarm_handle_events(u16t event, void *data)
677 685
 	};
678 686
 }
679 687
 
688
+
689
+/*
690
+ * Bluetooth screen
691
+ */
692
+typedef struct {
693
+	u8t pos;
694
+	boolean bt_en;
695
+	boolean on;
696
+} bluetooth_data_t;
697
+static bluetooth_data_t bluetooth_screen = {
698
+	0,
699
+	FALSE,
700
+	TRUE
701
+};
702
+
703
+void draw_bluetooth_screen(bluetooth_data_t *sdata)
704
+{
705
+	char bstr[20];
706
+	uint8_t *bd_addr;
707
+
708
+	hal_lcd_clear_display();
709
+
710
+	oswald_draw_bitmap(36, 0, Bluetooth_icon_width, Bluetooth_icon_height, Bluetooth_icon_bits);
711
+
712
+	oswald_draw_bitmap(81, 6, upbutton_icon_width, upbutton_icon_height, upbutton_icon_bits);
713
+	oswald_draw_bitmap(81, 38, downbutton_icon_width, downbutton_icon_height, downbutton_icon_bits);
714
+
715
+	SetFont(MetaWatch5);
716
+	WriteLcdString(2, 30, "Enable:");
717
+	if ((sdata->pos == 0 && sdata->on) || sdata->pos != 0) {
718
+		WriteLcdCharacter(45, 30, bluetooth_screen.bt_en ? 'x' : '_');
719
+	}
720
+	WriteLcdString(2, 39, "State:");
721
+	switch (hal_bluetooth_get_state()) {
722
+		case BLUETOOTH_OFF:
723
+			WriteLcdString(45, 39, "off");
724
+			break;
725
+		case BLUETOOTH_ON:
726
+			WriteLcdString(45, 39, "on");
727
+			break;
728
+		case BLUETOOTH_CONNECTED:
729
+			WriteLcdString(45, 39, "conn.");
730
+			break;
731
+		default:
732
+			break;
733
+	};
734
+	if (hal_bluetooth_get_state() >= BLUETOOTH_ON) {
735
+		bd_addr = hal_bluetooth_get_local_bdaddr();
736
+		snprintf(bstr, 20, "%02x:%02x:%02x:%02x:%02x:%02x", bd_addr[5], bd_addr[4], bd_addr[3], bd_addr[2], bd_addr[1], bd_addr[0]);
737
+		WriteLcdString(2, 48, bstr);
738
+	} else {
739
+	}
740
+	WriteLcdString(2, 57, "Visible:");
741
+	if ((sdata->pos == 1 && sdata->on) || sdata->pos != 1) {
742
+		WriteLcdCharacter(45, 57, hal_bluetooth_get_visible() ? 'x' : '_');
743
+	}
744
+
745
+	hal_lcd_update_display();
746
+}
747
+
748
+void bluetooth_handle_updown(u8t pos, s8t incr)
749
+{
750
+	switch (pos) {
751
+		case 0:
752
+			if (hal_bluetooth_get_state() >= BLUETOOTH_ON) {
753
+				hal_bluetooth_set_state(BLUETOOTH_OFF);
754
+				bluetooth_screen.bt_en = FALSE;
755
+			} else {
756
+				hal_bluetooth_set_state(BLUETOOTH_ON);
757
+				bluetooth_screen.bt_en = TRUE;
758
+			}
759
+			break;
760
+		case 1:
761
+			if (hal_bluetooth_get_state() >= BLUETOOTH_ON && !hal_bluetooth_get_visible()) {
762
+				hal_bluetooth_set_visible(TRUE);
763
+			} else {
764
+				hal_bluetooth_set_visible(FALSE);
765
+			}
766
+			break;
767
+		case 2:
768
+			break;
769
+		case 3:
770
+			break;
771
+		case 4:
772
+			break;
773
+		case 5:
774
+			break;
775
+		case 6:
776
+			break;
777
+		case 7:
778
+			break;
779
+		case 8:
780
+			break;
781
+		default:
782
+			break;
783
+	};
784
+}
785
+
786
+void handle_bluetooth_buttons(watch_button button, bluetooth_data_t *sdata)
787
+{
788
+	switch (button) {
789
+		case BUTTON_A:
790
+			bluetooth_handle_updown(sdata->pos, 1);
791
+			break;
792
+		case BUTTON_B:
793
+			bluetooth_handle_updown(sdata->pos, -1);
794
+			break;
795
+		case BUTTON_F:
796
+			sdata->pos++;
797
+			sdata->pos %= 2;
798
+			break;
799
+		default:
800
+			break;
801
+	}
802
+	draw_bluetooth_screen(sdata);
803
+}
804
+
805
+void bluetooth_screen_events(u16t event, void *data)
806
+{
807
+	switch (event) {
808
+		case EVENT_SCREEN_VISIBLE:
809
+			bluetooth_screen.pos = 0;
810
+			bluetooth_screen.bt_en = (hal_bluetooth_get_state() > 0);
811
+			draw_bluetooth_screen(&bluetooth_screen);
812
+			hal_enable_halfsecond_timer();
813
+			break;
814
+		case EVENT_SCREEN_DESTROY:
815
+			hal_disable_halfsecond_timer();
816
+			break;
817
+		case EVENT_USER_BUTTONS:
818
+			dbg_out("button event %d\n", *(int *)data);
819
+			handle_bluetooth_buttons(*(watch_button *)data, &bluetooth_screen);
820
+			break;
821
+		case EVENT_HALF_SEC_TIMER:
822
+			if (bluetooth_screen.on)
823
+				bluetooth_screen.on = FALSE;
824
+			else
825
+				bluetooth_screen.on = TRUE;
826
+			draw_bluetooth_screen(&bluetooth_screen);
827
+			break;
828
+		default:
829
+			break;
830
+	};
831
+}
832
+
... ...
@@ -16,5 +16,6 @@ void stop_watch_handle_events(u16t event, void *data);
16 16
 
17 17
 void alarm_handle_events(u16t event, void *data);
18 18
 
19
-#endif
19
+void bluetooth_screen_events(u16t event, void *data);
20 20
 
21
+#endif
... ...
@@ -9,6 +9,16 @@
9 9
 
10 10
 #include "oswald_watch_faces.h"
11 11
 
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
+
20
+
21
+/* sine table, per degree, factor 100 */
12 22
 int16_t sintab[]={
13 23
 	    0,   2,   3,   5,   7,   9,  10,  12,  14,  16,
14 24
 	   17,  19,  21,  22,  24,  26,  28,  29,  31,  33,
... ...
@@ -131,6 +141,7 @@ void DrawLcdDigitalClock(boolean show_seconds)
131 141
 	int gRow = 3;
132 142
 	int gColumn = 3;
133 143
 	char tstr[16];
144
+	int i;
134 145
 
135 146
 	SetFont(MetaWatchTime);
136 147
 
... ...
@@ -175,6 +186,37 @@ void DrawLcdDigitalClock(boolean show_seconds)
175 186
 		snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year);
176 187
 	WriteLcdString(3, 25, tstr);
177 188
 
189
+	if (OswaldPowerState.source)
190
+		oswald_draw_bitmap(81, 4, charger_icon_width, charger_icon_height, charger_icon_bits);
191
+
192
+	if (OswaldPowerState.percent > 75)
193
+		oswald_draw_bitmap(81, 4, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
194
+	else if (OswaldPowerState.percent > 50)
195
+		oswald_draw_bitmap(81, 4, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
196
+	else if (OswaldPowerState.percent > 25)
197
+		oswald_draw_bitmap(81, 4, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
198
+	else if (OswaldPowerState.percent > 5)
199
+		oswald_draw_bitmap(81, 4, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
200
+	else
201
+		oswald_draw_bitmap(81, 4, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
202
+
203
+
204
+	if (hal_bluetooth_get_state() >= BLUETOOTH_ON)
205
+		oswald_draw_bitmap(81, 4, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits);
206
+
207
+	gRow = 0;
208
+	gColumn = 45;
209
+	SetFont(MetaWatch5);
210
+	for (i=0; i<strlen(MainMessage); i++) {
211
+		gRow += WriteLcdCharacter(gRow, gColumn, MainMessage[i]);
212
+		if (gRow > 90) {
213
+			gRow = 0;
214
+			gColumn += 7;
215
+		}
216
+		if (gColumn > 95)
217
+			i = 255;
218
+	}
219
+#if 0
178 220
 	snprintf(tstr, 16, "%d%% (%dmV)", OswaldPowerState.percent, OswaldPowerState.level);
179 221
 	WriteLcdString(2, 48, tstr);
180 222
 	WriteLcdString(2, 64, OswaldPowerState.source ? "ext" : "bat");
... ...
@@ -198,6 +240,7 @@ void DrawLcdDigitalClock(boolean show_seconds)
198 240
 				break;
199 241
 		};
200 242
 	};
243
+#endif
201 244
 	hal_lcd_update_display();
202 245
 }
203 246
 
204 247
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define resetbutton_icon_width 15
2
+#define resetbutton_icon_height 20
3
+static unsigned char resetbutton_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0xff, 0x00,
5
+  0xff, 0x00, 0xce, 0x00, 0xcc, 0x00, 0xc8, 0x00, 0xc0, 0x00, 0xc0, 0x00,
6
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define startstopbutton_icon_width 15
2
+#define startstopbutton_icon_height 20
3
+static unsigned char startstopbutton_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b,
5
+  0x00, 0x1b, 0x00, 0x3b, 0x00, 0x7b, 0x00, 0x7b, 0x00, 0x3b, 0x00, 0x1b,
6
+  0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define stopwatch_width 24
2
+#define stopwatch_height 24
3
+static unsigned char stopwatch_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00,
5
+  0x00, 0x7e, 0x10, 0x80, 0x81, 0x39, 0x40, 0x18, 0x1e, 0x20, 0x18, 0x0c,
6
+  0x10, 0x18, 0x08, 0x08, 0x18, 0x10, 0x08, 0x18, 0x10, 0x04, 0x18, 0x20,
7
+  0x04, 0x18, 0x20, 0x04, 0x18, 0x20, 0x04, 0x00, 0x20, 0x04, 0x00, 0x20,
8
+  0x04, 0x00, 0x20, 0x08, 0x00, 0x10, 0x08, 0x00, 0x10, 0x10, 0x00, 0x08,
9
+  0x20, 0x00, 0x04, 0x40, 0x00, 0x02, 0x80, 0x81, 0x01, 0x00, 0x7e, 0x00,
10
+  };
0 11
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define stopwatch_icon_width 24
2
+#define stopwatch_icon_height 24
3
+static unsigned char stopwatch_icon_bits[] = {
4
+  0x00, 0x18, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x18,
5
+  0x00, 0xff, 0x3c, 0xc0, 0xff, 0x3f, 0xe0, 0x00, 0x1f, 0x70, 0x18, 0x0e,
6
+  0x38, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30,
7
+  0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30, 0x0c, 0x00, 0x30,
8
+  0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x18, 0x38, 0x00, 0x1c,
9
+  0x70, 0x00, 0x0e, 0xe0, 0x00, 0x07, 0xc0, 0xff, 0x03, 0x00, 0xff, 0x00,
10
+  };
0 11
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define timesetup_icon_width 24
2
+#define timesetup_icon_height 24
3
+static unsigned char timesetup_icon_bits[] = {
4
+  0x00, 0xff, 0x00, 0xc0, 0xff, 0x03, 0xe0, 0x00, 0x07, 0x70, 0x18, 0x0e,
5
+  0x38, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30,
6
+  0x0c, 0x18, 0x30, 0x0c, 0xf8, 0x31, 0x0c, 0xf8, 0x31, 0x0c, 0x00, 0x30,
7
+  0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x18, 0x38, 0x00, 0x1c,
8
+  0x70, 0x00, 0x0e, 0xe0, 0x00, 0x07, 0xc0, 0xff, 0x03, 0x00, 0xff, 0x00,
9
+  0xfe, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0x00, 0x00,
10
+  };
0 11
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+#define upbutton_icon_width 15
2
+#define upbutton_icon_height 20
3
+static unsigned char upbutton_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
5
+  0x00, 0x1e, 0x00, 0x3f, 0x80, 0x7f, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
6
+  0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7
+  0x00, 0x00, 0x00, 0x00, };
0 8
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#define watch_icon_width 24
2
+#define watch_icon_height 24
3
+static unsigned char watch_icon_bits[] = {
4
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5
+  0x00, 0xff, 0x00, 0xc0, 0xff, 0x03, 0xe0, 0x00, 0x07, 0x70, 0x18, 0x0e,
6
+  0x38, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30,
7
+  0x0c, 0x18, 0x30, 0x0c, 0xf8, 0x31, 0x0c, 0xf8, 0x31, 0x0c, 0x00, 0x30,
8
+  0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x18, 0x38, 0x00, 0x1c,
9
+  0x70, 0x00, 0x0e, 0xe0, 0x00, 0x07, 0xc0, 0xff, 0x03, 0x00, 0xff, 0x00,
10
+  };