# List all the source files here
# eg if you have a source file foo.c then list it here
OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \
- ../ui/oswald_watch_faces.c ../ui/Fonts.c ../ui/LcdDisplay.c \
+ ../ui/oswald_watch_faces.c \
../ui/oswald_strings.c ../ui/calendar.c \
+ ../ui/oswald_graphics.c ../ui/oswald_fonts.c \
../ui/embedvm.c
SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
# Include are located in the Include directory
#INCLUDES = $(BT_STACK_INC)
#INCLUDES = $(BT_SMALLTOOTH_INV)
-INCLUDES = -I../ui/ -I../ui/bitmaps/
+INCLUDES = -I../ui/
# Add or subtract whatever MSPGCC flags you want. There are plenty more
#######################################################################################
#endif
memmove(packet, (packet+2), 6);
packet[6] = 0x04; // PIN has length of 4
+ memcpy((packet+7), BT_PIN, 4);
packet[7] = '4';
packet[8] = '3';
packet[9] = '1';
#define _BT_HCI_H
/* HCI Command OGF */
-#define HCI_LINK_CTRL_OGF 0x01
-#define HCI_LINK_POLICY_OGF 0x02
-#define HCI_HC_BB_OGF 0x03
-#define HCI_INFO_PARAM_OGF 0x04
+#define HCI_LINK_CTRL_OGF 0x01
+#define HCI_LINK_POLICY_OGF 0x02
+#define HCI_HC_BB_OGF 0x03
+#define HCI_INFO_PARAM_OGF 0x04
/* HCI Command OCF */
#define HCI_DISCONN_OCF 0x06
#define EHCILL_WAKE_UP_IND 0x32
#define EHCILL_WAKE_UP_ACK 0x33
+#define BT_PIN "4312"
+
void bt_hci_init(void);
void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, const void *data);
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);
#include "LcdDisplay.h"
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
-{
- uint8_t x, y;
- uint8_t *cb;
-
- // we only draw set pixel, unset pixel remain as they are
- for (y=0; y<height; y++) {
- for (x=0; x<width; x++) {
- cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8));
- if (*cb & (1 << (x % 8)))
- hal_lcd_set_pixel(xstart + x, ystart + y, TRUE);
- }
- }
-}
-
void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend)
{
int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
// #include "oswald_hal.h"
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp);
void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend);
void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness);
u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character);
bin_PROGRAMS = oswald-gui
-oswald_gui_SOURCES = oswald-ui.c LcdDisplay.c Fonts.c oswald_main.c oswald_watch_faces.c oswald_strings.c oswald_screens.c \
-embedvm.c oswald_fonts.c oswald_graphics.c calendar.c
+oswald_gui_SOURCES = oswald-ui.c oswald_main.c \
+ oswald_watch_faces.c oswald_strings.c oswald_screens.c \
+ embedvm.c oswald_graphics.c calendar.c oswald_fonts.c
+
oswald_gui_CFLAGS = -g $(GTK_CFLAGS)
oswald_gui_LDADD = $(GTK_LIBS)
#include "oswald_fonts.h"
-#include "fonts/4x6_horizontal_LSB_1.h"
-#include "fonts/5x8_horizontal_LSB_1.h"
-#include "fonts/5x12_horizontal_LSB_1.h"
-#include "fonts/6x8_horizontal_LSB_1.h"
-#include "fonts/6x10_horizontal_LSB_1.h"
-#include "fonts/7x12b_horizontal_LSB_1.h"
-#include "fonts/7x12_horizontal_LSB_1.h"
-#include "fonts/8x8_horizontal_LSB_1.h"
-#include "fonts/8x12_horizontal_LSB_1.h"
-#include "fonts/8x14_horizontal_LSB_1.h"
-#include "fonts/10x16_horizontal_LSB_1.h"
-#include "fonts/12x16_horizontal_LSB_1.h"
-#include "fonts/12x20_horizontal_LSB_1.h"
-#include "fonts/16x26_horizontal_LSB_1.h"
-#include "fonts/22x36_horizontal_LSB_1.h"
-#include "fonts/24x40_horizontal_LSB_1.h"
-#include "fonts/32x53_horizontal_LSB_1.h"
+//#include "fonts/m4x6_horizontal_LSB_1.h"
+//#include "fonts/m5x8_horizontal_LSB_1.h"
+//#include "fonts/m5x12_horizontal_LSB_1.h"
+#include "fonts/m6x8_horizontal_LSB_1.h"
+//#include "fonts/m6x10_horizontal_LSB_1.h"
+#include "fonts/m7x12b_horizontal_LSB_1.h"
+//#include "fonts/m7x12_horizontal_LSB_1.h"
+//#include "fonts/m8x8_horizontal_LSB_1.h"
+//#include "fonts/m8x12_horizontal_LSB_1.h"
+//#include "fonts/m8x14_horizontal_LSB_1.h"
+//#include "fonts/m10x16_horizontal_LSB_1.h"
+//#include "fonts/m12x16_horizontal_LSB_1.h"
+//#include "fonts/m12x20_horizontal_LSB_1.h"
+#include "fonts/m16x26_horizontal_LSB_1.h"
+//#include "fonts/m22x36_horizontal_LSB_1.h"
+//#include "fonts/m24x40_horizontal_LSB_1.h"
+//#include "fonts/m32x53_horizontal_LSB_1.h"
const oswald_font oswald_fonts[LAST_FONT] = {
- { 4, 6, (char **)font_4x6},
- { 5, 8, (char **)font_5x8},
- { 5, 12, (char **)font_5x12},
- { 6, 8, (char **)font_6x8},
- { 6, 10, (char **)font_6x10},
- { 7, 12, (char **)font_7x12},
- { 7, 12, (char **)font_7x12b},
- { 8, 8, (char **)font_8x8},
- { 8, 12, (char **)font_8x12},
- { 8, 14, (char **)font_8x14},
- { 10, 16, (char **)font_10x16},
- { 12, 16, (char **)font_12x16},
- { 12, 20, (char **)font_12x20},
- { 16, 26, (char **)font_16x26},
- { 22, 36, (char **)font_22x36},
- { 24, 40, (char **)font_24x40},
- { 32, 53, (char **)font_32x53},
+// { 4, 6, (char *)font_4x6},
+// { 5, 8, (char *)font_5x8},
+// { 5, 12, (char *)font_5x12},
+ { 6, 8, (uint8_t *)font_6x8},
+// { 6, 10, (char *)font_6x10},
+// { 7, 12, (uint8_t *)font_7x12},
+ { 7, 12, (uint8_t *)font_7x12b},
+// { 8, 8, (char *)font_8x8},
+// { 8, 12, (char *)font_8x12},
+// { 8, 14, (char *)font_8x14},
+// { 10, 16, (char *)font_10x16},
+// { 12, 16, (char *)font_12x16},
+// { 12, 20, (char *)font_12x20},
+ { 16, 26, (uint8_t *)font_16x26},
+// { 22, 36, (char *)font_22x36},
+// { 24, 40, (char *)font_24x40},
+// { 32, 53, (char *)font_32x53},
};
#include "oswald.h"
typedef enum {
- FONT_4x6 = 0,
- FONT_5x8,
- FONT_5x12,
- FONT_6x8,
- FONT_6x10,
+// FONT_4x6 = 0,
+// FONT_5x8 = 0,
+// FONT_5x12,
+ FONT_6x8 = 0,
+// FONT_6x10,
+// FONT_7x12,
FONT_7x12b,
- FONT_7x12,
- FONT_8x8,
- FONT_8x12,
- FONT_8x14,
- FONT_10x16,
- FONT_12x16,
- FONT_12x20,
+// FONT_8x8,
+// FONT_8x12,
+// FONT_8x14,
+// FONT_10x16,
+// FONT_12x16,
+// FONT_12x20,
FONT_16x26,
- FONT_22x36,
- FONT_24x40,
- FONT_32x53,
+// FONT_22x36,
+// FONT_24x40,
+// FONT_32x53,
LAST_FONT
} oswald_font_face;
typedef struct {
- u8t width;
- u8t height;
- char **data;
+ uint8_t width;
+ uint8_t height;
+ uint8_t *data;
} oswald_font;
extern const oswald_font oswald_fonts[];
-#include "oswald-ui.h"
+#include "oswald.h"
#include "oswald_strings.h"
#include "oswald_fonts.h"
+#include "oswald_hal.h"
#include "oswald_graphics.h"
+// dummies for MW replacement stuff
+
+void SetFont(etFontType Type)
+{
+}
+
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str)
+{
+ return 1;
+}
+
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number)
+{
+}
+
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character)
+{
+ return 1;
+}
+
+
+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)
+{
+ unsigned int x, y;
+ uint8_t *cb;
+
+ if (bmp == NULL)
+ return;
+
+ // we only draw set pixel, unset pixel remain as they are
+ for (y=yoff; y<height; y++) {
+ for (x=xoff; x<width; x++) {
+ cb = (uint8_t *)(bmp + (y * ((width / 8) + ((width % 8) ? 1 : 0))) + (x / 8));
+ if (*cb & (1 << (x % 8)))
+ hal_lcd_set_pixel((xstart + x) - xoff, (ystart + y) - yoff, TRUE);
+ }
+ }
+}
#if 0
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
+/*inline*/ void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp)
{
- uint8_t x, y;
+ unsigned int x, y;
uint8_t *cb;
// we only draw set pixel, unset pixel remain as they are
for (y=0; y<height; y++) {
for (x=0; x<width; x++) {
- cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8));
+ cb = (uint8_t *)(bmp + (y * ((width / 8) + ((width % 8) ? 1 : 0))) + (x / 8));
if (*cb & (1 << (x % 8)))
- hal_lcd_set_pixel(xstart + x, ystart + y, TRUE);
+ hal_lcd_set_pixel((xstart + x), (ystart + y), TRUE);
}
}
}
+#else
+void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp)
+{
+ // seems we are triggering a MSPGCC compiler bug here...
+ // if we do not do this trick then bmp becomes 0x00 when passed a livel higher!
+ volatile unsigned int num;
+
+ num = (unsigned int) bmp;
+
+ oswald_draw_bitmap_offset(xstart, ystart, 0, 0, width, height, bmp);
+}
#endif
-void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend)
+void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend)
{
- uint8_t x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
+ int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
dx = xend - xstart;
dy = yend - ystart;
}
hal_lcd_set_pixel(x, y, TRUE);
}
- hal_lcd_update_display();
+ // hal_lcd_update_display();
}
-void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
+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)
{
int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
dy = -dy;
if (dx>dy) {
- pdx = incx; pdy = 0;
- ddx=incx; ddy=incy;
- es =dy; el =dx;
+ pdx = incx;
+ pdy = 0;
+ ddx=incx;
+ ddy=incy;
+ es =dy;
+ el =dx;
} else {
- pdx=0; pdy=incy;
- ddx=incx; ddy=incy;
- es =dx; el =dy;
+ pdx=0;
+ pdy=incy;
+ ddx=incx;
+ ddy=incy;
+ es =dx;
+ el =dy;
}
x = xstart;
hal_lcd_set_pixel(x, y+i, TRUE);
}
}
- hal_lcd_update_display();
+ // hal_lcd_update_display();
}
-u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character)
+uint8_t oswald_write_character(const uint8_t x, const uint8_t y, const oswald_font_face face, const uint8_t Character)
{
#if 0
u8t CharacterHeight = GetCharacterHeight();
if (bitmap[ly] & (1<<lx)) {
hal_lcd_set_pixel(lx+x, ly+y, TRUE);
// printf(".");
- } else {
+ } /*else {
hal_lcd_set_pixel(lx+x, ly+y, FALSE);
// printf(" ");
- }
+ }*/
}
// printf("\n");
}
return CharacterWidth + GetFontSpacing();
-#endif
- char *cdata = oswald_fonts[face].data[Character];
+#else
+ uint8_t *cdata = oswald_fonts[face].data;
+ int csize;
+
+ if (Character == 32) // space / blank
+ return oswald_fonts[face].width / 2;
+
+ csize = ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0)) * oswald_fonts[face].height;
+ //csize += (oswald_fonts[face].height / 8) + ((oswald_fonts[face].height % 8) ? 1 : 0);
+
+ // g_printerr("fp = 0x%08lx cdata = 0x%08lx\n", font_7x12, cdata);
- dbg_out("%c", cdata[1]);
- return 0;
+ cdata = (cdata + (csize * (int)Character));
+
+ //g_printerr("%02x\n", oswald_fonts[face].data[0][0]);
+ //g_printerr("char %02x face %d %dx%d csize %d\n", Character, face, oswald_fonts[face].width, oswald_fonts[face].height, csize);
+ //g_printerr("char %02x %02x %02x\n", (uint8_t)cdata[0], (uint8_t)cdata[1], (uint8_t)cdata[2]);
+
+ // oswald_draw_bitmap(x, y, oswald_fonts[face].height, oswald_fonts[face].height, cdata);
+ //oswald_draw_bitmap(x, y, ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0))*8, oswald_fonts[face].height, cdata);
+ 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);
+
+ return oswald_fonts[face].width;
+#endif
}
-void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str)
+void oswald_write_string(const uint8_t x, const uint8_t y, const oswald_font_face face, char *str)
{
- register lx, i, strl;
+ uint8_t lx, i, strl;
strl = oswald_strlen(str);
if (strl == 0)
lx = x;
for (i=0; i<strl; i++) {
- lx += WriteLcdCharacter(lx, y, str[i]);
+ lx += oswald_write_character(lx, y, face, str[i]);
}
}
-void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number)
+void oswald_write_number(const uint8_t x, const uint8_t y, const oswald_font_face face, const int16_t number)
{
- register lx, i, strl;
- u8t str[8];
+ uint8_t lx, i, strl;
+ char str[8];
itoa(number, str, 10);
strl = oswald_strlen(str);
lx = x;
for (i=0; i<strl; i++) {
- lx += WriteLcdCharacter(lx, y, str[i]);
+ lx += oswald_write_character(lx, y, face, str[i]);
}
}
+
#include "oswald_fonts.h"
#include "oswald_graphics.h"
+#include "Fonts.h"
+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);
-void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp);
+/*inline*/ void oswald_draw_bitmap(const unsigned int xstart, const unsigned int ystart, const unsigned int width, const unsigned int height, const void *bmp);
-void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend);
+void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend);
-void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness);
+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);
-u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character);
+uint8_t oswald_write_character(const uint8_t x, const uint8_t y, const oswald_font_face face, const uint8_t Character);
-void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str);
+void oswald_write_string(const uint8_t x, const uint8_t y, const oswald_font_face face, char *str);
-void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number);
+void oswald_write_number(const uint8_t x, const uint8_t y, const oswald_font_face face, const int16_t number);
#endif
#include "oswald.h"
#include "oswald_main.h"
#include "oswald_watch_faces.h"
-#include "Fonts.h"
-#include "LcdDisplay.h"
+#include "oswald_graphics.h"
#include "oswald_hal.h"
#include "oswald_screens.h"
-#include "timesetup_icon.xbm"
-#include "stopwatch_icon.xbm"
-#include "alarm_icon.xbm"
-#include "startstopbutton_icon.xbm"
-#include "lapsebutton_icon.xbm"
-#include "upbutton_icon.xbm"
-#include "downbutton_icon.xbm"
-#include "Bluetooth_icon.xbm"
+#include "LcdDisplay.h"
+#include "Fonts.h"
+
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/timesetup_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/stopwatch_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/alarm_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/startstopbutton_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/lapsebutton_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/upbutton_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/downbutton_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/Bluetooth_icon.xbm"
typedef struct {
void draw_accel_screen(accel_data_t *accel_data)
{
hal_lcd_clear_display();
- SetFont(MetaWatch16);
- WriteLcdString(2, 2, "X:");
- WriteLcdNumber(20, 2, accel_data->x);
- WriteLcdString(2, 18, "Y:");
- WriteLcdNumber(20, 18, accel_data->y);
- WriteLcdString(2, 34, "Z:");
- WriteLcdNumber(20, 34, accel_data->z);
- WriteLcdString(2, 54, "Light:");
- WriteLcdNumber(40, 54, accel_data->z);
+ oswald_write_string(0, 2, FONT_7x12b, "X:");
+ oswald_write_number(20, 2, FONT_7x12b, accel_data->x);
+ oswald_write_string(0, 18, FONT_7x12b, "Y:");
+ oswald_write_number(20, 18, FONT_7x12b, accel_data->y);
+#if 0
+ oswald_write_string(0, 34, FONT_8x12, "Z:");
+ oswald_write_number(20, 34, FONT_8x12, accel_data->z);
+ oswald_write_string(0, 54, FONT_12x16, "Light:");
+ oswald_write_number(50, 54, FONT_12x16, accel_data->z);
+
+ oswald_write_string(0, 70, FONT_12x20, "23:59");
+#endif
hal_lcd_update_display();
}
void draw_datetime_setup_screen(datetime_setup_data_t *sdata)
{
hal_lcd_clear_display();
-// SetFont(MetaWatch16);
-// WriteLcdString(2, 2, "Set");
+
oswald_draw_bitmap(36, 0, timesetup_icon_width, timesetup_icon_height, timesetup_icon_bits);
oswald_draw_bitmap(81, 6, upbutton_icon_width, upbutton_icon_height, upbutton_icon_bits);
WriteLcdCharacter(31, 30, (OswaldClk.minute / 10));
WriteLcdCharacter(43, 30, (OswaldClk.minute % 10));
}
-/*
- WriteLcdCharacter(55, 20, TIME_CHARACTER_COLON_INDEX);
- if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) {
- WriteLcdCharacter(60, 20, (OswaldClk.second / 10));
- WriteLcdCharacter(72, 20, (OswaldClk.second % 10));
- }
-*/
SetFont(MetaWatch16);
if ((sdata->pos == 2 && sdata->on) || sdata->pos != 2) {
WriteLcdCharacter(59, 36, 0x30 + (OswaldClk.second / 10));
#include "Fonts.h"
#include "LcdDisplay.h"
#include "oswald_hal.h"
+#include "oswald_graphics.h"
#include "oswald_watch_faces.h"
-#include "battery0_icon.xbm"
-#include "battery25_icon.xbm"
-#include "battery50_icon.xbm"
-#include "battery75_icon.xbm"
-#include "battery100_icon.xbm"
-#include "charger_icon.xbm"
-#include "bluetooth_icon.xbm"
-#include "bluetooth_con_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/battery0_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/battery25_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/battery50_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/battery75_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/battery100_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/charger_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/bluetooth_icon.xbm"
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
+#include "bitmaps/bluetooth_con_icon.xbm"
/* sine table, per degree, factor 100 */
+#if defined(__GNUC__) && (__MSP430X__ > 0)
+__attribute__((__far__))
+#endif
int16_t sintab[]={
0, 2, 3, 5, 7, 9, 10, 12, 14, 16,
17, 19, 21, 22, 24, 26, 28, 29, 31, 33,
}
} else {
if (OswaldPowerState.percent > 75)
- oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
else if (OswaldPowerState.percent > 50)
- oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
else if (OswaldPowerState.percent > 25)
- oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
else if (OswaldPowerState.percent > 5)
- oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
else
- oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
+ oswald_draw_bitmap_offset(81, 0, 0,0, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
}
if (hal_bluetooth_get_state() == BLUETOOTH_ON)
hal_lcd_clear_display();
- SetFont(MetaWatch16);
snprintf(tstr, 16, "%02d", OswaldClk.day);
+#if 0
+ SetFont(MetaWatch16);
WriteLcdString(70, 40, tstr);
+#else
+ oswald_write_string(70, 43, FONT_7x12b, tstr);
+#endif
// Marker
// plot(R*cos(360° * i/N), R*sin(360° * i/N))
y = 47 + ((43 * f_sin((360 / 12) * i)) / 100);
x2 = 47 + ((47 * f_cos((360 / 12) * i)) / 100);
y2 = 47 + ((47 * f_sin((360 / 12) * i)) / 100);
- DrawLcdLineBresenhamWW(x, y, x2, y2, 2);
+ oswald_draw_line_ww(x, y, x2, y2, 2);
// g_printerr("br %d,%d %d,%d\n", x,y,x2,y2);
};
x = tmp;
tmp = 47 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100);
y = tmp;
- DrawLcdLineBresenhamWW(47, 47, x, y, 2);
+ oswald_draw_line_ww(47, 47, x, y, 2);
// Minute
tmp = 47 + ((40 * f_cos((360 / 60) * minute)) / 100);
x = tmp;
tmp = 47 + ((40 * f_sin((360 / 60) * minute)) / 100);
y = tmp;
- DrawLcdLineBresenhamWW(47, 47, x, y, 2);
+ oswald_draw_line_ww(47, 47, x, y, 2);
if (show_seconds) {
// Seconds
x = tmp;
tmp = 47 + ((40 * f_sin((360 / 60) * seconds)) / 100);
y = tmp;
- DrawLcdLineBresenham(47, 47, x, y);
+ oswald_draw_line(47, 47, x, y);
};
draw_status_icons();
char tstr[16];
int i;
+#if 0
SetFont(MetaWatchTime);
hal_lcd_clear_display();
snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year);
WriteLcdString(3, 25, tstr);
-#if 0
- if (OswaldPowerState.source)
- oswald_draw_bitmap(81, 4, charger_icon_width, charger_icon_height, charger_icon_bits);
-
- if (OswaldPowerState.percent > 75)
- oswald_draw_bitmap(81, 4, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
- else if (OswaldPowerState.percent > 50)
- oswald_draw_bitmap(81, 4, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
- else if (OswaldPowerState.percent > 25)
- oswald_draw_bitmap(81, 4, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
- else if (OswaldPowerState.percent > 5)
- oswald_draw_bitmap(81, 4, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
- else
- oswald_draw_bitmap(81, 4, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
-
-
- if (hal_bluetooth_get_state() >= BLUETOOTH_ON)
- oswald_draw_bitmap(81, 4, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits);
-#else
draw_status_icons();
-#endif
gRow = 0;
gColumn = 45;
break;
};
};
+#endif
+#else
+ hal_lcd_clear_display();
+ snprintf(tstr, 16, "%02d", OswaldClk.hour);
+ oswald_write_string(0, 0, FONT_16x26, tstr);
+ oswald_write_character(26, 0, FONT_16x26, ':');
+ snprintf(tstr, 16, "%02d", OswaldClk.minute);
+ oswald_write_string(36, 0, FONT_16x26, tstr);
+
+ if (OswaldClk.day_first)
+ snprintf(tstr, 16, "%d.%d.%d", OswaldClk.day, OswaldClk.month, OswaldClk.year);
+ else
+ snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year);
+ oswald_write_string(0, 25, FONT_7x12b, tstr);
+
+ gRow = 0;
+ gColumn = 45;
+ for (i=0; i<strlen(MainMessage); i++) {
+ gRow += oswald_write_character(gRow, gColumn, FONT_6x8, MainMessage[i]);
+ if (gRow > 90) {
+ gRow = 0;
+ gColumn += 9;
+ }
+ if (gColumn > 95)
+ i = 255;
+ }
+
+ draw_status_icons();
#endif
hal_lcd_update_display();
}