Merge branch 'master' of http://82.64.196.164/git/Th3maz1ng/W800_Smart_Watch
This commit is contained in:
commit
b13c2d5459
15
README.md
15
README.md
@ -53,7 +53,7 @@ Possible choices :
|
||||
|------------|----------|------|----------|-------------|--------------|---------|
|
||||
||PB_20|I/O|**UART0_RX**/PWM1/UART1_CTS/I²C_SCL|U/D|**USB/Serial TX flash pin**||
|
||||
||PB_19|I/O|**UART0_TX**/PWM0/UART1_RTS/**I²C_SDA**|U/D|**USB/Serial RX flash pin** and **BMA456, Touch Panel, HMC5883L and BMP280 SDA pins**||
|
||||
||WAKEUP|I|**External Wake Up Pin**|D|**BMA456 IRQ line** and **Touch Panel IRQ line**|The chip is waken up when the pin is HIGH|
|
||||
||WAKEUP|I|**External Wake Up Pin**|D|**BMA456 IRQ line** and **Touch Panel IRQ line** through NAND Gate|The chip is waken up when the pin is HIGH|
|
||||
||RESET|I|Reset Pin|D|**Micro switch** and **USB/Serial RTS pin**||
|
||||
||XTAL_OUT|O|External crystal output||||
|
||||
||XTAL_IN|I|External crystal input||||
|
||||
@ -63,16 +63,16 @@ Possible choices :
|
||||
||AVDD3V3|P|Chip power supply, 3.3V|||
|
||||
||AVDD3V3_AUX|P|Chip power supply, 3.3V||||
|
||||
||TEST|I|Test function configuration pin||||
|
||||
||BOOTMODE|I/O|BOOTMODE and I²S_MCLK/LSPI_CS/PWM2/I²S_DO|U/D|||
|
||||
||BOOTMODE|**I/O**|BOOTMODE and I²S_MCLK/LSPI_CS/PWM2/I²S_DO|U/D|**Touch Panel Reset line**||
|
||||
||PA_1|I/O|JTAG_CK/**I²C_SCL**/PWM3/I²S_LRCK/ADC0|U/D|**BMA456, Touch Panel, HMC5883L and BMP280 SCL pins**||
|
||||
||PA_4|I/O|JTAG_SWO/I²C_SDA/PWM4/I²S_BCK/**ADC1**|U/D|**Battery resistor voltage divider output**||
|
||||
||PA_7|I/O|**PWM4**/LSPI_MOSI/I²S_MCK/I²S_DI/Touch0|U/D|**LCD backlight N-MOSFET driver**||
|
||||
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||
||PB_0|I/O|PWM0/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|||
|
||||
||PB_0|I/O|**PWM0**/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|**Vibration motor control pin**||
|
||||
||PB_1|**I/O**|PWM1/LSPI_CK/UART3_RX/PSRAM_CS/Touch4|U/D|**Touch Panel IRQ line**||
|
||||
||PB_2|I/O|PWM2/LSPI_CK/**UART2_TX**/PSRAM_D0/Touch5|U/D|**Debug UART serial output**||
|
||||
||PB_3|I/O|**PWM3**/LSPI_MISO/UART2_RX/PSRAM_D1/Touch6|U/D|**Vibration motor control pin** ||
|
||||
||PB_4|I/O|LSPI_CS/UART2_RTS/UART4_TX/PSRAM_D2/Touch7|U/D|||
|
||||
||PB_3|**I/O**|PWM3/LSPI_MISO/UART2_RX/PSRAM_D1/Touch6|U/D|**TP4056A Charging Signal**||
|
||||
||PB_4|**I/O**|LSPI_CS/UART2_RTS/UART4_TX/PSRAM_D2/Touch7|U/D|**TP4056A Charged Signal**||
|
||||
||PB_5|**I/O**|LSPI_MOSI/UART2_CTS/UART4_RX/PSRAM_D3/Touch8|U/D|**Battery resistor voltage divider enable**||
|
||||
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||
||CAP|I|External capacitor, 4.7µF||||
|
||||
@ -82,7 +82,7 @@ Possible choices :
|
||||
||PB_9|**I/O**|I²S_LRCK/MMC_D1/HSPI_CS/SDIO_D1/Touch12|U/D|**LCD Reset Pin**||
|
||||
||PB_10|**I/O**|I²S_DI/MMC_D2/HSPI_DI/SDIO_D2|U/D|**LCD Chip Select Pin**||
|
||||
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||
||PB_11|I/O|I²S_DO/MMC_D3/HSPI_DO/SDIO_D3|U/D|||
|
||||
||PB_11|**I/O**|I²S_DO/MMC_D3/HSPI_DO/SDIO_D3|U/D|**BMA456 IRQ 2 line**||
|
||||
||GND|P|Ground (Central Pad)||||
|
||||
|
||||
## What is done/working so far :
|
||||
@ -126,6 +126,7 @@ Possible choices :
|
||||
(Need to work on sleep current :-( )
|
||||
| Mode | Current draw | Estimated battery life (450 mAh lipo) |
|
||||
|--------------------------|--------------|---------------------------------------|
|
||||
|Active (No BLE / No WiFi) |~52 mA | ~8 hour |
|
||||
|Active (40Mhz clk)<br>(No BLE / No WiFi) |~52 mA | ~8 hour |
|
||||
|Active (240Mhz clk)<br>(No BLE / No WiFi) |~72 mA | ~6 hour |
|
||||
|Sleep |~4.5 mA | ~4 days and 4 hours |
|
||||
|Standby |TODO |TODO |
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@
|
||||
#define LCD_DATA_COMMAND WM_IO_PB_08
|
||||
#define LCD_RESET WM_IO_PB_09
|
||||
#define LCD_PWM_BACKLIGHT WM_IO_PA_07
|
||||
#define LCD_PWM_CHANNEL 4
|
||||
#define LCD_PWM_CHANNEL (4)
|
||||
|
||||
/**
|
||||
* @brief lcd touch panel
|
||||
@ -75,6 +75,7 @@
|
||||
* @brief vibration motor control pin
|
||||
*
|
||||
*/
|
||||
#define VIBRATION_MOTOR_ENABLE WM_IO_PB_03
|
||||
#define VIBRATION_MOTOR_ENABLE WM_IO_PB_00
|
||||
#define VIBRATION_MOTOR_PWM_CHANNEL (0)
|
||||
|
||||
#endif //APPCONFIG_H
|
@ -1,4 +1,7 @@
|
||||
#include "i2c.h"
|
||||
#include "wm_gpio.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "app_log.h"
|
||||
#include "CST816D.h"
|
||||
|
||||
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
|
||||
@ -22,3 +25,20 @@ bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data)
|
||||
touch_data->isValid = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CST816D_set_power_mode(void)
|
||||
{
|
||||
tls_gpio_cfg(WM_IO_PA_00, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
||||
|
||||
tls_gpio_write(WM_IO_PA_00, 0);
|
||||
tls_os_time_delay(pdMS_TO_TICKS(5));
|
||||
tls_gpio_write(WM_IO_PA_00, 1);
|
||||
tls_os_time_delay(pdMS_TO_TICKS(50));
|
||||
|
||||
uint8_t data;
|
||||
|
||||
i2c_read_reg(CST816D_I2C_ADDR, 0xA5, &data);
|
||||
|
||||
i2c_write_reg(CST816D_I2C_ADDR, 0xA5, 0x03);
|
||||
APP_LOG_DEBUG("CST 0xA5 : %u", data);
|
||||
}
|
||||
|
@ -56,4 +56,11 @@ typedef struct CST816D_Touch_Data
|
||||
*/
|
||||
bool CST816D_read_touch_event(CST816D_Touch_Data_t * const touch_data);
|
||||
|
||||
/**
|
||||
* @brief Issues a hardware reset of the touch panel.
|
||||
*/
|
||||
void CST816D_hardware_reset(void);
|
||||
|
||||
bool CST816D_set_power_mode(void);
|
||||
|
||||
#endif //CST816D_H
|
@ -222,6 +222,7 @@ void lcd_config_init(LCDConfig_t * const LCDConfig)
|
||||
LCDConfig->LCDChipSelectPin = -1;
|
||||
LCDConfig->LCDDataCommandPin = -1;
|
||||
LCDConfig->LCDResetPin = -1;
|
||||
LCDConfig->LCDOrientation = LCD_ORIENTATION_DEFAULT;
|
||||
|
||||
}
|
||||
|
||||
@ -415,6 +416,41 @@ void lcd_sleep(LCDConfig_t *const LCDConfig, bool state)
|
||||
lcd_set_data_command(LCDConfig, LCD_DATA);
|
||||
}
|
||||
|
||||
void lcd_orientation(LCDConfig_t *const LCDConfig, LCDOrientation_t orientation)
|
||||
{
|
||||
if(!LCDConfig) return;
|
||||
|
||||
//No need to apply the same config again
|
||||
if(orientation == LCDConfig->LCDOrientation || orientation > LCD_ORIENTATION_270) return;
|
||||
|
||||
lcd_set_data_command(LCDConfig, LCD_COMMAND);
|
||||
lcd_set_cs(LCDConfig, LCD_SELECTED);
|
||||
|
||||
mmc_sdio_driver_write_one(0x36);
|
||||
|
||||
lcd_set_data_command(LCDConfig, LCD_DATA);
|
||||
|
||||
LCDConfig->LCDOrientation = orientation;
|
||||
|
||||
switch(orientation)
|
||||
{
|
||||
case LCD_ORIENTATION_90:
|
||||
mmc_sdio_driver_write_one(0xE8);
|
||||
break;
|
||||
case LCD_ORIENTATION_180:
|
||||
mmc_sdio_driver_write_one(0x48);
|
||||
break;
|
||||
case LCD_ORIENTATION_270:
|
||||
mmc_sdio_driver_write_one(0x28);
|
||||
break;
|
||||
default: //Is default orientation eg : 0
|
||||
mmc_sdio_driver_write_one(0x88);
|
||||
}
|
||||
|
||||
lcd_set_cs(LCDConfig, LCD_RELEASED);
|
||||
lcd_set_data_command(LCDConfig, LCD_DATA);
|
||||
}
|
||||
|
||||
static void lcd_write_cmd_data_bytes(LCDConfig_t * const LCDConfig, const uint8_t *cmdAndData, uint32_t dataLengthInBytes)
|
||||
{
|
||||
// Select the slave CS line and tell him that he will receive a command !
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* Used SOC : W800 or W801 */
|
||||
#define W800
|
||||
|
||||
/* Display drive controller */
|
||||
/* Display controller IC */
|
||||
#define ILI9341 0
|
||||
#define ST7789V 1
|
||||
#define GC9A01 2
|
||||
@ -35,6 +35,19 @@ typedef enum LCDSelect
|
||||
*/
|
||||
typedef void (*DrawFinishedCb_t)(void *arg);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
typedef enum LCDOrientation
|
||||
{
|
||||
LCD_ORIENTATION_0 = 0,
|
||||
LCD_ORIENTATION_DEFAULT = LCD_ORIENTATION_0,
|
||||
LCD_ORIENTATION_90,
|
||||
LCD_ORIENTATION_180,
|
||||
LCD_ORIENTATION_270,
|
||||
} LCDOrientation_t;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
@ -49,13 +62,14 @@ typedef struct LCDConfig
|
||||
enum tls_io_name LCDResetPin;
|
||||
DrawFinishedCb_t drawFinishedCb;
|
||||
void *cbArg;
|
||||
LCDOrientation_t LCDOrientation;
|
||||
} LCDConfig_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the LCDConfig object to known values
|
||||
* Must be called before using any other LCD Driver API functions
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
*/
|
||||
void lcd_config_init(LCDConfig_t * const LCDConfig);
|
||||
|
||||
@ -64,7 +78,7 @@ void lcd_config_init(LCDConfig_t * const LCDConfig);
|
||||
* Usually called once the DMA engine is done with the transfer.
|
||||
* /!\ MUST BE CALLED BEFORE lcd_init FUNCTION
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param drawFinishedCb the function to register of the form : void myFunc(void *arg)
|
||||
* @param arg a pointer to an optional argument passed to the callback function
|
||||
*/
|
||||
@ -73,14 +87,14 @@ void lcd_register_draw_finished_cb(LCDConfig_t * const LCDConfig, DrawFinishedCb
|
||||
/**
|
||||
* @brief Initializes IOs using the configured LCDConfig object and the LCD display
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
*/
|
||||
void lcd_init(LCDConfig_t * const LCDConfig);
|
||||
|
||||
/**
|
||||
* @brief Writes the frame to display's internal RAM
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param x
|
||||
* @param y
|
||||
* @param width
|
||||
@ -90,9 +104,9 @@ void lcd_init(LCDConfig_t * const LCDConfig);
|
||||
void lcd_draw_rect_frame(LCDConfig_t * const LCDConfig, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data);
|
||||
|
||||
/**
|
||||
* @brief Sets the backlight to the specified brightness value
|
||||
* @brief Sets the backlight to the specified brightness value (0 to 255)
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param brightness a value from 0 (backlight off) to 255 backlight fully on.
|
||||
*/
|
||||
void lcd_set_backlight(LCDConfig_t * const LCDConfig, uint8_t brightness);
|
||||
@ -100,14 +114,14 @@ void lcd_set_backlight(LCDConfig_t * const LCDConfig, uint8_t brightness);
|
||||
/**
|
||||
* @brief Issues a hardware reset of the lcd display
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
*/
|
||||
void lcd_hardware_reset(LCDConfig_t * const LCDConfig);
|
||||
|
||||
/**
|
||||
* @brief Turns the LCD on or off, /!\ not the same as sleep mode !
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param state true to turn the LCD on or false to turn it off
|
||||
*/
|
||||
void lcd_on(LCDConfig_t * const LCDConfig, bool state);
|
||||
@ -116,9 +130,17 @@ void lcd_on(LCDConfig_t * const LCDConfig, bool state);
|
||||
* @brief Puts the LCD in power down mode (sleep) or power up mode (active)
|
||||
* Sleep mode puts the LCD in it's lowest power state
|
||||
*
|
||||
* @param LCDConfig a pointer a user allocated LCDConfig_t structure
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param state true to put the LCD in sleep mode or false to put it in active mode
|
||||
*/
|
||||
void lcd_sleep(LCDConfig_t * const LCDConfig, bool state);
|
||||
|
||||
/**
|
||||
* @brief Sets the LCD orientation.
|
||||
*
|
||||
* @param LCDConfig a pointer to a user allocated LCDConfig_t structure
|
||||
* @param orientation the value of the orientation to set
|
||||
*/
|
||||
void lcd_orientation(LCDConfig_t * const LCDConfig, LCDOrientation_t orientation);
|
||||
|
||||
#endif //LCD_H
|
@ -14,7 +14,7 @@ static void vibration_motor_timer_irq_cb(void *p)
|
||||
{
|
||||
(void)p;
|
||||
//tls_gpio_write(VIBRATION_MOTOR_ENABLE, 0);
|
||||
tls_pwm_stop(3);
|
||||
tls_pwm_stop(VIBRATION_MOTOR_PWM_CHANNEL);
|
||||
tls_gpio_cfg(VIBRATION_MOTOR_ENABLE, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
||||
tls_gpio_write(VIBRATION_MOTOR_ENABLE, 0);
|
||||
APP_LOG_DEBUG("Vibration stopped");
|
||||
@ -69,9 +69,8 @@ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs)
|
||||
APP_LOG_DEBUG("Vibration started");
|
||||
/* We start the timer which will stop the vibration after durationMs time */
|
||||
tls_timer_change(_vibration_motor_timer_id, durationMs);
|
||||
//tls_gpio_write(VIBRATION_MOTOR_ENABLE, 1);
|
||||
wm_pwm3_config(VIBRATION_MOTOR_ENABLE);
|
||||
tls_pwm_init(3, 10000, 0, 0);
|
||||
tls_pwm_duty_set(3, strength);
|
||||
wm_pwm0_config(VIBRATION_MOTOR_ENABLE);
|
||||
tls_pwm_init(VIBRATION_MOTOR_PWM_CHANNEL, 10000, 0, 0);
|
||||
tls_pwm_duty_set(VIBRATION_MOTOR_PWM_CHANNEL, strength);
|
||||
tls_timer_start(_vibration_motor_timer_id);
|
||||
}
|
||||
|
@ -80,11 +80,21 @@ static void setTimeoutCb(uint8_t timeout)
|
||||
persistency_get_settings()->display.sleep_timeout = timeout;
|
||||
}
|
||||
|
||||
static void setOrientationCb(uint8_t orientation)
|
||||
{
|
||||
extern LCDConfig_t LCDConfig;
|
||||
lcd_orientation(&LCDConfig, orientation);
|
||||
persistency_get_settings()->display.orientation = orientation;
|
||||
// Forces to redraw the full screen to avoid strange artifact
|
||||
lv_obj_invalidate(lv_scr_act());
|
||||
}
|
||||
|
||||
SettingsScreenAPIInterface_t settingsScreenAPIInterface =
|
||||
{
|
||||
.setBrightnessSettingsCb = setBrightnessCb,
|
||||
.setTimeSettingsCb = setTimeCb,
|
||||
.setTimeoutSettingsCb = setTimeoutCb,
|
||||
.setOrientationSettingsCb = setOrientationCb,
|
||||
};
|
||||
|
||||
static uint16_t angle_with_offset(uint16_t angle, uint16_t offset)
|
||||
@ -302,6 +312,7 @@ void gfx_task(void *param)
|
||||
//lcd_on(&LCDConfig, false);
|
||||
lcd_sleep(&LCDConfig, true);
|
||||
QMC5883L_set_power_mode(Standby);
|
||||
CST816D_set_power_mode();
|
||||
// Let's sleep
|
||||
tls_pmu_sleep_start();
|
||||
// On wake up, we force the watch face to sync up with the rtc /!\ RTC update delay WTF ?
|
||||
@ -313,5 +324,27 @@ void gfx_task(void *param)
|
||||
lcd_sleep(&LCDConfig, false);
|
||||
setBrightness(persistency_get_settings()->display.brightness);
|
||||
}
|
||||
|
||||
/* Throttle CPU freq down when inactive to save power or to increase responsiveness */
|
||||
tls_sys_clk clk;
|
||||
tls_sys_clk_get(&clk);
|
||||
if(lv_disp_get_inactive_time(NULL) > 5000)
|
||||
{
|
||||
if(clk.cpuclk != 40)
|
||||
{
|
||||
tls_sys_clk_set(CPU_CLK_40M);
|
||||
APP_LOG_DEBUG("CPU 40Mhz");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(clk.cpuclk != 160)
|
||||
{
|
||||
tls_sys_clk_set(CPU_CLK_160M);
|
||||
APP_LOG_DEBUG("CPU 160Mhz");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -6,13 +6,12 @@
|
||||
static const char *day_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31";
|
||||
static const char *month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
||||
static const char *year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30";
|
||||
|
||||
static const char *hour_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23";
|
||||
static const char *second_minute_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59";
|
||||
static const char *date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||
|
||||
static const char *timeout_options = "0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60";
|
||||
|
||||
const char *date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||
static const char *orientation_format = "Default\n90°\n180°\n270°";
|
||||
|
||||
static void gesture_event_cb(lv_event_t * e)
|
||||
{
|
||||
@ -106,6 +105,18 @@ static void timeout_roller_cb(lv_event_t * e)
|
||||
settingsScreen->settingsScreenAPIInterface.setTimeoutSettingsCb(timeout);
|
||||
}
|
||||
|
||||
static void orientation_dropdown_cb(lv_event_t * e)
|
||||
{
|
||||
SettingsScreen_t *settingsScreen = e->user_data;
|
||||
|
||||
if(!settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb) return;
|
||||
|
||||
lv_obj_t *dropdown = lv_event_get_target(e);
|
||||
uint8_t orientation = lv_dropdown_get_selected(dropdown);
|
||||
|
||||
settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb(orientation);
|
||||
}
|
||||
|
||||
static lv_obj_t* add_sidebar_entry_to_menu(lv_obj_t *parent, const char *title, lv_obj_t *menu, lv_obj_t *pageToShow)
|
||||
{
|
||||
lv_obj_t *container = lv_menu_cont_create(parent);
|
||||
@ -288,7 +299,6 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
||||
lv_obj_t *date_dropdown = lv_dropdown_create(container);
|
||||
lv_dropdown_set_options_static(date_dropdown, date_format);
|
||||
|
||||
|
||||
//We create the menu page for the display settings
|
||||
lv_obj_t *menu_page_2 = lv_menu_page_create(menu, NULL);
|
||||
|
||||
@ -317,6 +327,14 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
||||
lv_label_set_text_static(timeout_label, "Second(s)");
|
||||
lv_obj_set_style_pad_top(timeout_label, 25, LV_PART_MAIN);
|
||||
|
||||
menu_page_label = lv_label_create(section);
|
||||
lv_label_set_text_static(menu_page_label, "Orientation :");
|
||||
container = create_section_container(section);
|
||||
|
||||
lv_obj_t *orientation_dropdown = lv_dropdown_create(container);
|
||||
lv_dropdown_set_options_static(orientation_dropdown, orientation_format);
|
||||
lv_obj_add_event_cb(orientation_dropdown, &(orientation_dropdown_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||
|
||||
//We create the side bar page
|
||||
lv_obj_t *sidebar_page = lv_menu_page_create(menu, NULL);
|
||||
lv_obj_t *settings_section_1 = lv_menu_section_create(sidebar_page);
|
||||
|
@ -8,6 +8,7 @@ typedef struct SettingsScreenAPIInterface
|
||||
void (*setBrightnessSettingsCb)(uint8_t brightness);
|
||||
void (*setTimeSettingsCb)(uint8_t hour, uint8_t minute, uint8_t second, uint8_t day, uint8_t month, uint8_t year);
|
||||
void (*setTimeoutSettingsCb)(uint8_t timeout);
|
||||
void (*setOrientationSettingsCb)(uint8_t orientation);
|
||||
} SettingsScreenAPIInterface_t;
|
||||
|
||||
typedef struct SettingsScreen
|
||||
|
@ -32,14 +32,17 @@ void user_task_main(void *param)
|
||||
TickType_t time_ref = tls_os_get_time();
|
||||
for(;;)
|
||||
{
|
||||
tls_sys_clk clk;
|
||||
tls_sys_clk_get(&clk);
|
||||
char *buf = tls_mem_alloc(800);
|
||||
if(buf)
|
||||
{
|
||||
UBaseType_t writtenSize = vTaskList((char *)buf, 800);
|
||||
APP_LOG_INFO("Available RAM (bytes)/Total RAM (bytes) : %u/%u"NEW_LINE"Reset reason : %d"NEW_LINE"Tasks (%lu) :"NEW_LINE,
|
||||
APP_LOG_INFO("Available RAM (bytes)/Total RAM (bytes) : %u/%u"NEW_LINE"Reset reason : %d"NEW_LINE"Clk : apb(%u), cpu(%u), wlan(%u)"NEW_LINE"Tasks (%lu) :"NEW_LINE,
|
||||
tls_mem_get_avail_heapsize(),
|
||||
total_mem_size,
|
||||
tls_sys_get_reboot_reason(),
|
||||
clk.apbclk, clk.cpuclk, clk.wlanclk,
|
||||
writtenSize);
|
||||
printf("\n%s", buf);
|
||||
tls_mem_free(buf);
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* WatchSetting object with default values */
|
||||
static WatchSettings_t watchSettings =
|
||||
{
|
||||
.timeAndDate = {.config = 0},
|
||||
.timeAndDate = {.hour_format = 0, .date_format = 0, .automatic_time_and_date = 0},
|
||||
.display = {.brightness = 255, .sleep_timeout = 0,},
|
||||
};
|
||||
|
||||
|
@ -3,14 +3,12 @@
|
||||
|
||||
#include "wm_type_def.h"
|
||||
|
||||
#define HOUR_FORMAT(X) ((X) & 0x01)
|
||||
#define DATE_FORMAT(X) (((X) & 0x0E) >> 1)
|
||||
#define AUTOMATIC_TIME_AND_DATE(X) (((X) & 0x10) >> 4)
|
||||
|
||||
/* Time and Date Settings */
|
||||
typedef struct TimeAndDate
|
||||
{
|
||||
uint32_t config;
|
||||
uint32_t hour_format:1;
|
||||
uint32_t date_format:2;
|
||||
uint32_t automatic_time_and_date:1;
|
||||
} TimeAndDate_t;
|
||||
|
||||
/* Display Settings */
|
||||
@ -18,6 +16,7 @@ typedef struct Display
|
||||
{
|
||||
uint8_t brightness;
|
||||
uint8_t sleep_timeout;
|
||||
uint8_t orientation:2;
|
||||
} Display_t;
|
||||
|
||||
/* Connectivity Settings */
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "lv_port_indev.h"
|
||||
#include "wm_gpio.h"
|
||||
#include "app_config.h"
|
||||
#include "lcd.h"
|
||||
#include "CST816D.h"
|
||||
#include "watch_peripherals.h"
|
||||
|
||||
@ -115,6 +116,7 @@ void lv_port_indev_init(void)
|
||||
|
||||
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
extern LCDConfig_t LCDConfig;
|
||||
static lv_coord_t last_x = 0;
|
||||
static lv_coord_t last_y = 0;
|
||||
|
||||
@ -130,9 +132,26 @@ static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
data->state = LV_INDEV_STATE_REL;
|
||||
}
|
||||
|
||||
// Set the last pressed coordinates
|
||||
data->point.x = 239-last_x;
|
||||
data->point.y = 239-last_y;
|
||||
// Set the last pressed coordinates taking into account the current display orientation
|
||||
switch(LCDConfig.LCDOrientation)
|
||||
{
|
||||
case LCD_ORIENTATION_90:
|
||||
data->point.x = 239-last_y;
|
||||
data->point.y = last_x;
|
||||
break;
|
||||
case LCD_ORIENTATION_180:
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
break;
|
||||
case LCD_ORIENTATION_270:
|
||||
data->point.x = last_y;
|
||||
data->point.y = 239-last_x;
|
||||
break;
|
||||
default:
|
||||
data->point.x = 239-last_x;
|
||||
data->point.y = 239-last_y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#else /*Enable this file at the top*/
|
||||
|
Loading…
Reference in New Issue
Block a user