Compare commits
5 Commits
4567ca8dd7
...
a8e1d0412e
Author | SHA1 | Date | |
---|---|---|---|
a8e1d0412e | |||
88badff358 | |||
6f8ccb4f6a | |||
eb2c26d85f | |||
42553f737b |
@ -68,12 +68,12 @@ Possible choices :
|
|||||||
||PA_4|I/O|JTAG_SWO/I²C_SDA/PWM4/I²S_BCK/**ADC1**|U/D|**Battery resistor voltage divider output**||
|
||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**||
|
||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||||
|
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||||
||PB_0|**I/O**|PWM0/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|**Battery resistor voltage divider enable**||
|
||PB_0|I/O|PWM0/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|||
|
||||||
||PB_1|**I/O**|PWM1/LSPI_CK/UART3_RX/PSRAM_CS/Touch4|U/D|**Touch Panel IRQ line**||
|
||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_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|||
|
||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_4|I/O|LSPI_CS/UART2_RTS/UART4_TX/PSRAM_D2/Touch7|U/D|||
|
||||||
||PB_5|I/O|LSPI_MOSI/UART2_CTS/UART4_RX/PSRAM_D3/Touch8|U/D|||
|
||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||||
|
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||||
||CAP|I|External capacitor, 4.7µF||||
|
||CAP|I|External capacitor, 4.7µF||||
|
||||||
||PB_6|I/O|UART1_TX/**MMC_CLK**/HSPI_CK/SDIO_CK/Touch9|U/D|**LCD Serial Clock Pin**||
|
||PB_6|I/O|UART1_TX/**MMC_CLK**/HSPI_CK/SDIO_CK/Touch9|U/D|**LCD Serial Clock Pin**||
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
(footprint "FPC-15S-0.5SH_1x15-1MP_P0.50mm_Horizontal" (version 20211014) (generator pcbnew)
|
||||||
|
(layer "F.Cu")
|
||||||
|
(tedit 5D24667B)
|
||||||
|
(descr "Hirose FH12, FFC/FPC connector, FH12-15S-0.5SH, 15 Pins per row")
|
||||||
|
(tags "connector Hirose FH12 horizontal")
|
||||||
|
(attr smd)
|
||||||
|
(fp_text reference "REF**" (at 0 -3.7) (layer "F.SilkS")
|
||||||
|
(effects (font (size 1 1) (thickness 0.15)))
|
||||||
|
(tstamp b5bc10b2-201c-4fbe-9a1c-a3ba6c945540)
|
||||||
|
)
|
||||||
|
(fp_text value "FPC-15S-0.5SH_1x15-1MP_P0.50mm_Horizontal" (at 0 5.6) (layer "F.Fab")
|
||||||
|
(effects (font (size 1 1) (thickness 0.15)))
|
||||||
|
(tstamp ee414998-a284-4f58-a494-523c0e568f07)
|
||||||
|
)
|
||||||
|
(fp_text user "${REFERENCE}" (at 0 3.7) (layer "F.Fab")
|
||||||
|
(effects (font (size 1 1) (thickness 0.15)))
|
||||||
|
(tstamp 66ab36bd-8790-46ab-938f-9907f44d32e5)
|
||||||
|
)
|
||||||
|
(fp_line (start -5.4 2.355) (end -5.4 4.095) (layer "F.SilkS") (width 0.12) (tstamp 1369e67e-620d-4061-b1a0-07f8e816f95e))
|
||||||
|
(fp_line (start 3.91 -1.3) (end 5.4 -1.3) (layer "F.SilkS") (width 0.12) (tstamp 46e0c114-ce64-464a-8c53-077ea1db56e8))
|
||||||
|
(fp_line (start -5.4 -1.3) (end -5.4 -0.325) (layer "F.SilkS") (width 0.12) (tstamp 4aec5c5e-e507-473b-af46-31c162fcb1a1))
|
||||||
|
(fp_line (start 5.4 -1.3) (end 5.4 -0.325) (layer "F.SilkS") (width 0.12) (tstamp 8eacc915-6193-43cb-87ad-08ed07aa8094))
|
||||||
|
(fp_line (start -3.91 -1.3) (end -5.4 -1.3) (layer "F.SilkS") (width 0.12) (tstamp a9f92f11-6bf3-4a82-a19a-669b71d494e0))
|
||||||
|
(fp_line (start 5.4 4.095) (end 5.4 2.355) (layer "F.SilkS") (width 0.12) (tstamp baf29ab7-1c2a-4630-95c9-bfc5a9c69e36))
|
||||||
|
(fp_line (start -3.91 -1.3) (end -3.91 -2.5) (layer "F.SilkS") (width 0.12) (tstamp c72f4cef-5717-4ed7-ac29-574476807f2c))
|
||||||
|
(fp_line (start -5.4 4.1) (end 5.4 4.1) (layer "F.SilkS") (width 0.12) (tstamp da04693d-1955-454a-a747-ec59ced6f776))
|
||||||
|
(fp_line (start -6.8 4.9) (end 6.8 4.9) (layer "F.CrtYd") (width 0.05) (tstamp 0d473d5b-04ab-41c2-a2c6-0997d4da58e3))
|
||||||
|
(fp_line (start 6.8 -3) (end -6.8 -3) (layer "F.CrtYd") (width 0.05) (tstamp 34f5c3dd-4c6a-4940-b82e-589d7643c815))
|
||||||
|
(fp_line (start 6.8 4.9) (end 6.8 -3) (layer "F.CrtYd") (width 0.05) (tstamp a235d6c1-a18a-425e-9210-aa79faffd5c3))
|
||||||
|
(fp_line (start -6.8 -3) (end -6.8 4.9) (layer "F.CrtYd") (width 0.05) (tstamp fef6b579-1bb4-4346-af57-847831d48621))
|
||||||
|
(fp_line (start 0 -1.2) (end 5.3 -1.2) (layer "F.Fab") (width 0.1) (tstamp 127bcd2d-d0eb-49ca-8492-ad564ff4b2e9))
|
||||||
|
(fp_line (start -5.2 3.7) (end -5.2 4.4) (layer "F.Fab") (width 0.1) (tstamp 13f32465-3d61-4ffb-8501-692415d2f451))
|
||||||
|
(fp_line (start -5.2 4.4) (end 0 4.4) (layer "F.Fab") (width 0.1) (tstamp 299c695e-f60b-4678-915b-dee0404cd1ff))
|
||||||
|
(fp_line (start 5.3 -1.2) (end 5.3 3.4) (layer "F.Fab") (width 0.1) (tstamp 3a89c3a5-9bff-4044-9a6b-34e20f3acfdb))
|
||||||
|
(fp_line (start 4.7 3.4) (end 4.7 3.7) (layer "F.Fab") (width 0.1) (tstamp 4a8fc7db-abd3-481a-ba07-8e3ec3d6c4f0))
|
||||||
|
(fp_line (start -4.7 3.7) (end -5.2 3.7) (layer "F.Fab") (width 0.1) (tstamp 8df7491e-dbe2-410d-b6b8-25a22a9de97f))
|
||||||
|
(fp_line (start -5.3 3.4) (end -4.7 3.4) (layer "F.Fab") (width 0.1) (tstamp 9990654e-13cc-4582-9e23-a8949f5ef831))
|
||||||
|
(fp_line (start -5.3 -1.2) (end -5.3 3.4) (layer "F.Fab") (width 0.1) (tstamp ab8b3189-f270-4e2b-aeda-fd68d6f5744b))
|
||||||
|
(fp_line (start 5.3 3.4) (end 4.7 3.4) (layer "F.Fab") (width 0.1) (tstamp adda0b78-b9f1-4758-b532-3e15b63fd858))
|
||||||
|
(fp_line (start 4.7 3.7) (end 5.2 3.7) (layer "F.Fab") (width 0.1) (tstamp ba2f93ff-1b8f-468d-9f75-3173dca18f88))
|
||||||
|
(fp_line (start 5.2 4.4) (end 0 4.4) (layer "F.Fab") (width 0.1) (tstamp c0c3c950-0946-4187-9042-e9987501a39f))
|
||||||
|
(fp_line (start -4.7 3.4) (end -4.7 3.7) (layer "F.Fab") (width 0.1) (tstamp d67fc989-8288-4efd-bfcd-db74571abba1))
|
||||||
|
(fp_line (start 3 -1.2) (end 3.5 -0.492893) (layer "F.Fab") (width 0.1) (tstamp e14d9ed5-886a-4d43-bcbf-fe2b15d98aaa))
|
||||||
|
(fp_line (start 3.5 -0.492893) (end 4 -1.2) (layer "F.Fab") (width 0.1) (tstamp e8f5e902-5f0a-4ba3-b7c0-984ddee6002b))
|
||||||
|
(fp_line (start 5.2 3.7) (end 5.2 4.4) (layer "F.Fab") (width 0.1) (tstamp ee813948-95ea-486e-9ee0-034b06811f33))
|
||||||
|
(fp_line (start 0 -1.2) (end -5.3 -1.2) (layer "F.Fab") (width 0.1) (tstamp fc486d8f-7d57-44cb-b0fb-cec7208f5f9a))
|
||||||
|
(pad "1" smd rect (at 3.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2cec22e6-804d-46fd-a0b6-cf034364c1dc))
|
||||||
|
(pad "2" smd rect (at 3 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp c92caf45-ba0d-4ca9-ac29-f42510ba5f2d))
|
||||||
|
(pad "3" smd rect (at 2.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 0503af29-6d69-4e5e-b7b2-c3ea161d366a))
|
||||||
|
(pad "4" smd rect (at 2 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8455f856-ccf6-4658-a2e7-c293ede45ea3))
|
||||||
|
(pad "5" smd rect (at 1.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp a87e9010-dfc5-4fa5-9aab-48491e9f0cf8))
|
||||||
|
(pad "6" smd rect (at 1 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 34633c2a-320b-4e14-a694-c8dcdcf71974))
|
||||||
|
(pad "7" smd rect (at 0.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp ba101e85-2b88-4f11-9b17-15e842b0ef10))
|
||||||
|
(pad "8" smd rect (at 0 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 88f257bd-97aa-4133-afbc-6d8294ff9755))
|
||||||
|
(pad "9" smd rect (at -0.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 497c4e78-4d61-4a2c-94f4-21129351c1b1))
|
||||||
|
(pad "10" smd rect (at -1 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp f24ddabf-d597-4cd2-8fef-73d71a4f3d02))
|
||||||
|
(pad "11" smd rect (at -1.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 65a1384c-1ebd-46ff-8545-01d37495bba4))
|
||||||
|
(pad "12" smd rect (at -2 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp dae3e5e5-78b0-44bf-902c-cb3cbb31e634))
|
||||||
|
(pad "13" smd rect (at -2.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp bf286616-6330-4539-b27c-9a6c58149f28))
|
||||||
|
(pad "14" smd rect (at -3 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 5cf24e69-5cd7-4004-9713-c74766569aa7))
|
||||||
|
(pad "15" smd rect (at -3.5 -1.85) (size 0.3 1.3) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 792c1427-da34-4a93-b84e-8dec86488551))
|
||||||
|
(pad "MP" smd rect (at -5.15 1.05) (size 1.8 2.2) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7b757bca-6dfb-410c-a339-5c7b61c77e8b))
|
||||||
|
(pad "MP" smd rect (at 5.15 1.05) (size 1.8 2.2) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp d22723f9-a414-4517-9783-eeec9b660804))
|
||||||
|
(model "${KICAD6_3DMODEL_DIR}/Connector_FFC-FPC.3dshapes/Hirose_FH12-15S-0.5SH_1x15-1MP_P0.50mm_Horizontal.wrl"
|
||||||
|
(offset (xyz 0 0 0))
|
||||||
|
(scale (xyz 1 1 1))
|
||||||
|
(rotate (xyz 0 0 0))
|
||||||
|
)
|
||||||
|
)
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
20900769060649083
|
20903543165665940
|
||||||
Audio_Module
|
Audio_Module
|
||||||
Reverb_BTDR-1H
|
Reverb_BTDR-1H
|
||||||
Digital Reverberation Unit, http://www.belton.co.kr/inc/downfile.php?seq=17&file=pdf (footprint from http://www.uk-electronic.de/PDF/BTDR-1.pdf)
|
Digital Reverberation Unit, http://www.belton.co.kr/inc/downfile.php?seq=17&file=pdf (footprint from http://www.uk-electronic.de/PDF/BTDR-1.pdf)
|
||||||
@ -53613,6 +53613,13 @@ heatsink
|
|||||||
2
|
2
|
||||||
1
|
1
|
||||||
ICs
|
ICs
|
||||||
|
FPC-15S-0.5SH_1x15-1MP_P0.50mm_Horizontal
|
||||||
|
Hirose FH12, FFC/FPC connector, FH12-15S-0.5SH, 15 Pins per row
|
||||||
|
connector Hirose FH12 horizontal
|
||||||
|
0
|
||||||
|
17
|
||||||
|
16
|
||||||
|
ICs
|
||||||
Molex-78171-0002-0
|
Molex-78171-0002-0
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
* @brief lcd touch panel
|
* @brief lcd touch panel
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define LCD_TOUCH_PANEL_IRQ WM_IO_PB_00
|
#define LCD_TOUCH_PANEL_IRQ WM_IO_PB_01
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief debug uart
|
* @brief debug uart
|
||||||
@ -59,4 +59,22 @@
|
|||||||
*/
|
*/
|
||||||
// DEBUG_UART_TX WM_IO_PB_02
|
// DEBUG_UART_TX WM_IO_PB_02
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief battery voltage divider enable pin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define BATTERY_VOLTAGE_DIVIDER_ENABLE WM_IO_PB_05
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief battery voltage adc input pin : WM_IO_PA_04 = channel 1
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define BATTERY_VOLTAGE_ADC_CHANNEL (1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief vibration motor control pin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define VIBRATION_MOTOR_ENABLE WM_IO_PB_03
|
||||||
|
|
||||||
#endif //APPCONFIG_H
|
#endif //APPCONFIG_H
|
@ -5,7 +5,8 @@ ifndef PDIR
|
|||||||
GEN_LIBS = libappdrivers$(LIB_EXT)
|
GEN_LIBS = libappdrivers$(LIB_EXT)
|
||||||
COMPONENTS_libappdrivers = lcd/libappdriverslcd$(LIB_EXT) \
|
COMPONENTS_libappdrivers = lcd/libappdriverslcd$(LIB_EXT) \
|
||||||
mmc_sdio/libappdriversmmc_sdio$(LIB_EXT) \
|
mmc_sdio/libappdriversmmc_sdio$(LIB_EXT) \
|
||||||
i2c/libappdriversi2c$(LIB_EXT)
|
i2c/libappdriversi2c$(LIB_EXT) \
|
||||||
|
watch_peripherals/libappdriverswatch_peripherals$(LIB_EXT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#DEFINES +=
|
#DEFINES +=
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
TOP_DIR = ../../..
|
||||||
|
sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||||
|
|
||||||
|
ifndef PDIR
|
||||||
|
GEN_LIBS = libappdriverswatch_peripherals$(LIB_EXT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
#DEFINES +=
|
||||||
|
|
||||||
|
sinclude $(TOP_DIR)/tools/w800/rules.mk
|
||||||
|
|
||||||
|
INCLUDES := $(INCLUDES) -I $(PDIR)include
|
||||||
|
|
||||||
|
PDIR := ../$(PDIR)
|
||||||
|
sinclude $(PDIR)Makefile
|
@ -0,0 +1,77 @@
|
|||||||
|
#include "watch_peripherals.h"
|
||||||
|
#include "app_config.h"
|
||||||
|
#include "app_log.h"
|
||||||
|
#include "wm_gpio_afsel.h"
|
||||||
|
#include "wm_adc.h"
|
||||||
|
#include "wm_timer.h"
|
||||||
|
#include "wm_pwm.h"
|
||||||
|
|
||||||
|
|
||||||
|
static uint8_t _adc_offset = 0;
|
||||||
|
static uint8_t _vibration_motor_timer_id = WM_TIMER_ID_INVALID;
|
||||||
|
|
||||||
|
static void vibration_motor_timer_irq_cb(void *p)
|
||||||
|
{
|
||||||
|
(void)p;
|
||||||
|
//tls_gpio_write(VIBRATION_MOTOR_ENABLE, 0);
|
||||||
|
tls_pwm_stop(3);
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
void watch_peripherals_io_init(void)
|
||||||
|
{
|
||||||
|
/* We initialize the ADC input as well as the gpio used to enabled the voltage divider bridge */
|
||||||
|
wm_adc_config(BATTERY_VOLTAGE_ADC_CHANNEL);
|
||||||
|
tls_gpio_cfg(BATTERY_VOLTAGE_DIVIDER_ENABLE, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
||||||
|
tls_gpio_write(BATTERY_VOLTAGE_DIVIDER_ENABLE, 0);
|
||||||
|
|
||||||
|
/* We initialize the output pin for the vibration motor enable pin */
|
||||||
|
/*tls_gpio_cfg(VIBRATION_MOTOR_ENABLE, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING);
|
||||||
|
tls_gpio_write(VIBRATION_MOTOR_ENABLE, 0);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void watch_peripherals_init(uint8_t adcOffset)
|
||||||
|
{
|
||||||
|
watch_peripherals_io_init();
|
||||||
|
_adc_offset = adcOffset;
|
||||||
|
|
||||||
|
/* Prevent multiple init call !*/
|
||||||
|
if(WM_TIMER_ID_INVALID == _vibration_motor_timer_id)
|
||||||
|
{
|
||||||
|
/* Let's initialize the timer w'll use to stop the vibration motor */
|
||||||
|
struct tls_timer_cfg vibration_motor_timer_cfg =
|
||||||
|
{
|
||||||
|
.arg = NULL,
|
||||||
|
.callback = &(vibration_motor_timer_irq_cb),
|
||||||
|
.unit = TLS_TIMER_UNIT_MS,
|
||||||
|
.is_repeat = false,
|
||||||
|
.timeout = 0
|
||||||
|
};
|
||||||
|
_vibration_motor_timer_id = tls_timer_create(&vibration_motor_timer_cfg);
|
||||||
|
|
||||||
|
if(WM_TIMER_ID_INVALID == _vibration_motor_timer_id)
|
||||||
|
APP_LOG_ERROR("Failed to create timer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t watch_peripherals_get_battery_voltage(void)
|
||||||
|
{
|
||||||
|
tls_gpio_write(BATTERY_VOLTAGE_DIVIDER_ENABLE, 1);
|
||||||
|
int batteryVoltage = adc_get_inputVolt(BATTERY_VOLTAGE_ADC_CHANNEL, 1, 1) * 2 + _adc_offset;
|
||||||
|
tls_gpio_write(BATTERY_VOLTAGE_DIVIDER_ENABLE, 0);
|
||||||
|
return batteryVoltage < 0 ? 0 : batteryVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
tls_timer_start(_vibration_motor_timer_id);
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Declares various functions to interract with some of the watch's
|
||||||
|
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
||||||
|
*/
|
||||||
|
#ifndef WATCH_PERIPHERALS_H
|
||||||
|
#define WATCH_PERIPHERALS_H
|
||||||
|
#include "wm_type_def.h"
|
||||||
|
|
||||||
|
void watch_peripherals_io_init(void);
|
||||||
|
|
||||||
|
void watch_peripherals_init(uint8_t adcOffset);
|
||||||
|
|
||||||
|
uint16_t watch_peripherals_get_battery_voltage(void);
|
||||||
|
|
||||||
|
uint8_t watch_peripherals_battery_voltage_to_level(uint16_t voltage);
|
||||||
|
|
||||||
|
void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs);
|
||||||
|
|
||||||
|
#endif //WATCH_PERIPHERALS_H
|
@ -13,6 +13,7 @@
|
|||||||
#include "QMC5883L.h"
|
#include "QMC5883L.h"
|
||||||
#include "BMP280.h"
|
#include "BMP280.h"
|
||||||
#include "bma456w.h"
|
#include "bma456w.h"
|
||||||
|
#include "watch_peripherals.h"
|
||||||
#include "watch_settings.h"
|
#include "watch_settings.h"
|
||||||
|
|
||||||
static void date_time_cb(struct tm * const dateTime)
|
static void date_time_cb(struct tm * const dateTime)
|
||||||
@ -74,10 +75,16 @@ static void setTimeCb(uint8_t hour, uint8_t minute, uint8_t second, uint8_t day,
|
|||||||
tls_set_rtc(&timeToSet);
|
tls_set_rtc(&timeToSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setTimeoutCb(uint8_t timeout)
|
||||||
|
{
|
||||||
|
persistency_get_settings()->display.sleep_timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
SettingsScreenAPIInterface_t settingsScreenAPIInterface =
|
SettingsScreenAPIInterface_t settingsScreenAPIInterface =
|
||||||
{
|
{
|
||||||
.setBrightnessSettingsCb = setBrightnessCb,
|
.setBrightnessSettingsCb = setBrightnessCb,
|
||||||
.setTimeSettingsCb = setTimeCb
|
.setTimeSettingsCb = setTimeCb,
|
||||||
|
.setTimeoutSettingsCb = setTimeoutCb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint16_t angle_with_offset(uint16_t angle, uint16_t offset)
|
static uint16_t angle_with_offset(uint16_t angle, uint16_t offset)
|
||||||
@ -113,12 +120,13 @@ void gfx_task(void *param)
|
|||||||
{
|
{
|
||||||
APP_LOG_TRACE("starting");
|
APP_LOG_TRACE("starting");
|
||||||
|
|
||||||
/* Initialize the lvgl library*/
|
/* Initialize the lvgl library and peripherals (display and input device)*/
|
||||||
lv_init();
|
lv_init();
|
||||||
|
|
||||||
lv_port_disp_init();
|
lv_port_disp_init();
|
||||||
lv_port_indev_init();
|
lv_port_indev_init();
|
||||||
|
|
||||||
|
/* Initialize lvgl screens */
|
||||||
watch_face_init(&watchFace);
|
watch_face_init(&watchFace);
|
||||||
menu_screen_init(&menuScreen);
|
menu_screen_init(&menuScreen);
|
||||||
compass_screen_init(&compassScreen);
|
compass_screen_init(&compassScreen);
|
||||||
@ -233,18 +241,24 @@ void gfx_task(void *param)
|
|||||||
else
|
else
|
||||||
APP_LOG_INFO("BMA456 set pin conf failed");
|
APP_LOG_INFO("BMA456 set pin conf failed");
|
||||||
|
|
||||||
|
watch_peripherals_init(27);
|
||||||
|
|
||||||
/* Once we are done with the initializing steps we
|
/* Once we are done with the initializing steps we
|
||||||
don't forget to turn the backlight on ! */
|
don't forget to turn the backlight on ! */
|
||||||
setBrightness(persistency_get_settings()->display.brightness);
|
setBrightness(persistency_get_settings()->display.brightness);
|
||||||
|
|
||||||
extern LCDConfig_t LCDConfig;
|
extern LCDConfig_t LCDConfig;
|
||||||
|
float temperature = 0;
|
||||||
|
float pressure = 0;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
lv_timer_handler();
|
lv_timer_handler();
|
||||||
tls_os_time_delay(5);
|
tls_os_time_delay(5);
|
||||||
|
|
||||||
if(compass_screen_is_in_use(&compassScreen) && QMC5883L_is_data_available())
|
if(compass_screen_is_in_use(&compassScreen))
|
||||||
|
{
|
||||||
|
if(QMC5883L_is_data_available())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
QMC5883L_MData_t MDataRaw = QMC5883L_get_MFields_raw();
|
QMC5883L_MData_t MDataRaw = QMC5883L_get_MFields_raw();
|
||||||
@ -255,6 +269,10 @@ void gfx_task(void *param)
|
|||||||
compass_screen_set_azimuth(&compassScreen, angle_with_offset(QMC5883L_get_azimuth(MData), 180));
|
compass_screen_set_azimuth(&compassScreen, angle_with_offset(QMC5883L_get_azimuth(MData), 180));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compass_screen_set_temperature(&compassScreen, temperature);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t rslt = bma456w_read_int_status(&int_status, &bma);
|
uint8_t rslt = bma456w_read_int_status(&int_status, &bma);
|
||||||
if(rslt != BMA4_OK)
|
if(rslt != BMA4_OK)
|
||||||
APP_LOG_DEBUG("Failed to read int status");
|
APP_LOG_DEBUG("Failed to read int status");
|
||||||
@ -266,14 +284,18 @@ void gfx_task(void *param)
|
|||||||
|
|
||||||
if(++aliveCounter % 200 == 0)
|
if(++aliveCounter % 200 == 0)
|
||||||
{
|
{
|
||||||
float temp = BMP280_get_temperature();
|
pressure = BMP280_get_pressure(&temperature);
|
||||||
BMP280_trigger_measurement();
|
BMP280_trigger_measurement();
|
||||||
APP_LOG_DEBUG("GFX thread, temp : %0.2f", temp);
|
APP_LOG_DEBUG("GFX thread, temp : %0.2f °C, press : %0.2f hPa, bat : %u mV",
|
||||||
|
temperature,
|
||||||
|
pressure/100,
|
||||||
|
watch_peripherals_get_battery_voltage());
|
||||||
aliveCounter = 0;
|
aliveCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle inactivity periods : */
|
/* Handle inactivity periods : */
|
||||||
if(lv_disp_get_inactive_time(NULL) > 10000)
|
if( persistency_get_settings()->display.sleep_timeout != 0 &&
|
||||||
|
lv_disp_get_inactive_time(NULL) > (persistency_get_settings()->display.sleep_timeout * 1000))
|
||||||
{
|
{
|
||||||
// First, we disable the display backlight and we set all the peripherals in their low power mode
|
// First, we disable the display backlight and we set all the peripherals in their low power mode
|
||||||
setBrightness(0);
|
setBrightness(0);
|
||||||
|
@ -8,8 +8,9 @@ static const char *month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n
|
|||||||
static const char *year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30";
|
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 *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 *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 *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 *second_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 *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";
|
const char *date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||||
|
|
||||||
@ -94,6 +95,17 @@ static void brightness_slider_cb(lv_event_t * e)
|
|||||||
settingsScreen->settingsScreenAPIInterface.setBrightnessSettingsCb(brightness);
|
settingsScreen->settingsScreenAPIInterface.setBrightnessSettingsCb(brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void timeout_roller_cb(lv_event_t * e)
|
||||||
|
{
|
||||||
|
SettingsScreen_t *settingsScreen = e->user_data;
|
||||||
|
if(!settingsScreen->settingsScreenAPIInterface.setTimeoutSettingsCb) return;
|
||||||
|
|
||||||
|
lv_obj_t *roller = lv_event_get_target(e);
|
||||||
|
|
||||||
|
uint8_t timeout = lv_roller_get_selected(roller) * 5;
|
||||||
|
settingsScreen->settingsScreenAPIInterface.setTimeoutSettingsCb(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
static lv_obj_t* add_sidebar_entry_to_menu(lv_obj_t *parent, const char *title, lv_obj_t *menu, lv_obj_t *pageToShow)
|
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);
|
lv_obj_t *container = lv_menu_cont_create(parent);
|
||||||
@ -230,11 +242,11 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
|||||||
lv_roller_set_visible_row_count(settingsScreen->hour_roller, 2);
|
lv_roller_set_visible_row_count(settingsScreen->hour_roller, 2);
|
||||||
lv_obj_add_event_cb(settingsScreen->hour_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->hour_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||||
|
|
||||||
lv_roller_set_options(settingsScreen->minute_roller, minute_options, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(settingsScreen->minute_roller, second_minute_options, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_roller_set_visible_row_count(settingsScreen->minute_roller, 2);
|
lv_roller_set_visible_row_count(settingsScreen->minute_roller, 2);
|
||||||
lv_obj_add_event_cb(settingsScreen->minute_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->minute_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||||
|
|
||||||
lv_roller_set_options(settingsScreen->second_roller, second_options, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(settingsScreen->second_roller, second_minute_options, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_roller_set_visible_row_count(settingsScreen->second_roller, 2);
|
lv_roller_set_visible_row_count(settingsScreen->second_roller, 2);
|
||||||
lv_obj_add_event_cb(settingsScreen->second_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
lv_obj_add_event_cb(settingsScreen->second_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||||
|
|
||||||
@ -297,8 +309,10 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
|||||||
container = create_section_container(section);
|
container = create_section_container(section);
|
||||||
|
|
||||||
lv_obj_t *timeout = lv_roller_create(container);
|
lv_obj_t *timeout = lv_roller_create(container);
|
||||||
lv_roller_set_options(timeout, second_options, LV_ROLLER_MODE_NORMAL);
|
lv_roller_set_options(timeout, timeout_options, LV_ROLLER_MODE_NORMAL);
|
||||||
lv_roller_set_visible_row_count(timeout, 2);
|
lv_roller_set_visible_row_count(timeout, 2);
|
||||||
|
lv_obj_add_event_cb(timeout, &(timeout_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||||
|
|
||||||
lv_obj_t *timeout_label = lv_label_create(container);
|
lv_obj_t *timeout_label = lv_label_create(container);
|
||||||
lv_label_set_text_static(timeout_label, "Second(s)");
|
lv_label_set_text_static(timeout_label, "Second(s)");
|
||||||
lv_obj_set_style_pad_top(timeout_label, 25, LV_PART_MAIN);
|
lv_obj_set_style_pad_top(timeout_label, 25, LV_PART_MAIN);
|
||||||
|
@ -7,6 +7,7 @@ typedef struct SettingsScreenAPIInterface
|
|||||||
{
|
{
|
||||||
void (*setBrightnessSettingsCb)(uint8_t brightness);
|
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 (*setTimeSettingsCb)(uint8_t hour, uint8_t minute, uint8_t second, uint8_t day, uint8_t month, uint8_t year);
|
||||||
|
void (*setTimeoutSettingsCb)(uint8_t timeout);
|
||||||
} SettingsScreenAPIInterface_t;
|
} SettingsScreenAPIInterface_t;
|
||||||
|
|
||||||
typedef struct SettingsScreen
|
typedef struct SettingsScreen
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
static WatchSettings_t watchSettings =
|
static WatchSettings_t watchSettings =
|
||||||
{
|
{
|
||||||
.timeAndDate = {.config = 0},
|
.timeAndDate = {.config = 0},
|
||||||
.display = {.brightness = 255, .sleep_timeout = 10,},
|
.display = {.brightness = 255, .sleep_timeout = 0,},
|
||||||
};
|
};
|
||||||
|
|
||||||
WatchSettings_t *persistency_get_settings(void)
|
WatchSettings_t *persistency_get_settings(void)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "wm_type_def.h"
|
#include "wm_type_def.h"
|
||||||
|
|
||||||
#define ADC_DEST_BUFFER_SIZE 16383//以字为单位
|
#define ADC_DEST_BUFFER_SIZE 16383//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ
|
||||||
|
|
||||||
|
|
||||||
/*ADC Result*/
|
/*ADC Result*/
|
||||||
@ -111,15 +111,15 @@
|
|||||||
#define ADC_INT_TYPE_DMA 1
|
#define ADC_INT_TYPE_DMA 1
|
||||||
#define ADC_INT_TYPE_ADC_COMP 2
|
#define ADC_INT_TYPE_ADC_COMP 2
|
||||||
|
|
||||||
#define ADC_REFERENCE_EXTERNAL 0 //外部参考
|
#define ADC_REFERENCE_EXTERNAL 0 //<EFBFBD>ⲿ<EFBFBD>ο<EFBFBD>
|
||||||
#define ADC_REFERENCE_INTERNAL 1 //内部参考
|
#define ADC_REFERENCE_INTERNAL 1 //<EFBFBD>ڲ<EFBFBD><EFBFBD>ο<EFBFBD>
|
||||||
|
|
||||||
typedef struct adc_st{
|
typedef struct adc_st{
|
||||||
u8 dmachannel;
|
u8 dmachannel;
|
||||||
void (*adc_cb)(int *buf, u16 len);
|
void (*adc_cb)(int *buf, u16 len);
|
||||||
void (*adc_bigger_cb)(int *buf, u16 len);
|
void (*adc_bigger_cb)(int *buf, u16 len);
|
||||||
void (*adc_dma_cb)(int *buf,u16 len);
|
void (*adc_dma_cb)(int *buf,u16 len);
|
||||||
u16 valuelen; /*dma 采样数据长度*/
|
u16 valuelen; /*dma <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>*/
|
||||||
u16 offset;
|
u16 offset;
|
||||||
}ST_ADC;
|
}ST_ADC;
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ int adc_get_interTemp(void);
|
|||||||
*
|
*
|
||||||
* @note None
|
* @note None
|
||||||
*/
|
*/
|
||||||
int adc_get_inputVolt(u8 channel);
|
int adc_get_inputVolt(u8 channel, u8 gain1, u8 gain2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is used to read internal voltage.
|
* @brief This function is used to read internal voltage.
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#include "wm_gpio.h"
|
#include "wm_gpio.h"
|
||||||
#include "app_config.h"
|
#include "app_config.h"
|
||||||
#include "CST816D.h"
|
#include "CST816D.h"
|
||||||
|
#include "watch_peripherals.h"
|
||||||
|
|
||||||
|
#include "app_log.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@ -45,6 +48,21 @@ static void touch_panel_isr(void *arg)
|
|||||||
tls_clr_gpio_irq_status(LCD_TOUCH_PANEL_IRQ);
|
tls_clr_gpio_irq_status(LCD_TOUCH_PANEL_IRQ);
|
||||||
CST816D_read_touch_event(p);
|
CST816D_read_touch_event(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void touch_panel_feedback_cb(struct _lv_indev_drv_t *lv_indev_drv, uint8_t lv_event_code)
|
||||||
|
{
|
||||||
|
(void)lv_indev_drv;
|
||||||
|
|
||||||
|
switch(lv_event_code)
|
||||||
|
{
|
||||||
|
case LV_EVENT_LONG_PRESSED:
|
||||||
|
watch_peripherals_vibrate(255, 200);
|
||||||
|
break;
|
||||||
|
case LV_EVENT_PRESSED:
|
||||||
|
watch_peripherals_vibrate(200, 200);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL FUNCTIONS
|
* GLOBAL FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
@ -83,6 +101,7 @@ void lv_port_indev_init(void)
|
|||||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
indev_drv.read_cb = touchpad_read;
|
indev_drv.read_cb = touchpad_read;
|
||||||
indev_drv.user_data = &CST816D_Touch_Data;
|
indev_drv.user_data = &CST816D_Touch_Data;
|
||||||
|
indev_drv.feedback_cb = &(touch_panel_feedback_cb);
|
||||||
indev_touchpad = lv_indev_drv_register(&indev_drv);
|
indev_touchpad = lv_indev_drv_register(&indev_drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ int adc_get_interTemp(void)
|
|||||||
return adc_temp();
|
return adc_temp();
|
||||||
}
|
}
|
||||||
|
|
||||||
int adc_get_inputVolt(u8 channel)
|
int adc_get_inputVolt(u8 channel, u8 gain1, u8 gain2)
|
||||||
{
|
{
|
||||||
int average = 0;
|
int average = 0;
|
||||||
double voltage = 0.0;
|
double voltage = 0.0;
|
||||||
@ -538,7 +538,7 @@ int adc_get_inputVolt(u8 channel)
|
|||||||
|
|
||||||
tls_adc_init(0, 0);
|
tls_adc_init(0, 0);
|
||||||
tls_adc_reference_sel(ADC_REFERENCE_INTERNAL);
|
tls_adc_reference_sel(ADC_REFERENCE_INTERNAL);
|
||||||
tls_adc_set_pga(1,1);
|
tls_adc_set_pga(gain1, gain2);
|
||||||
tls_adc_set_clk(0x28);
|
tls_adc_set_clk(0x28);
|
||||||
tls_adc_start_with_cpu(channel);
|
tls_adc_start_with_cpu(channel);
|
||||||
|
|
||||||
|
@ -56,8 +56,13 @@ static void timer_anim_cb(lv_timer_t *timer)
|
|||||||
{
|
{
|
||||||
CompassScreen_t *compassScreen = timer->user_data;
|
CompassScreen_t *compassScreen = timer->user_data;
|
||||||
static uint16_t azimuth = 0;
|
static uint16_t azimuth = 0;
|
||||||
|
static float temp = -20;
|
||||||
compass_screen_set_azimuth(compassScreen, azimuth++);
|
compass_screen_set_azimuth(compassScreen, azimuth++);
|
||||||
lv_meter_set_scale_range(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 0, 330, 330, -azimuth-90);
|
compass_screen_set_temperature(compassScreen, temp+=0.09);
|
||||||
|
|
||||||
|
if(temp > 120) temp = -20;
|
||||||
|
|
||||||
|
//lv_meter_set_scale_range(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 0, 330, 330, -azimuth-90);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_cardinal(CompassCardinal_t *cardidanl, const char *cardinalText, lv_color_t textColor, lv_coord_t x, lv_coord_t y, lv_obj_t *parent)
|
static void create_cardinal(CompassCardinal_t *cardidanl, const char *cardinalText, lv_color_t textColor, lv_coord_t x, lv_coord_t y, lv_obj_t *parent)
|
||||||
@ -96,6 +101,7 @@ void compass_screen_init(CompassScreen_t * const compassScreen)
|
|||||||
|
|
||||||
memset(compassScreen, 0, sizeof(CompassScreen_t));
|
memset(compassScreen, 0, sizeof(CompassScreen_t));
|
||||||
strcpy(compassScreen->compassAzimuth.text, "0° N");
|
strcpy(compassScreen->compassAzimuth.text, "0° N");
|
||||||
|
strcpy(compassScreen->compassTemperature.text, "0.00°C");
|
||||||
}
|
}
|
||||||
|
|
||||||
void compass_screen_set_azimuth(CompassScreen_t * const compassScreen, uint16_t azimuth)
|
void compass_screen_set_azimuth(CompassScreen_t * const compassScreen, uint16_t azimuth)
|
||||||
@ -143,6 +149,23 @@ void compass_screen_set_azimuth(CompassScreen_t * const compassScreen, uint16_t
|
|||||||
rotate_cardinal(&compassScreen->westCardinal, azimuth);
|
rotate_cardinal(&compassScreen->westCardinal, azimuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void compass_screen_set_temperature(CompassScreen_t * const compassScreen, float temperature)
|
||||||
|
{
|
||||||
|
if(!compassScreen)
|
||||||
|
{
|
||||||
|
LV_LOG_ERROR("NULL pointer given !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Mandatory, if the screen is not displayed anymore, we should still be able to call this function !
|
||||||
|
if(!compassScreen->display) return;
|
||||||
|
|
||||||
|
//Update the temperature label
|
||||||
|
sprintf(compassScreen->compassTemperature.text, "%.2f°C", temperature);
|
||||||
|
lv_label_set_text_static(compassScreen->compassTemperature.label, compassScreen->compassTemperature.text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void compass_screen_create(CompassScreen_t * const compassScreen)
|
void compass_screen_create(CompassScreen_t * const compassScreen)
|
||||||
{
|
{
|
||||||
if(!compassScreen)
|
if(!compassScreen)
|
||||||
@ -204,8 +227,20 @@ void compass_screen_create(CompassScreen_t * const compassScreen)
|
|||||||
lv_obj_set_style_text_font(compassScreen->compassAzimuth.label, &lv_font_montserrat_28, LV_PART_MAIN);
|
lv_obj_set_style_text_font(compassScreen->compassAzimuth.label, &lv_font_montserrat_28, LV_PART_MAIN);
|
||||||
lv_obj_center(compassScreen->compassAzimuth.label);
|
lv_obj_center(compassScreen->compassAzimuth.label);
|
||||||
|
|
||||||
|
//Temperature label is created here
|
||||||
|
if(compassScreen->compassTemperature.label)
|
||||||
|
{
|
||||||
|
LV_LOG_ERROR("label should be NULL here !");
|
||||||
|
lv_obj_del(compassScreen->compassTemperature.label);
|
||||||
|
compassScreen->compassTemperature.label = NULL;
|
||||||
|
}
|
||||||
|
compassScreen->compassTemperature.label = lv_label_create(compassScreen->display);
|
||||||
|
lv_label_set_text_static(compassScreen->compassTemperature.label, compassScreen->compassTemperature.text);
|
||||||
|
lv_obj_set_style_text_font(compassScreen->compassTemperature.label, &lv_font_montserrat_24, LV_PART_MAIN);
|
||||||
|
lv_obj_align(compassScreen->compassTemperature.label, LV_ALIGN_CENTER, 0, -22);
|
||||||
|
|
||||||
//Add some graduation :
|
//Add some graduation :
|
||||||
if(compassScreen->compassGraduation.meter)
|
/*if(compassScreen->compassGraduation.meter)
|
||||||
{
|
{
|
||||||
LV_LOG_ERROR("meter should be NULL here !");
|
LV_LOG_ERROR("meter should be NULL here !");
|
||||||
lv_obj_del(compassScreen->compassGraduation.meter);
|
lv_obj_del(compassScreen->compassGraduation.meter);
|
||||||
@ -220,7 +255,7 @@ void compass_screen_create(CompassScreen_t * const compassScreen)
|
|||||||
compassScreen->compassGraduation.scale = lv_meter_add_scale(compassScreen->compassGraduation.meter);
|
compassScreen->compassGraduation.scale = lv_meter_add_scale(compassScreen->compassGraduation.meter);
|
||||||
lv_meter_set_scale_ticks(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 12, 1, 0, lv_color_black());
|
lv_meter_set_scale_ticks(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 12, 1, 0, lv_color_black());
|
||||||
lv_meter_set_scale_major_ticks(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 1, 1, 0, lv_color_black(), 11);
|
lv_meter_set_scale_major_ticks(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 1, 1, 0, lv_color_black(), 11);
|
||||||
lv_meter_set_scale_range(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 0, 330, 330, -90);
|
lv_meter_set_scale_range(compassScreen->compassGraduation.meter, compassScreen->compassGraduation.scale, 0, 330, 330, -90);*/
|
||||||
|
|
||||||
if(compassScreen->northMarker)
|
if(compassScreen->northMarker)
|
||||||
{
|
{
|
||||||
@ -272,7 +307,7 @@ void compass_screen_create(CompassScreen_t * const compassScreen)
|
|||||||
lv_obj_add_event_cb(compassScreen->display, &(cleanup_event_cb), LV_EVENT_DELETE, compassScreen);
|
lv_obj_add_event_cb(compassScreen->display, &(cleanup_event_cb), LV_EVENT_DELETE, compassScreen);
|
||||||
|
|
||||||
//To delete
|
//To delete
|
||||||
//lv_timer_create(&(timer_anim_cb), 2, compassScreen);
|
lv_timer_create(&(timer_anim_cb), 2, compassScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compass_screen_destroy(CompassScreen_t * const compassScreen)
|
void compass_screen_destroy(CompassScreen_t * const compassScreen)
|
||||||
@ -285,6 +320,7 @@ void compass_screen_destroy(CompassScreen_t * const compassScreen)
|
|||||||
|
|
||||||
compassScreen->display = NULL;
|
compassScreen->display = NULL;
|
||||||
compassScreen->compassAzimuth.label = NULL;
|
compassScreen->compassAzimuth.label = NULL;
|
||||||
|
compassScreen->compassTemperature.label = NULL;
|
||||||
compassScreen->northCardinal.label = NULL;
|
compassScreen->northCardinal.label = NULL;
|
||||||
compassScreen->eastCardinal.label = NULL;
|
compassScreen->eastCardinal.label = NULL;
|
||||||
compassScreen->southCardinal.label = NULL;
|
compassScreen->southCardinal.label = NULL;
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
typedef struct CompassAzimuthLabel
|
typedef struct CompassLabel
|
||||||
{
|
{
|
||||||
lv_obj_t *label;
|
lv_obj_t *label;
|
||||||
char text[9];
|
char text[9];
|
||||||
} CompassAzimuth_t;
|
} CompassLabel_t;
|
||||||
|
|
||||||
typedef struct CompassCardinal
|
typedef struct CompassCardinal
|
||||||
{
|
{
|
||||||
@ -35,7 +35,8 @@ typedef struct CompassScreen
|
|||||||
lv_obj_t *northMarker;
|
lv_obj_t *northMarker;
|
||||||
lv_obj_t *display;
|
lv_obj_t *display;
|
||||||
|
|
||||||
CompassAzimuth_t compassAzimuth;
|
CompassLabel_t compassAzimuth;
|
||||||
|
CompassLabel_t compassTemperature;
|
||||||
} CompassScreen_t;
|
} CompassScreen_t;
|
||||||
|
|
||||||
/* Initializes the compass screen context object */
|
/* Initializes the compass screen context object */
|
||||||
@ -44,6 +45,9 @@ void compass_screen_init(CompassScreen_t * const compassScreen);
|
|||||||
/* Set the compassAzimuth in degrees to show */
|
/* Set the compassAzimuth in degrees to show */
|
||||||
void compass_screen_set_azimuth(CompassScreen_t * const compassScreen, uint16_t azimuth);
|
void compass_screen_set_azimuth(CompassScreen_t * const compassScreen, uint16_t azimuth);
|
||||||
|
|
||||||
|
/* Set the compassTemperature in degrees celsius to show */
|
||||||
|
void compass_screen_set_temperature(CompassScreen_t * const compassScreen, float temperature);
|
||||||
|
|
||||||
/* Builds the compass screen graphically */
|
/* Builds the compass screen graphically */
|
||||||
void compass_screen_create(CompassScreen_t * const compassScreen);
|
void compass_screen_create(CompassScreen_t * const compassScreen);
|
||||||
|
|
||||||
|
@ -242,3 +242,13 @@ void watch_face_destroy(WatchFace_t * const watchFace)
|
|||||||
watchFace->mediumHand24h.handImg = NULL;
|
watchFace->mediumHand24h.handImg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void watch_face_force_sync(WatchFace_t *const watchFace)
|
||||||
|
{
|
||||||
|
if(!watchFace)
|
||||||
|
{
|
||||||
|
LV_LOG_ERROR("NULL pointer given !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
update_watch_hands_angles(watchFace, 0);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user