Updated CodeBlocks LVGL simulator main.c file
This commit is contained in:
parent
9e63ebd529
commit
e8f8f694f0
@ -62,6 +62,30 @@ static void date_time_cb(struct tm * const dateTime)
|
|||||||
*dateTime = *tm;
|
*dateTime = *tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void compass_screen_on_state_change_cb(CompassScreenState_e compassScreenState)
|
||||||
|
{
|
||||||
|
switch(compassScreenState)
|
||||||
|
{
|
||||||
|
case COMPASS_SCREEN_OPENED:
|
||||||
|
LV_LOG_USER("Compass Screen opened");
|
||||||
|
break;
|
||||||
|
case COMPASS_SCREEN_CLOSED:
|
||||||
|
default:
|
||||||
|
LV_LOG_USER("Compass Screen closed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void azimuth_and_temperature_cb(uint16_t *azimuth, float *temperature)
|
||||||
|
{
|
||||||
|
static uint16_t _azimuth = 0;
|
||||||
|
static float _temp = -20;
|
||||||
|
|
||||||
|
*azimuth = _azimuth++;
|
||||||
|
*temperature = _temp += 0.9;
|
||||||
|
if(_temp > 120) _temp = -20;
|
||||||
|
}
|
||||||
|
|
||||||
static void alti_meas_cb(float * const temperature, float * const pressure, float * const altitude)
|
static void alti_meas_cb(float * const temperature, float * const pressure, float * const altitude)
|
||||||
{
|
{
|
||||||
static float a = 425.5;
|
static float a = 425.5;
|
||||||
@ -110,21 +134,24 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLi
|
|||||||
lv_win32_init(hInstance, SW_SHOWNORMAL, 240, 240, NULL);
|
lv_win32_init(hInstance, SW_SHOWNORMAL, 240, 240, NULL);
|
||||||
|
|
||||||
/*Output prompt information to the console, you can also use printf() to print directly*/
|
/*Output prompt information to the console, you can also use printf() to print directly*/
|
||||||
LV_LOG_USER("LVGL initialization completed!");
|
LV_LOG_USER("LVGL initialization completed, color size is : %u !", LV_COLOR_SIZE);
|
||||||
LV_IMG_DECLARE(watch_mask)
|
LV_IMG_DECLARE(watch_mask)
|
||||||
|
|
||||||
/*Run the demo*/
|
/*Run the demo*/
|
||||||
//lv_demo_widgets();
|
//lv_demo_widgets();
|
||||||
lv_obj_t *top_layer = lv_layer_top();
|
lv_obj_t *sys_layer = lv_layer_sys();
|
||||||
//We apply the mask to simulate what we can see on the watch screen
|
//We apply the mask to simulate what we can see on the watch screen
|
||||||
lv_obj_t *screen_mask = lv_img_create(top_layer);
|
lv_obj_t *screen_mask = lv_img_create(sys_layer);
|
||||||
lv_img_set_src(screen_mask, &watch_mask);
|
lv_img_set_src(screen_mask, &watch_mask);
|
||||||
|
|
||||||
watch_face_init(&watchFace);
|
watch_face_init(&watchFace);
|
||||||
menu_screen_init(&menuScreen);
|
menu_screen_init(&menuScreen);
|
||||||
compass_screen_init(&compassScreen);
|
compass_screen_init(&compassScreen);
|
||||||
|
compass_screen_register_on_state_change_cb(&compassScreen, &(compass_screen_on_state_change_cb));
|
||||||
|
compass_screen_register_azimuth_and_temperature_cb(&compassScreen, &(azimuth_and_temperature_cb));
|
||||||
settings_screen_init(&settingsScreen);
|
settings_screen_init(&settingsScreen);
|
||||||
altimeter_screen_init(&altimeterScreen);
|
altimeter_screen_init(&altimeterScreen);
|
||||||
|
altimeter_screen_register_measurement_cb(&altimeterScreen, &(alti_meas_cb));
|
||||||
notification_screen_init(¬ificationScreen);
|
notification_screen_init(¬ificationScreen);
|
||||||
find_my_phone_screen_init(&findMyPhoneScreen);
|
find_my_phone_screen_init(&findMyPhoneScreen);
|
||||||
find_my_phone_screen_register_BLE_command_send_cb(&findMyPhoneScreen, &(sendMyFindPhoneBLECommandCb));
|
find_my_phone_screen_register_BLE_command_send_cb(&findMyPhoneScreen, &(sendMyFindPhoneBLECommandCb));
|
||||||
@ -138,8 +165,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLi
|
|||||||
music_player_screen_set_music_position(&musicPlayerScreen, 2*60+12);
|
music_player_screen_set_music_position(&musicPlayerScreen, 2*60+12);
|
||||||
music_player_screen_set_music_playing_state(&musicPlayerScreen, MUSIC_CONTROL_PLAY);
|
music_player_screen_set_music_playing_state(&musicPlayerScreen, MUSIC_CONTROL_PLAY);
|
||||||
|
|
||||||
altimeter_screen_register_measurement_cb(&altimeterScreen, &(alti_meas_cb));
|
|
||||||
|
|
||||||
watch_face_register_date_time_cb(&watchFace, &(date_time_cb));
|
watch_face_register_date_time_cb(&watchFace, &(date_time_cb));
|
||||||
watch_face_create(&watchFace);
|
watch_face_create(&watchFace);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user