Compare commits

..

No commits in common. "9f7e5169849a35f40dca70cd22fc0ede8cd030c6" and "c26a88d21c61c3abb9382705348726a7258d9770" have entirely different histories.

9 changed files with 58 additions and 237 deletions

View File

@ -1,13 +1,3 @@
/**
* @file i2c.c
* @author Anatole SCHRAMM-HENRY
* @brief I2C base functions API source file
* @version 0.1
* @date 2023-04-04
*
* @copyright MIT
*
*/
#include "wm_type_def.h" #include "wm_type_def.h"
#include "wm_io.h" #include "wm_io.h"
#include "wm_gpio_afsel.h" #include "wm_gpio_afsel.h"

View File

@ -1,12 +1,3 @@
/**
* @file i2c.h
* @author Anatole SCHRAMM-HENRY
* @brief I2C base functions API header file
* @version 0.1
* @date 2023-04-04
*
* @copyright MIT
*/
#ifndef I2C_H #ifndef I2C_H
#define I2C_H #define I2C_H

View File

@ -31,15 +31,14 @@ bool ble_modem_on(bool bluetoothOnly, bool startService)
{ {
TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_init ret:%s"NEW_LINE, __FUNCTION__, tls_bt_rc_2_str(status)); TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_init ret:%s"NEW_LINE, __FUNCTION__, tls_bt_rc_2_str(status));
} }
else else if(bluetoothOnly) // If we successfully started the modem, we can set it's working mode.
{ {
// If we successfully started the modem, we can set it's working mode.
if(bluetoothOnly)
tls_rf_bt_mode(true); tls_rf_bt_mode(true);
}
// Start the ble service if it was asked and if it is not yet started // Start the ble service if it was asked and if it is not yet started
if(startService && !ble_service_is_started()) if(startService && !ble_service_is_started())
serviceStartSuccess = ble_service_start(); serviceStartSuccess = ble_service_start();
}
return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStartSuccess) ? true : false; return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStartSuccess) ? true : false;
} }

View File

@ -127,18 +127,6 @@ static void setTimeCb(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *
} }
} }
static void setTimeFormatCb(bool *hour_24H_format, SettingMode_e mode)
{
if(SETTING_MODE_GET == mode)
{
*hour_24H_format = persistency_get_settings()->timeAndDate.time_and_date_hour_format;
}
else
{
watch_settings_time_and_date_set_hour_format(*hour_24H_format);
}
}
static void setDisplayVibrationDuration(uint8_t *duration, SettingMode_e mode) static void setDisplayVibrationDuration(uint8_t *duration, SettingMode_e mode)
{ {
if(SETTING_MODE_GET == mode) if(SETTING_MODE_GET == mode)
@ -278,7 +266,6 @@ static void performFactoryResetCb()
SettingsScreenAPIInterface_t settingsScreenAPIInterface = SettingsScreenAPIInterface_t settingsScreenAPIInterface =
{ {
.setTimeSettingsCb = &(setTimeCb), .setTimeSettingsCb = &(setTimeCb),
.setTimeFormatSettingsCb = &(setTimeFormatCb),
.setBrightnessSettingsCb = &(setGetBrightnessCb), .setBrightnessSettingsCb = &(setGetBrightnessCb),
.setTimeoutSettingsCb = &(setTimeoutCb), .setTimeoutSettingsCb = &(setTimeoutCb),
.setDisplayVibrationDurationSettingsCb = &(setDisplayVibrationDuration), .setDisplayVibrationDurationSettingsCb = &(setDisplayVibrationDuration),

View File

@ -20,9 +20,6 @@ static const char* vibration_force = "1\n2\n3\n4\n5\n6\n7\n8";
static const char* language_options = "Francais\nDeutsch\nEnglish"; static const char* language_options = "Francais\nDeutsch\nEnglish";
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data);
static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *text);
static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item); static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item);
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen); static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen);
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen); static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen);
@ -31,13 +28,7 @@ static void _settings_screen_update_labels_language(SettingsScreen_t * const set
{ {
//Update the header's title //Update the header's title
common_screen_header_update_title(translation_get_word(TRANSLATION_SETTINGS)); common_screen_header_update_title(translation_get_word(TRANSLATION_SETTINGS));
// All items in the menu list // And all other labels
update_menu_list_item_text(settingsScreen->time_and_date_item, translation_get_word(TRANSLATION_TIME_AND_DATE));
update_menu_list_item_text(settingsScreen->display_item, translation_get_word(TRANSLATION_DISPLAY));
update_menu_list_item_text(settingsScreen->notifications_item, translation_get_word(TRANSLATION_NOTIFICATIONS));
update_menu_list_item_text(settingsScreen->connectivity_item, translation_get_word(TRANSLATION_CONNECTIVITY));
update_menu_list_item_text(settingsScreen->language_item, translation_get_word(TRANSLATION_LANGUAGE));
update_menu_list_item_text(settingsScreen->about_item, translation_get_word(TRANSLATION_ABOUT));
} }
static void gesture_event_cb(lv_event_t *e) static void gesture_event_cb(lv_event_t *e)
@ -123,7 +114,6 @@ static void time_roller_cb(lv_event_t *e)
static void time_format_cb(lv_event_t *e) static void time_format_cb(lv_event_t *e)
{ {
SettingsScreen_t *settingsScreen = e->user_data; SettingsScreen_t *settingsScreen = e->user_data;
bool is_24H__hour_format = true;
if(e->target == settingsScreen->checkbox_time_12H) if(e->target == settingsScreen->checkbox_time_12H)
{ {
@ -131,7 +121,6 @@ static void time_format_cb(lv_event_t *e)
lv_obj_clear_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE); lv_obj_clear_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE);
lv_obj_add_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE); lv_obj_add_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE);
lv_obj_clear_state(settingsScreen->checkbox_time_24H, LV_STATE_CHECKED); lv_obj_clear_state(settingsScreen->checkbox_time_24H, LV_STATE_CHECKED);
is_24H__hour_format = false;
} }
else if(e->target == settingsScreen->checkbox_time_24H) else if(e->target == settingsScreen->checkbox_time_24H)
{ {
@ -139,11 +128,7 @@ static void time_format_cb(lv_event_t *e)
lv_obj_clear_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE); lv_obj_clear_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE);
lv_obj_clear_state(settingsScreen->checkbox_time_12H, LV_STATE_CHECKED); lv_obj_clear_state(settingsScreen->checkbox_time_12H, LV_STATE_CHECKED);
lv_obj_add_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE); lv_obj_add_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE);
is_24H__hour_format = true;
} }
if(settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb)
settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb(&is_24H__hour_format, SETTING_MODE_SET);
} }
static void brightness_slider_cb(lv_event_t *e) static void brightness_slider_cb(lv_event_t *e)
@ -251,6 +236,20 @@ static void about_refresh_timer_cb(lv_timer_t *timer)
_set_battery_voltage_to_label(settingsScreen); _set_battery_voltage_to_label(settingsScreen);
} }
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data)
{
lv_obj_t *btn = lv_list_add_btn(list, NULL, text);
lv_obj_t *label = lv_obj_get_child(btn, 0);
if(label)
{
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
lv_obj_set_style_pad_right(btn, 0, LV_PART_MAIN);
}
lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, user_data);
return btn;
}
static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen) static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
{ {
lv_obj_clean(settingsScreen->side_screen); lv_obj_clean(settingsScreen->side_screen);
@ -299,8 +298,6 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
lv_label_set_text_static(label, "Time Format :"); lv_label_set_text_static(label, "Time Format :");
lv_obj_align_to(label, settingsScreen->hour_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10); lv_obj_align_to(label, settingsScreen->hour_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
bool is_24H_format = true;
if(settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb)settingsScreen->settingsScreenAPIInterface.setTimeFormatSettingsCb(&is_24H_format, SETTING_MODE_GET);
settingsScreen->checkbox_time_12H = lv_checkbox_create(settingsScreen->side_screen); settingsScreen->checkbox_time_12H = lv_checkbox_create(settingsScreen->side_screen);
lv_checkbox_set_text(settingsScreen->checkbox_time_12H, "12H"); lv_checkbox_set_text(settingsScreen->checkbox_time_12H, "12H");
lv_obj_set_style_radius(settingsScreen->checkbox_time_12H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR); lv_obj_set_style_radius(settingsScreen->checkbox_time_12H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR);
@ -309,21 +306,11 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
settingsScreen->checkbox_time_24H = lv_checkbox_create(settingsScreen->side_screen); settingsScreen->checkbox_time_24H = lv_checkbox_create(settingsScreen->side_screen);
lv_checkbox_set_text(settingsScreen->checkbox_time_24H, "24H"); lv_checkbox_set_text(settingsScreen->checkbox_time_24H, "24H");
lv_obj_add_state(settingsScreen->checkbox_time_24H, LV_STATE_CHECKED);
lv_obj_set_style_radius(settingsScreen->checkbox_time_24H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR); lv_obj_set_style_radius(settingsScreen->checkbox_time_24H, LV_RADIUS_CIRCLE, LV_PART_INDICATOR);
lv_obj_align_to(settingsScreen->checkbox_time_24H, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_RIGHT_TOP, 10, 0); lv_obj_align_to(settingsScreen->checkbox_time_24H, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_RIGHT_TOP, 10, 0);
lv_obj_add_event_cb(settingsScreen->checkbox_time_24H, &(time_format_cb), LV_EVENT_CLICKED, settingsScreen); lv_obj_add_event_cb(settingsScreen->checkbox_time_24H, &(time_format_cb), LV_EVENT_CLICKED, settingsScreen);
if(is_24H_format)
{
lv_obj_add_state(settingsScreen->checkbox_time_24H, LV_STATE_CHECKED);
lv_obj_clear_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE);
}
else
{
lv_obj_add_state(settingsScreen->checkbox_time_12H, LV_STATE_CHECKED);
lv_obj_clear_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE);
}
label = lv_label_create(settingsScreen->side_screen); label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Date :"); lv_label_set_text_static(label, "Date :");
lv_obj_align_to(label, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10); lv_obj_align_to(label, settingsScreen->checkbox_time_12H, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
@ -671,12 +658,12 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
lv_obj_set_scroll_dir(settingsScreen->side_screen, LV_DIR_VER); lv_obj_set_scroll_dir(settingsScreen->side_screen, LV_DIR_VER);
//We add all the menu list items //We add all the menu list items
settingsScreen->time_and_date_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_TIME_AND_DATE), &(menu_list_item_event_handler), settingsScreen); settingsScreen->time_and_date_item = add_menu_list_item(menu_list, "Time & Date", &(menu_list_item_event_handler), settingsScreen);
settingsScreen->display_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_DISPLAY), &(menu_list_item_event_handler), settingsScreen); settingsScreen->display_item = add_menu_list_item(menu_list, "Display", &(menu_list_item_event_handler), settingsScreen);
settingsScreen->notifications_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_NOTIFICATIONS), &(menu_list_item_event_handler), settingsScreen); settingsScreen->notifications_item = add_menu_list_item(menu_list, "Notifications", &(menu_list_item_event_handler), settingsScreen);
settingsScreen->connectivity_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_CONNECTIVITY), &(menu_list_item_event_handler), settingsScreen); settingsScreen->connectivity_item = add_menu_list_item(menu_list, "Connectivity", &(menu_list_item_event_handler), settingsScreen);
settingsScreen->language_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_LANGUAGE), &(menu_list_item_event_handler), settingsScreen); settingsScreen->language_item = add_menu_list_item(menu_list, "Language", &(menu_list_item_event_handler), settingsScreen);
settingsScreen->about_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_ABOUT), &(menu_list_item_event_handler), settingsScreen); settingsScreen->about_item = add_menu_list_item(menu_list, "About", &(menu_list_item_event_handler), settingsScreen);
//We register the event callback to handle gesture //We register the event callback to handle gesture
lv_obj_add_event_cb(settingsScreen->display, &(gesture_event_cb), LV_EVENT_GESTURE, settingsScreen); lv_obj_add_event_cb(settingsScreen->display, &(gesture_event_cb), LV_EVENT_GESTURE, settingsScreen);
@ -764,26 +751,3 @@ static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScree
sprintf(settingsScreen->batteryVoltage.batteryVoltageText, "%u mV", voltage); sprintf(settingsScreen->batteryVoltage.batteryVoltageText, "%u mV", voltage);
lv_label_set_text_static(settingsScreen->batteryVoltage.batteryVoltageLabel, settingsScreen->batteryVoltage.batteryVoltageText); lv_label_set_text_static(settingsScreen->batteryVoltage.batteryVoltageLabel, settingsScreen->batteryVoltage.batteryVoltageText);
} }
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data)
{
lv_obj_t *btn = lv_list_add_btn(list, NULL, text);
lv_obj_t *label = lv_obj_get_child(btn, 0);
if(label)
{
lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
lv_obj_set_style_pad_right(btn, 0, LV_PART_MAIN);
}
lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, user_data);
return btn;
}
static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *text)
{
lv_obj_t *label = lv_obj_get_child(menu_list_item, 0);
if(label)
{
lv_label_set_text(label, text);
}
}

View File

@ -12,7 +12,6 @@ typedef enum SettingMode
typedef struct SettingsScreenAPIInterface typedef struct SettingsScreenAPIInterface
{ {
void (*setTimeSettingsCb)(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *day, uint8_t *month, uint8_t *year, SettingMode_e mode); void (*setTimeSettingsCb)(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *day, uint8_t *month, uint8_t *year, SettingMode_e mode);
void (*setTimeFormatSettingsCb)(bool *hour_24H_format, SettingMode_e mode);
void (*setBrightnessSettingsCb)(uint8_t *brightness, SettingMode_e mode); void (*setBrightnessSettingsCb)(uint8_t *brightness, SettingMode_e mode);
void (*setTimeoutSettingsCb)(uint8_t *timeout, SettingMode_e mode); void (*setTimeoutSettingsCb)(uint8_t *timeout, SettingMode_e mode);
void (*setOrientationSettingsCb)(uint8_t *orientation, SettingMode_e mode); void (*setOrientationSettingsCb)(uint8_t *orientation, SettingMode_e mode);

View File

@ -4,11 +4,6 @@
static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] = static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
{ {
[TRANSLATION_MENU] = {
[TRANSLATION_FRENCH] = "Menu",
[TRANSLATION_GERMAN] = "Menu",
[TRANSLATION_ENGLISH]= "Menu"
},
[TRANSLATION_WATCH] = { [TRANSLATION_WATCH] = {
[TRANSLATION_FRENCH] = "Montre", [TRANSLATION_FRENCH] = "Montre",
[TRANSLATION_GERMAN] = "Uhr", [TRANSLATION_GERMAN] = "Uhr",
@ -34,57 +29,6 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_GERMAN] = "Einstellungen", [TRANSLATION_GERMAN] = "Einstellungen",
[TRANSLATION_ENGLISH]= "Settings" [TRANSLATION_ENGLISH]= "Settings"
}, },
[TRANSLATION_TIME_AND_DATE] = {
[TRANSLATION_FRENCH] = "Date & Heure",
[TRANSLATION_GERMAN] = "Datum & Uhrzeit",
[TRANSLATION_ENGLISH]= "Time & Date"
},
[TRANSLATION_DISPLAY] = {
[TRANSLATION_FRENCH] = "Affichage",
[TRANSLATION_GERMAN] = "Display",
[TRANSLATION_ENGLISH]= "Display"
},
[TRANSLATION_NOTIFICATIONS] = {
[TRANSLATION_FRENCH] = "Notifications",
[TRANSLATION_GERMAN] = "Mitteilungen",
[TRANSLATION_ENGLISH]= "Notifications"
},
[TRANSLATION_CONNECTIVITY] = {
[TRANSLATION_FRENCH] = "Connectivite",
[TRANSLATION_GERMAN] = "Konnektivitat",
[TRANSLATION_ENGLISH]= "Connectivity"
},
[TRANSLATION_LANGUAGE] = {
[TRANSLATION_FRENCH] = "Langue",
[TRANSLATION_GERMAN] = "Sprache",
[TRANSLATION_ENGLISH]= "Language"
},
[TRANSLATION_ABOUT] = {
[TRANSLATION_FRENCH] = "A Propos",
[TRANSLATION_GERMAN] = "Apropos",
[TRANSLATION_ENGLISH]= "About"
},
[TRANSLATION_SET_TIME_AND_DATE] = {
[TRANSLATION_FRENCH] = "Reglage de la\nDate & de l'Heure :",
[TRANSLATION_GERMAN] = "Zeit festlegen :",
[TRANSLATION_ENGLISH]= "Set Time & Date :",
},
[TRANSLATION_AUTOMATIC] = {
[TRANSLATION_FRENCH] = "Automatique",
[TRANSLATION_GERMAN] = "Automatisch",
[TRANSLATION_ENGLISH]= "Automatic",
},
[TRANSLATION_TIME] = {
[TRANSLATION_FRENCH] = "Heure :",
[TRANSLATION_GERMAN] = "Zeit :",
[TRANSLATION_ENGLISH]= "Time :",
},
[TRANSLATION_TIME_FORMAT] = {
[TRANSLATION_FRENCH] = "Format de l'Heure :",
[TRANSLATION_GERMAN] = "Stunden Zahlung :",
[TRANSLATION_ENGLISH]= "Time Format :",
},
}; };
const char *translation_get_word(TranslationWord_e word) const char *translation_get_word(TranslationWord_e word)

View File

@ -12,39 +12,11 @@ typedef enum TranslationLanguage
typedef enum TranslationWord typedef enum TranslationWord
{ {
TRANSLATION_MENU = 0, TRANSLATION_WATCH = 0,
TRANSLATION_WATCH,
TRANSLATION_ALARM, TRANSLATION_ALARM,
TRANSLATION_COMPASS, TRANSLATION_COMPASS,
TRANSLATION_ALTIMETER, TRANSLATION_ALTIMETER,
TRANSLATION_SETTINGS, TRANSLATION_SETTINGS
TRANSLATION_TIME_AND_DATE,
TRANSLATION_DISPLAY,
TRANSLATION_NOTIFICATIONS,
TRANSLATION_CONNECTIVITY,
TRANSLATION_LANGUAGE,
TRANSLATION_ABOUT,
TRANSLATION_SET_TIME_AND_DATE,
TRANSLATION_AUTOMATIC,
TRANSLATION_TIME,
TRANSLATION_TIME_FORMAT,
TRANSLATION_DATE,
TRANSLATION_DATE_FORMAT,
TRANSLATION_BRIGHTNESS,
TRANSLATION_DISPLAY_OFF,
TRANSLATION_SCREEN_ORIENTATION,
TRANSLATION_WAKEUP,
TRANSLATION_VIBRATE_ON_TOUCH,
TRANSLATION_DURATION,
TRANSLATION_STRENGTH,
TRANSLATION_VIBRATE_ON_NOTIFICATIONS,
TRANSLATION_SYSTEM_INFO,
TRANSLATION_FIRMWARE,
TRANSLATION_COMPILE_DATE,
TRANSLATION_RTC,
TRANSLATION_BATTERY_VOLTAGE,
TRANSLATION_FACTORY_RESET,
TRANSLATION_RESET,
} TranslationWord_e; } TranslationWord_e;
const char * translation_get_word(TranslationWord_e word); const char * translation_get_word(TranslationWord_e word);

View File

@ -77,36 +77,11 @@ typedef int int32_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
#endif #endif
#ifdef int64
#undef int64
#endif
typedef long long int64;
#ifdef int64_t
#undef int64_t
#endif
typedef long long int64_t;
#ifdef uint64
#undef uint64
#endif
typedef unsigned long long uint64;
#ifdef uint64_t
#undef uint64_t
#endif
typedef unsigned long long uint64_t;
#ifdef int32 #ifdef int32
#undef int32 #undef int32
#endif #endif
typedef int int32; typedef int int32;
#ifdef int32_t
#undef int32_t
#endif
typedef int int32_t;
#ifdef uint32 #ifdef uint32
#undef uint32 #undef uint32
#endif #endif