#include "task_button.h"
#include "task_imu.h"
+#include "task_lcd.h"
#include "app_health.h"
+#define HEALTH_BANNER_HEIGHT 16
+#define HEALTH_PAD 5
+
void app_health_data(gl_display_t *disp) {
char data[64] = "watchdog test...";
gl_gfx_Cls(disp);
}
void app_health_data2(gl_display_t *disp) {
- char data[64] = "watchdog test...";
+ char data[64] = "loading...";
+ char dat2[64] = "loading...";
+ const char *title = "Exercise";
+ const gl_word_t charht = gl_charheight(disp, 'x');
gl_gfx_Cls(disp);
+
+
+
+ uint16_t txtw = gl_txt_strw(disp, title);
+ gl_gfx_RectangleFilled(disp, 0, 0, LCD_WIDTH, HEALTH_BANNER_HEIGHT, ROSYBROWN);
+ gl_gfx_MoveTo(disp, LCD_WIDTH / 2 - txtw / 2, (HEALTH_BANNER_HEIGHT - charht) / 2);
+ gl_txt_BGcolour(disp, ROSYBROWN);
+ gl_txt_FGcolour(disp, WHITE);
+ gl_txt_Bold(disp, 1);
+ gl_putstr(disp, (uint8_t *) title);
+
+
gl_txt_BGcolour(disp, BLACK);
gl_txt_FGcolour(disp, WHITE);
+
while (1) {
// gl_txt_MoveCursor(disp, 0, 0);
struct gt_btn_msg_t *btnmsg;
struct gt_health_msg_t healthmsg;
- snprintf(data, 64, "Steps: %d Cal: %.4f", gt_health_step, gt_health_cal);
- printf(data);
- // gl_putstr(disp, (uint8_t *) "Pedometer");
- gl_txt_MoveCursor(disp, 5, 0);
- for (char *x = &data[0]; *x == '\0' ; x++)
- gl_putCH(disp, 'A');
+
+
while (xQueueReceive(gt_btnq, (void *) &btnmsg, 0) == pdPASS) {
if (btnmsg->btn == GT_BTN_WHITE
&& btnmsg->evt == BUTTON_SINGLE_CLICK) {
return;
}
}
+
+ while (xQueueReceive(gt_healthq, (void *) &healthmsg, 0) == pdPASS) {
+ snprintf(data, 64, "Steps: %d", healthmsg.step);
+ snprintf(dat2, 64, "Calories: %d", (int) healthmsg.cal);
+ }
+
+ // printf(data);
+
+ // gl_txt_MoveCursor(disp, 5, 0);
+ txtw = gl_txt_strw(disp, data);
+ gl_gfx_MoveTo(disp, LCD_WIDTH / 2 - txtw / 2, LCD_HEIGHT / 2 - charht - HEALTH_PAD);
+ //for (char *x = &data[0]; *x == '\0' ; x++)
+ gl_putstr(disp, (unsigned char *) data);
+
+ txtw = gl_txt_strw(disp, dat2);
+ gl_gfx_MoveTo(disp, LCD_WIDTH / 2 - txtw / 2, LCD_HEIGHT / 2 + HEALTH_PAD);
+ gl_putstr(disp, (unsigned char *) dat2);
vTaskDelay(pdMS_TO_TICKS(100));
}
}
\ No newline at end of file
void lcd_clock_draw_face(gl_display_t *);
void lcd_clock_draw_hand(gl_display_t *, uint16_t, uint16_t, uint8_t, gl_word_t);
-gl_word_t txt_strw(gl_display_t *, char *);
+
int write_tx(const void*, size_t);
int read_rx(void *, size_t, uint32_t);
int flush_rx();
tm / 60 % 60,
(tm / (60 * 60) % 24 > 12) ? "PM" : "AM");
/*gl_txt_Italic(disp, 1);*/
- uint16_t chw = txt_strw(disp, txt);
+ uint16_t chw = gl_txt_strw(disp, txt);
gl_gfx_MoveTo(disp, (LCD_WIDTH / 2) - (chw / 2), (LCD_HEIGHT / 2)
+ (CLOCKSCR_CIRCRAD / 2));
gl_putstr(disp, (unsigned char *) txt);
txt = applist[curr_idx].name;
gl_gfx_RectangleFilled(disp, 0, LCD_HHEIGHT, LCD_WIDTH, LCD_HEIGHT,
BLACK);
- chw = txt_strw(disp, txt);
+ chw = gl_txt_strw(disp, txt);
gl_gfx_MoveTo(disp, LCD_WIDTH / 2 - chw / 2, LCD_HHEIGHT
+ APPSCR_PAD);
gl_txt_BGcolour(disp, BLACK);
}
-gl_word_t txt_strw(gl_display_t *disp, char *str) {
- gl_word_t pxlw = 0;
- while (*str) {
- pxlw += gl_charwidth(disp, (unsigned char) *str);
- str++;
- }
- return pxlw;
-}
+