W800_Smart_Watch/src/W800 SDK v1.00.08/app/gfx/watch_face.h

49 lines
1.2 KiB
C

#ifndef WATCH_FACE_H
#define WATCH_FACE_H
#include "lvgl.h"
#include <time.h>
typedef void (*DateTimeCb_t)(struct tm * const dateTime);
typedef struct DateWindow
{
lv_obj_t *dateWindowWidget;
char dateWindowText[3];
} DateWindow_t;
typedef struct WatchHand
{
lv_obj_t *handImg;
float handAngle;
}WatchHand_t;
/* Watch face context object */
typedef struct WatchFace
{
DateTimeCb_t dateTimeCb; //Call back function used to retrieve the date and time needed by the watch face
WatchHand_t hourHand;
WatchHand_t minuteHand;
WatchHand_t secondHand;
WatchHand_t mediumHand24h;
lv_timer_t *handAnimationTimer;
lv_obj_t *display;
DateWindow_t dateWindow;
struct tm dateTime;
} WatchFace_t;
/* Initializes the watch face context object */
void watch_face_init(WatchFace_t * const watchFace);
/* Registers a call back function to retrieve the time and date */
void watch_face_register_cb(WatchFace_t * const watchFace, DateTimeCb_t DateTimeCb);
/* Builds the watch face graphically */
void watch_face_create(WatchFace_t * const watchFace);
/* Frees all resources used by the WatchFace object */
void watch_face_destroy(WatchFace_t * const watchFace);
#endif // WATCH_FACE_H