Compare commits
16 Commits
splash_scr
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
636d581bbf | ||
|
03669560b2 | ||
|
8cb925a2dc | ||
|
204c2442e1 | ||
|
f352d498f4 | ||
|
8495d9723d | ||
|
766369fa9d | ||
|
27fe826185 | ||
|
cdc8ab151b | ||
|
f0a6562c99 | ||
|
fe40710b7e | ||
4fd86d28ff | |||
e9f50ca30b | |||
f04b461acb | |||
bd2a19e2a0 | |||
9a472decf1 |
@ -309,8 +309,10 @@ sets a white background, be able to make it also flash with a red background.
|
||||
* Write an alarm app which set an RTC alarm to vibrate the watch.
|
||||
* Write a timer app with countdown and lap functionality.
|
||||
* Implement a battery saving mode activated on low batterie (ie <= 10 %).
|
||||
* This mode would turn bluetooth off
|
||||
* This mode would set the screen brightness to 50 %
|
||||
* This mode would :
|
||||
* turn bluetooth off.
|
||||
* set the screen brightness to 50 %.
|
||||
* throttle the MCU frequency down to 80 or 40 Mhz.
|
||||
|
||||
|
||||
## Done List :
|
||||
|
BIN
documentation/ICs datasheet/CST816D_CH-v3.2-20210427.pdf
Normal file
BIN
documentation/ICs datasheet/CST816D_CH_V1.0.pdf
Normal file
BIN
documentation/ICs datasheet/CST816D_EN-v3.2-20210427.pdf
Normal file
BIN
documentation/ICs datasheet/CST816D_EN_V1.0.pdf
Normal file
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file BMP280.c
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief BMP280 pressure and temperature bosch sensor functions implementation source file.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "i2c.h"
|
||||
#include "BMP280.h"
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file BMP280.h
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief BMP280 pressure and temperature bosch sensor functions API header file.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#ifndef BMP280_H
|
||||
#define BMP280_H
|
||||
|
||||
@ -92,7 +102,7 @@ float BMP280_get_temperature(void);
|
||||
/**
|
||||
* @brief Returns the previously sampled pressure in Pa.
|
||||
*
|
||||
* @param temperature the address of a float which will contain the measured temperature. If not needed, can be NULL.
|
||||
* @param temperature the address of a float which will contain the measured temperature in °C. If not needed, can be NULL.
|
||||
* @return float the value of the pressure in Pa
|
||||
*/
|
||||
float BMP280_get_pressure(float * const temperature);
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file QMC5883L.c
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief QMC5883L magnetometer functions implementation source file.
|
||||
* @version 0.1
|
||||
* @date 2025-03-17
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "i2c.h"
|
||||
#include "QMC5883L.h"
|
||||
@ -45,18 +55,17 @@ bool QMC5883L_software_reset(void)
|
||||
|
||||
float QMC5883L_get_temperature(void)
|
||||
{
|
||||
uint8_t data;
|
||||
uint8_t data[2];
|
||||
int16_t raw_temp;
|
||||
float temperature = 0.0F;
|
||||
|
||||
i2c_read_reg(QMC5883L_I2C_ADDR, QMC5883L_TEMP_MSB_REG, &data);
|
||||
if(i2c_read(QMC5883L_I2C_ADDR, QMC5883L_TEMP_LSB_REG, data, sizeof data))
|
||||
{
|
||||
raw_temp = (data[1] << 8) | data[0];
|
||||
temperature = (float)raw_temp / 100.0F + _calibration_data.temperature_offset;
|
||||
}
|
||||
|
||||
raw_temp = data << 8;
|
||||
|
||||
i2c_read_reg(QMC5883L_I2C_ADDR, QMC5883L_TEMP_LSB_REG, &data);
|
||||
|
||||
raw_temp |= data;
|
||||
|
||||
return (float) raw_temp / 100.0 + _calibration_data.temperature_offset;
|
||||
return temperature;
|
||||
}
|
||||
|
||||
bool QMC5883L_is_data_available(void)
|
||||
@ -96,15 +105,10 @@ QMC5883L_MData_t QMC5883L_get_MFields_raw(void)
|
||||
|
||||
QMC5883L_MData_calibrated_t QMC5883L_get_MFields_calibrated(void)
|
||||
{
|
||||
uint8_t data[6];
|
||||
QMC5883L_MData_calibrated_t Mdata = {.MFieldX = -1, .MFieldY = -1, .MFieldZ = -1};
|
||||
/* Read the raw magnetic field values first */
|
||||
QMC5883L_MData_t raw_data = QMC5883L_get_MFields_raw();
|
||||
|
||||
if(i2c_read(QMC5883L_I2C_ADDR, QMC5883L_DATA_X_LSB_REG, data, sizeof data))
|
||||
{
|
||||
Mdata.MFieldX = (data[1] << 8) | data[0];
|
||||
Mdata.MFieldY = (data[3] << 8) | data[2];
|
||||
Mdata.MFieldZ = (data[5] << 8) | data[4];
|
||||
}
|
||||
QMC5883L_MData_calibrated_t Mdata = {.MFieldX = raw_data.MFieldX, .MFieldY = raw_data.MFieldY, .MFieldZ = raw_data.MFieldZ};
|
||||
|
||||
int x_offset = (_calibration_data.x_min + _calibration_data.x_max) / 2;
|
||||
int y_offset = (_calibration_data.y_min + _calibration_data.y_max) / 2;
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file QMC5883L.h
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief QMC5883L magnetometer functions API header file.
|
||||
* @version 0.1
|
||||
* @date 2025-03-17
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#ifndef QMC5883L_H
|
||||
#define QMC5883L_H
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
/**
|
||||
* @file watch_peripherals.c
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Defines various functions to interract with some of the watch's
|
||||
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#include "watch_peripherals.h"
|
||||
#include "app_config.h"
|
||||
#include "app_log.h"
|
||||
@ -13,6 +24,7 @@
|
||||
#include "CST816D.h"
|
||||
#include "app_utils.h"
|
||||
#include "watch_settings.h"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#define INTERRUPT_POLICY (0)
|
||||
#define POLL_POLICY (1)
|
||||
@ -46,8 +58,10 @@ static battery_controller_status_e _battery_fsm = BATTERY_CONTROLLER_STATUS_DISC
|
||||
static BatteryControllerStatusChangeCb_t _BatteryControllerStatusChangeCb = NULL;
|
||||
|
||||
/* Wakeup source boolean */
|
||||
static bool _wakeup_is_io = false;
|
||||
static bool _wakeup_is_timer = false;
|
||||
static struct
|
||||
{
|
||||
bool is_io:1, is_timer:1, is_rtc_alarm:1;
|
||||
} _wakeup_src = {false, false, false};
|
||||
|
||||
/* BMA456 structure */
|
||||
static struct
|
||||
@ -187,17 +201,25 @@ typedef enum wakeup_source
|
||||
{
|
||||
WAKEUP_SOURCE_IO = 0,
|
||||
WAKEUP_SOURCE_TIMER,
|
||||
WAKEUP_SOURCE_RTC_ALARM,
|
||||
} wakeup_source_e;
|
||||
|
||||
static void pmu_wakeup_source_irq_cb(void *arg)
|
||||
{
|
||||
wakeup_source_e wakeup_source = (wakeup_source_e)arg;
|
||||
|
||||
if(wakeup_source == WAKEUP_SOURCE_IO)
|
||||
_wakeup_is_io = true;
|
||||
|
||||
if(wakeup_source == WAKEUP_SOURCE_TIMER)
|
||||
_wakeup_is_timer = true;
|
||||
switch(wakeup_source)
|
||||
{
|
||||
case WAKEUP_SOURCE_IO:
|
||||
_wakeup_src.is_io = true;
|
||||
break;
|
||||
case WAKEUP_SOURCE_TIMER:
|
||||
_wakeup_src.is_timer = true;
|
||||
break;
|
||||
case WAKEUP_SOURCE_RTC_ALARM:
|
||||
_wakeup_src.is_rtc_alarm = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void watch_peripherals_io_init(void)
|
||||
@ -226,6 +248,7 @@ static void watch_peripherals_io_init(void)
|
||||
/* We register the IRQs needed to determine the watch wake up source/reason */
|
||||
tls_pmu_gpio_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_IO);
|
||||
tls_pmu_timer0_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_TIMER);
|
||||
tls_rtc_isr_register(&(pmu_wakeup_source_irq_cb), (void *)WAKEUP_SOURCE_RTC_ALARM);
|
||||
}
|
||||
|
||||
#ifndef CASE_RETURN_STR
|
||||
@ -464,9 +487,9 @@ void watch_peripherals_set_orientation(LCDOrientation_e orientation)
|
||||
|
||||
bool watch_peripherals_wakeup_source_is_user(void)
|
||||
{
|
||||
if(_wakeup_is_io)
|
||||
if(_wakeup_src.is_io)
|
||||
{
|
||||
_wakeup_is_io = false;
|
||||
_wakeup_src.is_io = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -474,9 +497,19 @@ bool watch_peripherals_wakeup_source_is_user(void)
|
||||
|
||||
bool watch_peripherals_wakeup_source_is_timer(void)
|
||||
{
|
||||
if(_wakeup_is_timer)
|
||||
if(_wakeup_src.is_timer)
|
||||
{
|
||||
_wakeup_is_timer = false;
|
||||
_wakeup_src.is_timer = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool watch_peripherals_wakeup_source_is_rtc_alarm(void)
|
||||
{
|
||||
if(_wakeup_src.is_rtc_alarm)
|
||||
{
|
||||
_wakeup_src.is_rtc_alarm = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -539,9 +572,12 @@ uint16_t watch_peripherals_magnetometer_azimuth_read(bool *is_data_available)
|
||||
return QMC5883L_get_azimuth(MData);
|
||||
}
|
||||
|
||||
QMC5883L_MData_t watch_peripherals_magnetometer_raw_data_read(void)
|
||||
watch_peripherals_axes_t watch_peripherals_magnetometer_raw_data_read(void)
|
||||
{
|
||||
return QMC5883L_get_MFields_raw();
|
||||
QMC5883L_MData_t MData = QMC5883L_get_MFields_raw();
|
||||
|
||||
watch_peripherals_axes_t axes = {.mag.x = MData.MFieldX, .mag.y = MData.MFieldY, .mag.z = MData.MFieldZ};
|
||||
return axes;
|
||||
}
|
||||
|
||||
float watch_peripherals_magnetometer_temperature_read()
|
||||
@ -591,7 +627,8 @@ bool watch_peripherals_pressure_sensor_select_profile(watch_peripherals_pressure
|
||||
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature)
|
||||
{
|
||||
BMP280_trigger_measurement();
|
||||
|
||||
/* Not great but needed to avoid an I2C wait ack err */
|
||||
tls_os_time_delay(pdMS_TO_TICKS(2));
|
||||
while(BMP280_is_measuring());
|
||||
|
||||
return BMP280_get_pressure(temperature);
|
||||
@ -786,6 +823,41 @@ bool watch_peripherals_accelerometer_step_count_reset(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool watch_peripherals_accelerometer_temperature_read(float *temperature)
|
||||
{
|
||||
if(!temperature) return false;
|
||||
|
||||
int32_t raw_temperature;
|
||||
if(bma4_get_temperature(&raw_temperature, BMA4_DEG, &_bma456.bma) != BMA4_OK)
|
||||
{
|
||||
APP_LOG_ERROR("Failed to read temperature");
|
||||
return false;
|
||||
}
|
||||
|
||||
*temperature = raw_temperature / 1000.0F;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool watch_peripherals_accelerometer_accel_read(watch_peripherals_axes_t *axes)
|
||||
{
|
||||
if(!axes)
|
||||
return false;
|
||||
|
||||
struct bma4_accel acceleration = { .x = -1, .y = -1, .z = -1};
|
||||
if(bma4_read_accel_xyz(&acceleration, &_bma456.bma) != BMA4_OK)
|
||||
{
|
||||
APP_LOG_ERROR("Failed to read the acceleration");
|
||||
return false;
|
||||
}
|
||||
|
||||
axes->accel.x = acceleration.x;
|
||||
axes->accel.y = acceleration.y;
|
||||
axes->accel.z = acceleration.z;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void watch_peripherals_watch_sleep(void)
|
||||
{
|
||||
extern LCDConfig_t LCDConfig;
|
||||
|
@ -1,7 +1,14 @@
|
||||
/**
|
||||
* Declares various functions to interract with some of the watch's
|
||||
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
||||
* @file watch_peripherals.h
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Declares various functions to interract with some of the watch's
|
||||
* peripherals like : reading the battery voltage, using the vibration motor etc.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#ifndef WATCH_PERIPHERALS_H
|
||||
#define WATCH_PERIPHERALS_H
|
||||
|
||||
@ -25,6 +32,23 @@ typedef enum battery_controller_status
|
||||
BATTERY_CONTROLLER_STATUS_ERROR
|
||||
} battery_controller_status_e;
|
||||
|
||||
typedef union watch_peripherals_axes
|
||||
{
|
||||
struct
|
||||
{
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
} accel;
|
||||
|
||||
struct
|
||||
{
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
int16_t z;
|
||||
} mag;
|
||||
} watch_peripherals_axes_t;
|
||||
|
||||
typedef void (*BatteryControllerStatusChangeCb_t)(battery_controller_status_e old, battery_controller_status_e new);
|
||||
|
||||
/**
|
||||
@ -142,6 +166,7 @@ void watch_peripherals_set_orientation(LCDOrientation_e orientation);
|
||||
|
||||
/**
|
||||
* @brief Check if the watch woke up because of the user(trigger on the wakeup pin : wrist tilt or touch screen).
|
||||
* Calling this function clears the wakeup source flag.
|
||||
*
|
||||
* @return true if the source of the wakeup is the user
|
||||
* @return false otherwise
|
||||
@ -150,12 +175,22 @@ bool watch_peripherals_wakeup_source_is_user(void);
|
||||
|
||||
/**
|
||||
* @brief Check if the watch woke up because of a timed event (timer 0 of the PMU module).
|
||||
* Calling this function clears the wakeup source flag.
|
||||
*
|
||||
* @return true if the source of the wake up is the timer 0
|
||||
* @return false otherwise
|
||||
*/
|
||||
bool watch_peripherals_wakeup_source_is_timer(void);
|
||||
|
||||
/**
|
||||
* @brief Check if the watch woke up because of a RTC alarm event.
|
||||
* Calling this function clears the wakeup source flag.
|
||||
*
|
||||
* @return true if the source of the wake up is the RTC alarm
|
||||
* @return false otherwise
|
||||
*/
|
||||
bool watch_peripherals_wakeup_source_is_rtc_alarm(void);
|
||||
|
||||
bool watch_peripherals_magnetometer_init(void);
|
||||
|
||||
void watch_peripherals_magnetometer_calibration_data_set(
|
||||
@ -166,7 +201,7 @@ void watch_peripherals_magnetometer_calibration_data_set(
|
||||
|
||||
uint16_t watch_peripherals_magnetometer_azimuth_read(bool *is_data_available);
|
||||
|
||||
QMC5883L_MData_t watch_peripherals_magnetometer_raw_data_read(void);
|
||||
watch_peripherals_axes_t watch_peripherals_magnetometer_raw_data_read(void);
|
||||
|
||||
float watch_peripherals_magnetometer_temperature_read();
|
||||
|
||||
@ -182,6 +217,12 @@ typedef enum watch_peripherals_pressure_sensor_profile
|
||||
|
||||
bool watch_peripherals_pressure_sensor_select_profile(watch_peripherals_pressure_sensor_profile_e profile);
|
||||
|
||||
/**
|
||||
* @brief Returns the measured pressure by the sensor in Pa and temperature in °C.
|
||||
*
|
||||
* @param temperature the address of a float which will contain the measured temperature in °C. If not needed, can be NULL.
|
||||
* @return float the value of the pressure in Pa
|
||||
*/
|
||||
float watch_peripherals_pressure_sensor_get_pressure(float * const temperature);
|
||||
|
||||
bool watch_peripherals_accelerometer_init(void);
|
||||
@ -196,6 +237,24 @@ bool watch_peripherals_accelerometer_step_count_read(uint32_t *step_count);
|
||||
|
||||
bool watch_peripherals_accelerometer_step_count_reset(void);
|
||||
|
||||
/**
|
||||
* @brief Reads the accelerometer's temperature in °C.
|
||||
*
|
||||
* @param temperature the address of a float which will contain the measured temperature in °C.
|
||||
* @return true if the temperature could be retrieved
|
||||
* @return false otherwise
|
||||
*/
|
||||
bool watch_peripherals_accelerometer_temperature_read(float *temperature);
|
||||
|
||||
/**
|
||||
* @brief Reads the accelerometer's acceleration on the X,Y and Z axes.
|
||||
*
|
||||
* @param axes the address of an union of type @ref watch_peripherals_axes_t used to store the values.
|
||||
* @return true if the acceleration could be retrieved
|
||||
* @return false otherwise
|
||||
*/
|
||||
bool watch_peripherals_accelerometer_accel_read(watch_peripherals_axes_t *axes);
|
||||
|
||||
void watch_peripherals_watch_sleep(void);
|
||||
|
||||
#endif //WATCH_PERIPHERALS_H
|
@ -3,6 +3,17 @@
|
||||
|
||||
#include "wm_include.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Macro used to stringify the value of a define.
|
||||
*/
|
||||
#define STRINGIFY_VALUE(x) STRINGIFY(x)
|
||||
|
||||
/**
|
||||
* @brief Macro used to stringify a define.
|
||||
*/
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
/**
|
||||
* @brief Wait for the specified time in micro seconds. This is a blocking function !
|
||||
*
|
||||
|
@ -75,6 +75,9 @@ bool ble_modem_off(void)
|
||||
}
|
||||
};
|
||||
|
||||
// Don't forget to set the rf bt mode to it's default config
|
||||
tls_rf_bt_mode(false);
|
||||
|
||||
status = tls_bt_deinit();
|
||||
|
||||
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY)) {
|
||||
@ -83,8 +86,8 @@ bool ble_modem_off(void)
|
||||
|
||||
if(status != BLE_HS_EALREADY)
|
||||
{
|
||||
//Starting a wifi scan really stops the BT modem ?? Why ? I don't know
|
||||
tls_wifi_scan();
|
||||
// Starting a wifi scan really stops the BT modem ?? Why ? I don't know
|
||||
tls_wifi_passive_scan();
|
||||
}
|
||||
|
||||
return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStopSuccess) ? true : false;
|
||||
|
@ -36,12 +36,22 @@
|
||||
|
||||
/**
|
||||
* @brief Reworked the altimeter app to display the time and date on the altitude screen,
|
||||
* added a PMU related function to start the 32k OSC calibration routine.
|
||||
* Added a PMU related function to start the 32k OSC calibration routine.
|
||||
* Added 'û' and 'Û' characters to the LVGL font.
|
||||
* Other minor changes.
|
||||
*
|
||||
*/
|
||||
#define FIRMWARE_VERSION "0.0.6"
|
||||
//#define FIRMWARE_VERSION "0.0.6"
|
||||
|
||||
/**
|
||||
* @brief Improved BLE start and stop handling (unidentified current leak of 1mA when BLE is turned off fixed)
|
||||
* Added a 3 second timer to show the watch minute and hour hands again after the user decided to hide them.
|
||||
* Reworked the settings screen : added a new sensor category displaying sensor data.
|
||||
* Reworked the settings screen : removed displayed sensor data in the about section and added components versions.
|
||||
* Other minor improvements : some i2c driver enhancement.
|
||||
*
|
||||
*/
|
||||
#define FIRMWARE_VERSION "0.0.7"
|
||||
|
||||
|
||||
#define FIRMWARE_COMPILATION_TIME_DATE (__TIME__" "__DATE__)
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "lv_port_indev.h"
|
||||
#include "lv_port_tick.h"
|
||||
#include "FreeRTOS.h"
|
||||
/* Needed to retrieve FreeRTOS version */
|
||||
#include "task.h"
|
||||
#include "wm_include.h"
|
||||
#include "lcd.h"
|
||||
#include "watch_face.h"
|
||||
@ -379,12 +381,51 @@ static void getBatteryVoltageCb(uint16_t *battery_voltage)
|
||||
|
||||
static void getMagnetometerRawDataCb(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature)
|
||||
{
|
||||
QMC5883L_MData_t raw_data = watch_peripherals_magnetometer_raw_data_read();
|
||||
*field_x = raw_data.MFieldX;
|
||||
*field_y = raw_data.MFieldY;
|
||||
*field_z = raw_data.MFieldZ;
|
||||
if(field_x && field_y && field_z)
|
||||
{
|
||||
watch_peripherals_axes_t axes = watch_peripherals_magnetometer_raw_data_read();
|
||||
*field_x = axes.mag.x;
|
||||
*field_y = axes.mag.y;
|
||||
*field_z = axes.mag.z;
|
||||
}
|
||||
|
||||
*temperature = watch_peripherals_magnetometer_temperature_read();
|
||||
if(temperature)
|
||||
*temperature = watch_peripherals_magnetometer_temperature_read();
|
||||
}
|
||||
|
||||
static void getAccelerometerRawDataCb(int16_t *accel_x, int16_t *accel_y, int16_t *accel_z, float *temperature, uint32_t *step_count)
|
||||
{
|
||||
|
||||
if(accel_x && accel_y && accel_z)
|
||||
{
|
||||
watch_peripherals_axes_t axes;
|
||||
if(!watch_peripherals_accelerometer_accel_read(&axes))
|
||||
{
|
||||
APP_LOG_DEBUG("Failed to read accelerations");
|
||||
}
|
||||
else
|
||||
{
|
||||
*accel_x = axes.accel.x;
|
||||
*accel_y = axes.accel.y;
|
||||
*accel_z = axes.accel.z;
|
||||
}
|
||||
}
|
||||
|
||||
if(temperature)
|
||||
{
|
||||
if(!watch_peripherals_accelerometer_temperature_read(temperature))
|
||||
{
|
||||
APP_LOG_DEBUG("Failed to read accelerometer's temperature");
|
||||
}
|
||||
}
|
||||
|
||||
if(step_count)
|
||||
{
|
||||
if(!watch_peripherals_accelerometer_step_count_read(step_count))
|
||||
{
|
||||
APP_LOG_DEBUG("Failed to read step counts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void getBMP280DataCb(float *temperature, float *pressure)
|
||||
@ -393,6 +434,21 @@ static void getBMP280DataCb(float *temperature, float *pressure)
|
||||
*pressure = watch_peripherals_pressure_sensor_get_pressure(temperature) / 100.0;
|
||||
}
|
||||
|
||||
static void getComponentVersionCb(const char **version, ComponentVersion_e component)
|
||||
{
|
||||
switch(component)
|
||||
{
|
||||
case COMPONENT_FREERTOS:
|
||||
*version = (const char *)STRINGIFY_VALUE(tskKERNEL_VERSION_MAJOR)"."STRINGIFY_VALUE(tskKERNEL_VERSION_MINOR)"."STRINGIFY_VALUE(tskKERNEL_VERSION_BUILD);
|
||||
break;
|
||||
case COMPONENT_LVGL:
|
||||
*version = (const char *)STRINGIFY_VALUE(LVGL_VERSION_MAJOR)"."STRINGIFY_VALUE(LVGL_VERSION_MINOR)"."STRINGIFY_VALUE(LVGL_VERSION_PATCH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void saveSettingsToFlashCb(void)
|
||||
{
|
||||
// Only enable the settings save feature if we compile in SMART_WATCH_PCB_RELEASE mode
|
||||
@ -451,7 +507,9 @@ SettingsScreenAPIInterface_t settingsScreenAPIInterface =
|
||||
.getBLEDevicePairingKeyCb = &(getBLEDevicePairingKeyCb),
|
||||
.getBatteryVoltageCb = &(getBatteryVoltageCb),
|
||||
.getMagnetometerRawDataCb = &(getMagnetometerRawDataCb),
|
||||
.getAccelerometerRawDataCb = &(getAccelerometerRawDataCb),
|
||||
.getBMP280DataCb = &(getBMP280DataCb),
|
||||
.getComponentVersionCb = &(getComponentVersionCb),
|
||||
.saveSettingsCb = &(saveSettingsToFlashCb),
|
||||
.factoryResetCb = &(performFactoryResetCb),
|
||||
};
|
||||
@ -632,13 +690,13 @@ static void settings_screen_on_state_change_cb(SettingsScreenState_e settingsScr
|
||||
switch(settingsScreenState)
|
||||
{
|
||||
case SETTINGS_SCREEN_STATE_OPENED:
|
||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_ABOUT)
|
||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_SENSORS)
|
||||
{
|
||||
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Continuous);
|
||||
}
|
||||
break;
|
||||
case SETTINGS_SCREEN_STATE_CLOSED:
|
||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_ABOUT)
|
||||
if(settingsScreenCategory == SETTINGS_SCREEN_CATEGORY_SENSORS)
|
||||
{
|
||||
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
|
||||
}
|
||||
@ -817,7 +875,8 @@ void gfx_task(void *param)
|
||||
watch_face_register_step_counter_indicator_cb(&watchFace, &(step_count_cb));
|
||||
watch_face_create(&watchFace);
|
||||
|
||||
lv_scr_load(watchFace.display);
|
||||
/* Using this function to load the first screen allows to free the default screen obj */
|
||||
lv_scr_load_anim(watchFace.display, LV_SCR_LOAD_ANIM_NONE, 0U, 0U, true);
|
||||
|
||||
//QMC5883L_set_calibration_data(-900, 2500, -1400, 1400, 2300, 7500, 0.0);
|
||||
|
||||
|
@ -6,19 +6,31 @@
|
||||
#include "translation.h"
|
||||
#include "firmware_version.h"
|
||||
|
||||
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\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40";
|
||||
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";
|
||||
/**
|
||||
* @brief Defines the visual spacing between lines of setting members in a category.
|
||||
*/
|
||||
#define SETTINGS_SCREEN_CATEGORY_SPACING_INNER (3)
|
||||
|
||||
static const char *timeout_options = "Off\n5 seconds\n10 seconds\n15 seconds\n20 seconds\n25 seconds\n30 seconds\n35 seconds\n40 seconds\n45 seconds\n50 seconds\n55 seconds\n60 seconds";
|
||||
static const char *orientation_format = "Default\n90°\n180°\n270°";
|
||||
static const char* vibration_duration = "None\n100 ms\n150 ms\n200 ms\n250 ms\n300 ms\n350 ms\n400 ms";
|
||||
static const char* vibration_strength = "1\n2\n3\n4\n5\n6\n7\n8";
|
||||
/**
|
||||
* @brief Defines the visual spacing between different setting categories.
|
||||
*/
|
||||
#define SETTINGS_SCREEN_CATEGORY_SPACING_OUTER (10)
|
||||
|
||||
static const char* language_options = "Francais\nDeutsch\nEnglish";
|
||||
static const char * const 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 * const month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
||||
static const char * const year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40";
|
||||
static const char * const 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 * const 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 * const date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||
|
||||
static const char * const timeout_options = "Off\n5 seconds\n10 seconds\n15 seconds\n20 seconds\n25 seconds\n30 seconds\n35 seconds\n40 seconds\n45 seconds\n50 seconds\n55 seconds\n60 seconds";
|
||||
static const char * const orientation_format = "Default\n90°\n180°\n270°";
|
||||
static const char * const vibration_duration = "None\n100 ms\n150 ms\n200 ms\n250 ms\n300 ms\n350 ms\n400 ms";
|
||||
static const char * const vibration_strength = "1\n2\n3\n4\n5\n6\n7\n8";
|
||||
|
||||
static const char * const language_options = "Francais\nDeutsch\nEnglish";
|
||||
|
||||
static const char * const default_version = "NaN";
|
||||
|
||||
typedef enum roller_id
|
||||
{
|
||||
@ -42,12 +54,17 @@ typedef enum switch_id
|
||||
|
||||
static lv_obj_t *add_menu_list_item(lv_obj_t *list, const char *text, lv_event_cb_t event_cb, void *user_data, SettingsScreenCategory_e category);
|
||||
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);
|
||||
|
||||
/* Helper functions used to update sensor label data */
|
||||
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_magnetometer_data_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_bmp280_data_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_magnetometer_axes_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_magnetometer_temperature_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_accelerometer_axes_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_accelerometer_steps_and_temperature_to_label(SettingsScreen_t * const settingsScreen);
|
||||
static void _set_pressure_sensor_to_label(SettingsScreen_t * const settingsScreen);
|
||||
|
||||
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen);
|
||||
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show);
|
||||
|
||||
@ -62,6 +79,7 @@ static void _settings_screen_update_labels_language(SettingsScreen_t * const set
|
||||
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->sensors_item, translation_get_word(TRANSLATION_SENSORS));
|
||||
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));
|
||||
}
|
||||
@ -79,7 +97,7 @@ static void gesture_event_cb(lv_event_t *e)
|
||||
case LV_DIR_RIGHT:
|
||||
LV_LOG_USER("GESTURE : RIGHT");
|
||||
// We delete the timer if it was created
|
||||
if(settingsScreen->about_refresh_timer)lv_timer_del(settingsScreen->about_refresh_timer);
|
||||
if(settingsScreen->sensors_refresh_timer)lv_timer_del(settingsScreen->sensors_refresh_timer);
|
||||
// We create the menu screen and switch to it
|
||||
extern MenuScreen_t menuScreen;
|
||||
menu_screen_create(&menuScreen);
|
||||
@ -306,21 +324,26 @@ static void factory_reset_cb(lv_event_t *e)
|
||||
if(settingsScreen->settingsScreenAPIInterface.factoryResetCb) settingsScreen->settingsScreenAPIInterface.factoryResetCb();
|
||||
}
|
||||
|
||||
static void about_refresh_timer_cb(lv_timer_t *timer)
|
||||
static void sensors_refresh_timer_cb(lv_timer_t *timer)
|
||||
{
|
||||
SettingsScreen_t *settingsScreen = timer->user_data;
|
||||
|
||||
if(!settingsScreen->about_refresh_timer) return;
|
||||
|
||||
/* Timer callback is called every 150 ms,
|
||||
some data don't need that update rate */
|
||||
static uint8_t timer_divider = 6;
|
||||
|
||||
if(timer_divider++ == 6)
|
||||
{
|
||||
{
|
||||
_set_rtc_time_to_label(settingsScreen);
|
||||
_set_battery_voltage_to_label(settingsScreen);
|
||||
_set_bmp280_data_to_label(settingsScreen);
|
||||
_set_pressure_sensor_to_label(settingsScreen);
|
||||
_set_magnetometer_temperature_to_label(settingsScreen);
|
||||
_set_accelerometer_steps_and_temperature_to_label(settingsScreen);
|
||||
timer_divider = 0;
|
||||
}
|
||||
_set_magnetometer_data_to_label(settingsScreen);
|
||||
|
||||
_set_magnetometer_axes_to_label(settingsScreen);
|
||||
_set_accelerometer_axes_to_label(settingsScreen);
|
||||
}
|
||||
|
||||
static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
@ -334,7 +357,7 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
||||
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_AUTOMATIC_TIME_ENABLE);
|
||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
bool auto_set_enable = false;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb)settingsScreen->settingsScreenAPIInterface.setAutomaticTimeSettingsCb(&auto_set_enable, SETTING_MODE_GET);
|
||||
if(auto_set_enable)
|
||||
@ -349,7 +372,7 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Time :");
|
||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->hour_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
settingsScreen->minute_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
@ -375,14 +398,14 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
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, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
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);
|
||||
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_align_to(settingsScreen->checkbox_time_12H, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(settingsScreen->checkbox_time_12H, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_event_cb(settingsScreen->checkbox_time_12H, &(time_format_cb), LV_EVENT_CLICKED, settingsScreen);
|
||||
|
||||
settingsScreen->checkbox_time_24H = lv_checkbox_create(settingsScreen->side_screen);
|
||||
@ -404,14 +427,14 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
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, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->day_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
settingsScreen->month_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
settingsScreen->year_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
|
||||
lv_roller_set_options(settingsScreen->day_roller, day_options, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_align_to(settingsScreen->day_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(settingsScreen->day_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_visible_row_count(settingsScreen->day_roller, 2);
|
||||
lv_roller_set_selected(settingsScreen->day_roller, day-1, LV_ANIM_OFF);
|
||||
lv_obj_add_event_cb(settingsScreen->day_roller, &(time_roller_cb), LV_EVENT_RELEASED, settingsScreen);
|
||||
@ -432,11 +455,11 @@ static void load_time_and_date_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Date Format :");
|
||||
lv_obj_align_to(label, settingsScreen->day_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, settingsScreen->day_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *date_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||
lv_dropdown_set_options_static(date_dropdown, date_format);
|
||||
lv_obj_align_to(date_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(date_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
}
|
||||
|
||||
static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
@ -445,7 +468,7 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
lv_label_set_text_static(label, "Brightness :");
|
||||
|
||||
lv_obj_t *slider = lv_slider_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(slider, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 10);
|
||||
lv_obj_align_to(slider, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_clear_flag(slider, LV_OBJ_FLAG_GESTURE_BUBBLE);
|
||||
lv_obj_set_width(slider, lv_pct(90));
|
||||
lv_slider_set_range(slider, 1, 255);
|
||||
@ -456,10 +479,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Display Off After :");
|
||||
lv_obj_align_to(label, slider, LV_ALIGN_OUT_BOTTOM_LEFT, -10, 10);
|
||||
lv_obj_align_to(label, slider, LV_ALIGN_OUT_BOTTOM_LEFT, -10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *timeout_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(timeout_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 10);
|
||||
lv_obj_align_to(timeout_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(timeout_roller, timeout_options, LV_ROLLER_MODE_NORMAL);
|
||||
lv_roller_set_visible_row_count(timeout_roller, 2);
|
||||
uint8_t timeout = 0;
|
||||
@ -469,10 +492,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Screen Orientation :");
|
||||
lv_obj_align_to(label, timeout_roller, LV_ALIGN_OUT_BOTTOM_LEFT, -10, 10);
|
||||
lv_obj_align_to(label, timeout_roller, LV_ALIGN_OUT_BOTTOM_LEFT, -10, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *orientation_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(orientation_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(orientation_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_dropdown_set_options_static(orientation_dropdown, orientation_format);
|
||||
uint8_t orientation = 0;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb)settingsScreen->settingsScreenAPIInterface.setOrientationSettingsCb(&orientation, SETTING_MODE_GET);
|
||||
@ -481,14 +504,14 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Wakeup :");
|
||||
lv_obj_align_to(label, orientation_dropdown, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, orientation_dropdown, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *switch_obj = lv_switch_create(settingsScreen->side_screen);
|
||||
lv_obj_set_user_data(switch_obj, (void *)SWITCH_ID_WRIST_TILT_ENABLE);
|
||||
bool toggled = false;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb)settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb(&toggled, SETTING_MODE_GET);
|
||||
if(toggled)lv_obj_add_state(switch_obj, LV_STATE_CHECKED);
|
||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(switch_obj, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_event_cb(switch_obj, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
@ -497,10 +520,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Vibrate On Touch :");
|
||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, switch_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *on_touch_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_touch_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(on_touch_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(on_touch_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_user_data(on_touch_vibration_duration_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_DURATION);
|
||||
lv_roller_set_visible_row_count(on_touch_vibration_duration_roller, 2);
|
||||
@ -514,7 +537,7 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
lv_obj_align_to(label, on_touch_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
||||
lv_obj_t *on_touch_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_touch_vibration_strength_roller, on_touch_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(on_touch_vibration_strength_roller, on_touch_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(on_touch_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_user_data(on_touch_vibration_strength_roller, (void *)ROLLER_ID_TOUCH_VIBRATION_STRENGTH);
|
||||
lv_roller_set_visible_row_count(on_touch_vibration_strength_roller, 2);
|
||||
@ -532,7 +555,7 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
|
||||
static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
{
|
||||
// Messages notification header text
|
||||
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Messages\nNotifications :");
|
||||
|
||||
// Notification enable switch
|
||||
@ -542,7 +565,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
if(settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb)
|
||||
settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
||||
if(toggled)lv_obj_add_state(notification_enable_switch, LV_STATE_CHECKED);
|
||||
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
@ -551,7 +574,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Vibrate On\nNotifications :");
|
||||
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *on_notification_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_notification_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
@ -569,7 +592,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
lv_obj_align_to(label, on_notification_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
||||
lv_obj_t *on_notification_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_notification_vibration_strength_roller, on_notification_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(on_notification_vibration_strength_roller, on_notification_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(on_notification_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_user_data(on_notification_vibration_strength_roller, (void *)ROLLER_ID_NOTIFICATION_VIBRATION_STRENGTH);
|
||||
lv_roller_set_visible_row_count(on_notification_vibration_strength_roller, 2);
|
||||
@ -587,7 +610,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
//Calls notification header text
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Calls\nNotifications :");
|
||||
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
// Call enable switch
|
||||
lv_obj_t *call_enable_switch = lv_switch_create(settingsScreen->side_screen);
|
||||
@ -596,7 +619,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
if(settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb)
|
||||
settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb(&toggled, SETTING_MODE_GET);
|
||||
if(toggled)lv_obj_add_state(call_enable_switch, LV_STATE_CHECKED);
|
||||
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_event_cb(call_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
@ -605,10 +628,10 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Vibrate On Calls :");
|
||||
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *on_call_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_call_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(on_call_vibration_duration_roller, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(on_call_vibration_duration_roller, vibration_duration, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_user_data(on_call_vibration_duration_roller, (void *)ROLLER_ID_CALL_VIBRATION_DURATION);
|
||||
lv_roller_set_visible_row_count(on_call_vibration_duration_roller, 2);
|
||||
@ -623,7 +646,7 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
lv_obj_align_to(label, on_call_vibration_duration_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
||||
lv_obj_t *on_call_vibration_strength_roller = lv_roller_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(on_call_vibration_strength_roller, on_call_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(on_call_vibration_strength_roller, on_call_vibration_duration_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_roller_set_options(on_call_vibration_strength_roller, vibration_strength, LV_ROLLER_MODE_NORMAL);
|
||||
lv_obj_set_user_data(on_call_vibration_strength_roller, (void *)ROLLER_ID_CALL_VIBRATION_STRENGTH);
|
||||
lv_roller_set_visible_row_count(on_call_vibration_strength_roller, 2);
|
||||
@ -641,45 +664,41 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
||||
{
|
||||
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Connectivity :");
|
||||
|
||||
settingsScreen->ble_switch = lv_switch_create(settingsScreen->side_screen);
|
||||
lv_obj_set_user_data(settingsScreen->ble_switch, (void *)SWITCH_ID_BLE_ENABLE);
|
||||
lv_obj_align_to(settingsScreen->ble_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
bool ble_toggled = false;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setBLEEnabledSettingsCb(&ble_toggled, SETTING_MODE_GET);
|
||||
if(ble_toggled) lv_obj_add_state(settingsScreen->ble_switch, LV_STATE_CHECKED);
|
||||
lv_obj_add_event_cb(settingsScreen->ble_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Bluetooth");
|
||||
lv_obj_align_to(label, settingsScreen->ble_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
||||
|
||||
settingsScreen->ble_pairing_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(settingsScreen->ble_pairing_label, "Pairing Code :");
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
settingsScreen->ble_pairing_key.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->ble_pairing_key.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
settingsScreen->ble_dev_name_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(settingsScreen->ble_dev_name_label, "Device Name :");
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->ble_dev_name_value = lv_label_create(settingsScreen->side_screen);
|
||||
const char * ble_dev_name = NULL;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb) settingsScreen->settingsScreenAPIInterface.getBLEDeviceNameCb(&ble_dev_name);
|
||||
lv_label_set_text_static(settingsScreen->ble_dev_name_value, ble_dev_name);
|
||||
lv_obj_set_style_text_color(settingsScreen->ble_dev_name_value, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->ble_dev_mac_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(settingsScreen->ble_dev_mac_label, "Device MAC :");
|
||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->ble_mac_addr.label = lv_label_create(settingsScreen->side_screen);
|
||||
const uint8_t *ble_dev_mac = NULL;
|
||||
@ -695,11 +714,11 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
||||
}
|
||||
lv_label_set_text_static(settingsScreen->ble_mac_addr.label, settingsScreen->ble_mac_addr.text);
|
||||
lv_obj_set_style_text_color(settingsScreen->ble_mac_addr.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->wifi_switch = lv_switch_create(settingsScreen->side_screen);
|
||||
lv_obj_set_user_data(settingsScreen->wifi_switch, (void *)SWITCH_ID_WIFI_ENABLE);
|
||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
bool wifi_toggled = false;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb)settingsScreen->settingsScreenAPIInterface.setWiFiEnabledSettingsCb(&wifi_toggled, SETTING_MODE_GET);
|
||||
if(wifi_toggled) lv_obj_add_state(settingsScreen->wifi_switch, LV_STATE_CHECKED);
|
||||
@ -714,13 +733,119 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
|
||||
_show_ble_pairing_key(settingsScreen, ble_toggled);
|
||||
}
|
||||
|
||||
static void load_sensors_side_screen(SettingsScreen_t *settingsScreen)
|
||||
{
|
||||
/* First, display the RTC time */
|
||||
lv_obj_t *rtc_time = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(rtc_time, "System Clock :");
|
||||
|
||||
settingsScreen->sensors_labels.clock.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.clock.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.clock.label, rtc_time, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
_set_rtc_time_to_label(settingsScreen);
|
||||
|
||||
/* Let's display the magnetometer data */
|
||||
lv_obj_t *magnetometer_data = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(magnetometer_data, "Magnetometer :");
|
||||
lv_obj_align_to(magnetometer_data, settingsScreen->sensors_labels.clock.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->sensors_labels.magnetometer.x.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.x.label, magnetometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 3);
|
||||
|
||||
settingsScreen->sensors_labels.magnetometer.y.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.y.label, settingsScreen->sensors_labels.magnetometer.x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.magnetometer.z.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.z.label, settingsScreen->sensors_labels.magnetometer.y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.magnetometer.temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.magnetometer.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.magnetometer.temperature.label, settingsScreen->sensors_labels.magnetometer.z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
_set_magnetometer_axes_to_label(settingsScreen);
|
||||
_set_magnetometer_temperature_to_label(settingsScreen);
|
||||
|
||||
lv_obj_update_layout(settingsScreen->sensors_labels.magnetometer.temperature.label);
|
||||
|
||||
lv_obj_t *magnetometer_cal_btn = lv_btn_create(settingsScreen->side_screen);
|
||||
lv_obj_align(magnetometer_cal_btn, LV_ALIGN_TOP_MID, 0, lv_obj_get_y(settingsScreen->sensors_labels.magnetometer.temperature.label) + lv_obj_get_height(settingsScreen->sensors_labels.magnetometer.temperature.label) + SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
lv_obj_t *magnetometer_cal_btn_label = lv_label_create(magnetometer_cal_btn);
|
||||
lv_label_set_text_static(magnetometer_cal_btn_label, "Calibrate");
|
||||
lv_obj_center(magnetometer_cal_btn_label);
|
||||
|
||||
lv_obj_update_layout(magnetometer_cal_btn);
|
||||
|
||||
/* Let's display the accelerometer data */
|
||||
lv_obj_t *accelerometer_data = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(accelerometer_data, "Accelerometer :");
|
||||
lv_obj_align(accelerometer_data, LV_ALIGN_TOP_LEFT, 0, lv_obj_get_y(magnetometer_cal_btn) + lv_obj_get_height(magnetometer_cal_btn) + SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->sensors_labels.accelerometer.x.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.x.label, accelerometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.accelerometer.y.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.y.label, settingsScreen->sensors_labels.accelerometer.x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.accelerometer.z.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.z.label, settingsScreen->sensors_labels.accelerometer.y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.accelerometer.temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.temperature.label, settingsScreen->sensors_labels.accelerometer.z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.accelerometer.steps.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.accelerometer.steps.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.accelerometer.steps.label, settingsScreen->sensors_labels.accelerometer.temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
_set_accelerometer_axes_to_label(settingsScreen);
|
||||
_set_accelerometer_steps_and_temperature_to_label(settingsScreen);
|
||||
|
||||
/* Let's display the pressure sensor data */
|
||||
lv_obj_t *bmp280_data = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(bmp280_data, "Pressure &\nTemperature :");
|
||||
lv_obj_align_to(bmp280_data, settingsScreen->sensors_labels.accelerometer.steps.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->sensors_labels.pressure.pressure.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.pressure.pressure.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.pressure.pressure.label, bmp280_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->sensors_labels.pressure.temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.pressure.temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.pressure.temperature.label, settingsScreen->sensors_labels.pressure.pressure.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
_set_pressure_sensor_to_label(settingsScreen);
|
||||
|
||||
/* Let's display the battery voltage */
|
||||
lv_obj_t *battery_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(battery_label, "Battery Voltage :");
|
||||
lv_obj_align_to(battery_label, settingsScreen->sensors_labels.pressure.temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->sensors_labels.battery_voltage.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->sensors_labels.battery_voltage.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->sensors_labels.battery_voltage.label, battery_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
_set_battery_voltage_to_label(settingsScreen);
|
||||
|
||||
/* Create and start the refresh timer */
|
||||
if(settingsScreen->sensors_refresh_timer)
|
||||
{
|
||||
LV_LOG_ERROR("sensors_refresh_timer should be NULL here !");
|
||||
lv_timer_del(settingsScreen->sensors_refresh_timer);
|
||||
settingsScreen->sensors_refresh_timer = NULL;
|
||||
}
|
||||
settingsScreen->sensors_refresh_timer = lv_timer_create(&(sensors_refresh_timer_cb), 150, settingsScreen);
|
||||
}
|
||||
|
||||
static void load_language_side_screen(SettingsScreen_t *settingsScreen)
|
||||
{
|
||||
settingsScreen->language_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(settingsScreen->language_label, translation_get_word(TRANSLATION_LANGUAGE_2));
|
||||
|
||||
lv_obj_t *language_dropdown = lv_dropdown_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(language_dropdown, settingsScreen->language_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(language_dropdown, settingsScreen->language_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_dropdown_set_options_static(language_dropdown, language_options);
|
||||
uint8_t language = 0;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb)settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb(&language, SETTING_MODE_GET);
|
||||
@ -735,97 +860,64 @@ static void load_about_side_screen(SettingsScreen_t *settingsScreen)
|
||||
|
||||
lv_obj_t *firmware_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(firmware_label, "Firmware :");
|
||||
lv_obj_align_to(firmware_label, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(firmware_label, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *version_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(version_label, FIRMWARE_VERSION);
|
||||
lv_obj_set_style_text_color(version_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(version_label, firmware_label, LV_ALIGN_OUT_RIGHT_MID, 7, 0);
|
||||
|
||||
lv_obj_t* compile_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(compile_label, "Compile date :");
|
||||
lv_obj_align_to(compile_label, firmware_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_t *compile_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(compile_label, "Compile Date :");
|
||||
lv_obj_align_to(compile_label, firmware_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t* compile_date_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_t *compile_date_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(compile_date_label, FIRMWARE_COMPILATION_TIME_DATE);
|
||||
lv_obj_set_style_text_color(compile_date_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(compile_date_label, compile_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(compile_date_label, compile_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
lv_obj_t* rtc_time = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(rtc_time, "RTC :");
|
||||
lv_obj_align_to(rtc_time, compile_date_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
/* Display other firmware component's versions */
|
||||
lv_obj_t *freertos_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(freertos_label, "FreeRTOS Version :");
|
||||
lv_obj_align_to(freertos_label, compile_date_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
/* Display current time and date with refresh */
|
||||
settingsScreen->currentTime.current_time_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->currentTime.current_time_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->currentTime.current_time_label, rtc_time, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
_set_rtc_time_to_label(settingsScreen);
|
||||
lv_obj_t *freertos_version_label = lv_label_create(settingsScreen->side_screen);
|
||||
|
||||
lv_obj_t *magnetometer_data = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(magnetometer_data, "Magnetometer :");
|
||||
lv_obj_align_to(magnetometer_data, settingsScreen->currentTime.current_time_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
const char *freertos_version = default_version;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getComponentVersionCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getComponentVersionCb(&freertos_version, COMPONENT_FREERTOS);
|
||||
|
||||
/* Display the magnetometer raw data with refresh */
|
||||
settingsScreen->magnetometer_x.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->magnetometer_x.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->magnetometer_x.label, magnetometer_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_label_set_text_static(freertos_version_label, freertos_version);
|
||||
|
||||
lv_obj_set_style_text_color(freertos_version_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(freertos_version_label, freertos_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
settingsScreen->magnetometer_y.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->magnetometer_y.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->magnetometer_y.label, settingsScreen->magnetometer_x.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_t *lvgl_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(lvgl_label, "LVGL Version :");
|
||||
lv_obj_align_to(lvgl_label, freertos_version_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
settingsScreen->magnetometer_z.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->magnetometer_z.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->magnetometer_z.label, settingsScreen->magnetometer_y.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_t *lvgl_version_label = lv_label_create(settingsScreen->side_screen);
|
||||
|
||||
settingsScreen->magnetometer_temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->magnetometer_temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->magnetometer_temperature.label, settingsScreen->magnetometer_z.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
_set_magnetometer_data_to_label(settingsScreen);
|
||||
|
||||
lv_obj_t *bmp280_data = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(bmp280_data, "Pressure & temp :");
|
||||
lv_obj_align_to(bmp280_data, settingsScreen->magnetometer_temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
|
||||
/* Display pressure and temperature sensor data with refresh */
|
||||
settingsScreen->bmp280_pressure.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->bmp280_pressure.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->bmp280_pressure.label, bmp280_data, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
|
||||
settingsScreen->bmp280_temperature.label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_obj_set_style_text_color(settingsScreen->bmp280_temperature.label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->bmp280_temperature.label, settingsScreen->bmp280_pressure.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
_set_bmp280_data_to_label(settingsScreen);
|
||||
|
||||
lv_obj_t *battery_label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(battery_label, "Battery Voltage :");
|
||||
lv_obj_align_to(battery_label, settingsScreen->bmp280_temperature.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
|
||||
settingsScreen->batteryVoltage.batteryVoltageLabel = lv_label_create(settingsScreen->side_screen);
|
||||
_set_battery_voltage_to_label(settingsScreen);
|
||||
lv_obj_set_style_text_color(settingsScreen->batteryVoltage.batteryVoltageLabel, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(settingsScreen->batteryVoltage.batteryVoltageLabel, battery_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
const char *lvgl_version = default_version;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getComponentVersionCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getComponentVersionCb(&lvgl_version, COMPONENT_LVGL);
|
||||
|
||||
lv_label_set_text_static(lvgl_version_label, lvgl_version);
|
||||
|
||||
lv_obj_set_style_text_color(lvgl_version_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
|
||||
lv_obj_align_to(lvgl_version_label, lvgl_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
|
||||
label = lv_label_create(settingsScreen->side_screen);
|
||||
lv_label_set_text_static(label, "Factory Reset :");
|
||||
lv_obj_align_to(label, settingsScreen->batteryVoltage.batteryVoltageLabel, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(label, lvgl_version_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
|
||||
lv_obj_t *factory_rst_btn = lv_btn_create(settingsScreen->side_screen);
|
||||
lv_obj_align_to(factory_rst_btn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
lv_obj_align_to(factory_rst_btn, label, LV_ALIGN_OUT_BOTTOM_MID, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_add_event_cb(factory_rst_btn, &(factory_reset_cb), LV_EVENT_CLICKED, settingsScreen);
|
||||
|
||||
label = lv_label_create(factory_rst_btn);
|
||||
lv_label_set_text_static(label, "Reset");
|
||||
lv_obj_center(label);
|
||||
|
||||
/* Create and start the refresh timer */
|
||||
if(settingsScreen->about_refresh_timer)
|
||||
{
|
||||
LV_LOG_ERROR("about_refresh_timer should be NULL here !");
|
||||
lv_timer_del(settingsScreen->about_refresh_timer);
|
||||
settingsScreen->about_refresh_timer = NULL;
|
||||
}
|
||||
settingsScreen->about_refresh_timer = lv_timer_create(&(about_refresh_timer_cb), 150, settingsScreen);
|
||||
}
|
||||
|
||||
static void menu_list_item_event_handler(lv_event_t * e)
|
||||
@ -918,6 +1010,7 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
||||
lv_obj_set_style_radius(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(settingsScreen->side_screen, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_left(settingsScreen->side_screen, 5, LV_PART_MAIN);
|
||||
// Add some padding to make the settings page scroll longer
|
||||
lv_obj_set_style_pad_bottom(settingsScreen->side_screen, 70, LV_PART_MAIN);
|
||||
lv_obj_set_scroll_dir(settingsScreen->side_screen, LV_DIR_VER);
|
||||
|
||||
@ -926,6 +1019,7 @@ void settings_screen_create(SettingsScreen_t * const settingsScreen)
|
||||
settingsScreen->display_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_DISPLAY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_DISPLAY);
|
||||
settingsScreen->notifications_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_NOTIFICATIONS), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_NOTIFICATION);
|
||||
settingsScreen->connectivity_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_CONNECTIVITY), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_CONNECTIVITY);
|
||||
settingsScreen->sensors_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_SENSORS), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_SENSORS);
|
||||
settingsScreen->language_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_LANGUAGE), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_LANGUAGE);
|
||||
settingsScreen->about_item = add_menu_list_item(menu_list, translation_get_word(TRANSLATION_ABOUT), &(menu_list_item_event_handler), settingsScreen, SETTINGS_SCREEN_CATEGORY_ABOUT);
|
||||
|
||||
@ -952,26 +1046,26 @@ void settings_screen_destroy(SettingsScreen_t * const settingsScreen)
|
||||
settingsScreen->settingsScreenOnStateChangeCb(SETTINGS_SCREEN_STATE_CLOSED, (SettingsScreenCategory_e)lv_obj_get_user_data(settingsScreen->last_selected_item));
|
||||
}
|
||||
|
||||
settingsScreen->hour_roller = NULL;
|
||||
settingsScreen->minute_roller = NULL;
|
||||
settingsScreen->second_roller = NULL;
|
||||
settingsScreen->day_roller = NULL;
|
||||
settingsScreen->month_roller = NULL;
|
||||
settingsScreen->year_roller = NULL;
|
||||
settingsScreen->display = NULL;
|
||||
settingsScreen->about_refresh_timer = NULL;
|
||||
settingsScreen->last_selected_item = NULL;
|
||||
settingsScreen->language_label = NULL;
|
||||
settingsScreen->hour_roller = NULL;
|
||||
settingsScreen->minute_roller = NULL;
|
||||
settingsScreen->second_roller = NULL;
|
||||
settingsScreen->day_roller = NULL;
|
||||
settingsScreen->month_roller = NULL;
|
||||
settingsScreen->year_roller = NULL;
|
||||
settingsScreen->display = NULL;
|
||||
settingsScreen->sensors_refresh_timer = NULL;
|
||||
settingsScreen->last_selected_item = NULL;
|
||||
settingsScreen->language_label = NULL;
|
||||
}
|
||||
|
||||
static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item)
|
||||
{
|
||||
if(settingsScreen->last_selected_item == item) return;
|
||||
|
||||
if(settingsScreen->last_selected_item == settingsScreen->about_item)
|
||||
if(settingsScreen->last_selected_item == settingsScreen->sensors_item)
|
||||
{
|
||||
lv_timer_del(settingsScreen->about_refresh_timer);
|
||||
settingsScreen->about_refresh_timer = NULL;
|
||||
lv_timer_del(settingsScreen->sensors_refresh_timer);
|
||||
settingsScreen->sensors_refresh_timer = NULL;
|
||||
}
|
||||
|
||||
// Updating the background of the selected category
|
||||
@ -1017,6 +1111,10 @@ static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsSc
|
||||
{
|
||||
load_connectivity_side_screen(settingsScreen);
|
||||
}
|
||||
else if(item == settingsScreen->sensors_item)
|
||||
{
|
||||
load_sensors_side_screen(settingsScreen);
|
||||
}
|
||||
else if(item == settingsScreen->language_item)
|
||||
{
|
||||
load_language_side_screen(settingsScreen);
|
||||
@ -1029,56 +1127,130 @@ static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsSc
|
||||
|
||||
static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
uint8_t hour = 0, minute = 0, second = 0, day = 0, month = 0, year = 0;
|
||||
uint8_t hour = 0U, minute = 0U, second = 0U, day = 0U, month = 0U, year = 0U;
|
||||
if(settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb)
|
||||
settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb(&hour, &minute, &second, &day, &month, &year, SETTING_MODE_GET);
|
||||
sprintf(settingsScreen->currentTime.current_time_text, "%s%u:%s%u:%s%u %s%u/%s%u/%u",
|
||||
snprintf(settingsScreen->sensors_labels.clock.text,
|
||||
sizeof(settingsScreen->sensors_labels.clock.text)-1, "%s%u:%s%u:%s%u %s%u/%s%u/%u",
|
||||
hour < 10 ? "0":"", hour,
|
||||
minute < 10 ? "0":"", minute,
|
||||
second < 10 ? "0":"", second,
|
||||
day < 10 ? "0":"", day,
|
||||
month + 1 < 10 ? "0":"", month + 1,
|
||||
year+1900);
|
||||
lv_label_set_text_static(settingsScreen->currentTime.current_time_label, settingsScreen->currentTime.current_time_text);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.clock.label, settingsScreen->sensors_labels.clock.text);
|
||||
}
|
||||
|
||||
static void _set_battery_voltage_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
uint16_t voltage = 0;
|
||||
uint16_t voltage = 0U;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb) settingsScreen->settingsScreenAPIInterface.getBatteryVoltageCb(&voltage);
|
||||
sprintf(settingsScreen->batteryVoltage.batteryVoltageText, "%u mV", voltage);
|
||||
lv_label_set_text_static(settingsScreen->batteryVoltage.batteryVoltageLabel, settingsScreen->batteryVoltage.batteryVoltageText);
|
||||
|
||||
snprintf(settingsScreen->sensors_labels.battery_voltage.text,
|
||||
sizeof(settingsScreen->sensors_labels.battery_voltage.text)-1, "%u mV", voltage);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.battery_voltage.label, settingsScreen->sensors_labels.battery_voltage.text);
|
||||
}
|
||||
|
||||
static void _set_magnetometer_data_to_label(SettingsScreen_t * const settingsScreen)
|
||||
static void _set_magnetometer_axes_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
int16_t field_x = 0, field_y = 0, field_z = 0;
|
||||
float temperature = 0.0;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb) settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(&field_x, &field_y, &field_z, &temperature);
|
||||
|
||||
sprintf(settingsScreen->magnetometer_x.text, "x: %d", field_x);
|
||||
lv_label_set_text_static(settingsScreen->magnetometer_x.label, settingsScreen->magnetometer_x.text);
|
||||
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(&field_x,
|
||||
&field_y,
|
||||
&field_z,
|
||||
NULL);
|
||||
snprintf(settingsScreen->sensors_labels.magnetometer.x.text,
|
||||
sizeof(settingsScreen->sensors_labels.magnetometer.x.text)-1,
|
||||
"x: %d", field_x);
|
||||
snprintf(settingsScreen->sensors_labels.magnetometer.y.text,
|
||||
sizeof(settingsScreen->sensors_labels.magnetometer.y.text)-1,
|
||||
"y: %d", field_y);
|
||||
snprintf(settingsScreen->sensors_labels.magnetometer.z.text,
|
||||
sizeof(settingsScreen->sensors_labels.magnetometer.z.text)-1,
|
||||
"z: %d", field_z);
|
||||
|
||||
sprintf(settingsScreen->magnetometer_y.text, "y: %d", field_y);
|
||||
lv_label_set_text_static(settingsScreen->magnetometer_y.label, settingsScreen->magnetometer_y.text);
|
||||
|
||||
sprintf(settingsScreen->magnetometer_z.text, "z: %d", field_z);
|
||||
lv_label_set_text_static(settingsScreen->magnetometer_z.label, settingsScreen->magnetometer_z.text);
|
||||
|
||||
sprintf(settingsScreen->magnetometer_temperature.text, "%.2f °C", temperature);
|
||||
lv_label_set_text_static(settingsScreen->magnetometer_temperature.label, settingsScreen->magnetometer_temperature.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.x.label, settingsScreen->sensors_labels.magnetometer.x.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.y.label, settingsScreen->sensors_labels.magnetometer.y.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.z.label, settingsScreen->sensors_labels.magnetometer.z.text);
|
||||
}
|
||||
|
||||
static void _set_bmp280_data_to_label(SettingsScreen_t * const settingsScreen)
|
||||
static void _set_magnetometer_temperature_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
float pressure = 0.0, temperature = 0.0;
|
||||
float temperature = 0.0f;
|
||||
|
||||
if(settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getMagnetometerRawDataCb(NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&temperature);
|
||||
|
||||
snprintf(settingsScreen->sensors_labels.magnetometer.temperature.text,
|
||||
sizeof(settingsScreen->sensors_labels.magnetometer.temperature.text)-1,
|
||||
"%.2f °C", temperature);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.magnetometer.temperature.label, settingsScreen->sensors_labels.magnetometer.temperature.text);
|
||||
}
|
||||
|
||||
static void _set_accelerometer_axes_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
int16_t accel_x = 0, accel_y = 0, accel_z = 0;
|
||||
|
||||
if(settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb(&accel_x,
|
||||
&accel_y,
|
||||
&accel_z,
|
||||
NULL,
|
||||
NULL);
|
||||
snprintf(settingsScreen->sensors_labels.accelerometer.x.text,
|
||||
sizeof(settingsScreen->sensors_labels.accelerometer.x.text)-1,
|
||||
"x: %d", accel_x);
|
||||
snprintf(settingsScreen->sensors_labels.accelerometer.y.text,
|
||||
sizeof(settingsScreen->sensors_labels.accelerometer.y.text)-1,
|
||||
"y: %d", accel_y);
|
||||
snprintf(settingsScreen->sensors_labels.accelerometer.z.text,
|
||||
sizeof(settingsScreen->sensors_labels.accelerometer.z.text)-1,
|
||||
"z: %d", accel_z);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.x.label, settingsScreen->sensors_labels.accelerometer.x.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.y.label, settingsScreen->sensors_labels.accelerometer.y.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.z.label, settingsScreen->sensors_labels.accelerometer.z.text);
|
||||
}
|
||||
|
||||
static void _set_accelerometer_steps_and_temperature_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
float temperature = 0.0F;
|
||||
uint32_t steps = 0U;
|
||||
|
||||
if(settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb)
|
||||
settingsScreen->settingsScreenAPIInterface.getAccelerometerRawDataCb(NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&temperature,
|
||||
&steps);
|
||||
snprintf(settingsScreen->sensors_labels.accelerometer.temperature.text,
|
||||
sizeof(settingsScreen->sensors_labels.accelerometer.temperature.text)-1,
|
||||
"%.2f °C", temperature);
|
||||
snprintf(settingsScreen->sensors_labels.accelerometer.steps.text,
|
||||
sizeof(settingsScreen->sensors_labels.accelerometer.steps.text)-1,
|
||||
"%s: %u", "steps", steps);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.temperature.label, settingsScreen->sensors_labels.accelerometer.temperature.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.accelerometer.steps.label, settingsScreen->sensors_labels.accelerometer.steps.text);
|
||||
}
|
||||
|
||||
static void _set_pressure_sensor_to_label(SettingsScreen_t * const settingsScreen)
|
||||
{
|
||||
float pressure = 0.0F, temperature = 0.0F;
|
||||
if(settingsScreen->settingsScreenAPIInterface.getBMP280DataCb) settingsScreen->settingsScreenAPIInterface.getBMP280DataCb(&temperature, &pressure);
|
||||
|
||||
sprintf(settingsScreen->bmp280_pressure.text, "%.2f hPa", pressure);
|
||||
lv_label_set_text_static(settingsScreen->bmp280_pressure.label, settingsScreen->bmp280_pressure.text);
|
||||
snprintf(settingsScreen->sensors_labels.pressure.pressure.text, sizeof(settingsScreen->sensors_labels.pressure.pressure.text)-1, "%.2f hPa", pressure);
|
||||
snprintf(settingsScreen->sensors_labels.pressure.temperature.text, sizeof(settingsScreen->sensors_labels.pressure.temperature.text)-1, "%.2f °C", temperature);
|
||||
|
||||
sprintf(settingsScreen->bmp280_temperature.text, "%.2f °C", temperature);
|
||||
lv_label_set_text_static(settingsScreen->bmp280_temperature.label, settingsScreen->bmp280_temperature.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.pressure.pressure.label, settingsScreen->sensors_labels.pressure.pressure.text);
|
||||
lv_label_set_text_static(settingsScreen->sensors_labels.pressure.temperature.label, settingsScreen->sensors_labels.pressure.temperature.text);
|
||||
}
|
||||
|
||||
static void _enable_time_and_date_rollers(bool enabled, SettingsScreen_t * const settingsScreen)
|
||||
@ -1144,7 +1316,7 @@ static void update_menu_list_item_text(lv_obj_t *menu_list_item, const char *tex
|
||||
|
||||
static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool show)
|
||||
{
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_pairing_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
if(show)
|
||||
{
|
||||
uint32_t pairing_key = 0;
|
||||
@ -1152,7 +1324,7 @@ static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool
|
||||
sprintf(settingsScreen->ble_pairing_key.text, "%u", pairing_key);
|
||||
|
||||
lv_label_set_text_static(settingsScreen->ble_pairing_key.label, settingsScreen->ble_pairing_key.text);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_pairing_key.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_pairing_key.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_clear_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
@ -1160,12 +1332,12 @@ static void _show_ble_pairing_key(SettingsScreen_t * const settingsScreen, bool
|
||||
{
|
||||
lv_obj_add_flag(settingsScreen->ble_pairing_key.label, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(settingsScreen->ble_pairing_label, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_label, settingsScreen->ble_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
}
|
||||
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
|
||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_name_value, settingsScreen->ble_dev_name_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
lv_obj_align_to(settingsScreen->ble_dev_mac_label, settingsScreen->ble_dev_name_value, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_align_to(settingsScreen->ble_mac_addr.label, settingsScreen->ble_dev_mac_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_INNER);
|
||||
lv_obj_align_to(settingsScreen->wifi_switch, settingsScreen->ble_mac_addr.label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, SETTINGS_SCREEN_CATEGORY_SPACING_OUTER);
|
||||
lv_obj_align_to(settingsScreen->wifi_label, settingsScreen->wifi_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
|
||||
}
|
||||
|
@ -9,6 +9,12 @@ typedef enum SettingMode
|
||||
SETTING_MODE_SET
|
||||
} SettingMode_e;
|
||||
|
||||
typedef enum ComponentVersion
|
||||
{
|
||||
COMPONENT_FREERTOS = 0,
|
||||
COMPONENT_LVGL
|
||||
} ComponentVersion_e;
|
||||
|
||||
typedef struct SettingsScreenAPIInterface
|
||||
{
|
||||
void (*setAutomaticTimeSettingsCb)(bool *enabled, SettingMode_e mode);
|
||||
@ -34,7 +40,9 @@ typedef struct SettingsScreenAPIInterface
|
||||
void (*getBLEDevicePairingKeyCb)(uint32_t *pairing_key);
|
||||
void (*getBatteryVoltageCb)(uint16_t *battery_voltage);
|
||||
void (*getMagnetometerRawDataCb)(int16_t *field_x, int16_t *field_y, int16_t *field_z, float *temperature);
|
||||
void (*getAccelerometerRawDataCb)(int16_t *accel_x, int16_t *accel_y, int16_t *accel_z, float *temperature, uint32_t *step_count);
|
||||
void (*getBMP280DataCb)(float *temperature, float *pressure);
|
||||
void (*getComponentVersionCb)(const char **version, ComponentVersion_e component);
|
||||
void (*saveSettingsCb)(void);
|
||||
void (*factoryResetCb)(void);
|
||||
} SettingsScreenAPIInterface_t;
|
||||
@ -51,6 +59,7 @@ typedef enum SettingsScreenCategory
|
||||
SETTINGS_SCREEN_CATEGORY_DISPLAY,
|
||||
SETTINGS_SCREEN_CATEGORY_NOTIFICATION,
|
||||
SETTINGS_SCREEN_CATEGORY_CONNECTIVITY,
|
||||
SETTINGS_SCREEN_CATEGORY_SENSORS,
|
||||
SETTINGS_SCREEN_CATEGORY_LANGUAGE,
|
||||
SETTINGS_SCREEN_CATEGORY_ABOUT,
|
||||
} SettingsScreenCategory_e;
|
||||
@ -66,6 +75,7 @@ typedef struct SettingsScreen
|
||||
lv_obj_t *display_item;
|
||||
lv_obj_t *notifications_item;
|
||||
lv_obj_t *connectivity_item;
|
||||
lv_obj_t *sensors_item;
|
||||
lv_obj_t *language_item;
|
||||
lv_obj_t *about_item;
|
||||
/* Remember the last clicked item needed for the background color logic */
|
||||
@ -91,30 +101,66 @@ typedef struct SettingsScreen
|
||||
lv_obj_t *ble_dev_mac_label;
|
||||
lv_obj_t *language_label;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[20];
|
||||
} clock;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[11];
|
||||
} x, y, z, temperature;
|
||||
} magnetometer;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[11];
|
||||
} x, y, z, temperature;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[18];
|
||||
} steps;
|
||||
} accelerometer;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[13];
|
||||
} pressure;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[11];
|
||||
} temperature;
|
||||
} pressure;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[8];
|
||||
} battery_voltage;
|
||||
} sensors_labels;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *current_time_label;
|
||||
char current_time_text[20];
|
||||
} currentTime;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *batteryVoltageLabel;
|
||||
char batteryVoltageText[8];
|
||||
} batteryVoltage;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[11];
|
||||
} magnetometer_x, magnetometer_y, magnetometer_z, magnetometer_temperature, bmp280_temperature;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
char text[13];
|
||||
} bmp280_pressure;
|
||||
|
||||
struct
|
||||
{
|
||||
lv_obj_t *label;
|
||||
@ -126,12 +172,12 @@ typedef struct SettingsScreen
|
||||
lv_obj_t *label;
|
||||
char text[7];
|
||||
} ble_pairing_key;
|
||||
|
||||
|
||||
/* Main screen */
|
||||
lv_obj_t *display;
|
||||
|
||||
/* Other */
|
||||
lv_timer_t *about_refresh_timer;
|
||||
lv_timer_t *sensors_refresh_timer;
|
||||
SettingsScreenOnStateChangeCb_t settingsScreenOnStateChangeCb;
|
||||
SettingsScreenUserFeedbackCb_t settingsScreenUserFeedbackCb;
|
||||
} SettingsScreen_t;
|
||||
@ -141,8 +187,8 @@ void settings_screen_init(SettingsScreen_t * const settingsScreen);
|
||||
/**
|
||||
* @brief Registers a callback function which will be called every time the state of the application changes ie : is opened or closed.
|
||||
* This callback should be used to initialize and deinitialize needed devices drivers like the magnetometer or the temperature sensor.
|
||||
* @note The state of the application is passed as a parameter of the callback function.
|
||||
*
|
||||
* @note The state of the application is passed as a parameter of the callback function.
|
||||
*
|
||||
* @param settingsScreen a pointer to the previously initialized settings screen object structure.
|
||||
* @param SettingsScreenOnStateChangeCb the callback of type @ref SettingsScreenOnStateChangeCb_t to register.
|
||||
*/
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file watch_face.c
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Watch face source file implementing API functions.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "watch_face.h"
|
||||
#include "menu_screen.h"
|
||||
@ -99,6 +109,8 @@ static void gesture_event_cb(lv_event_t *e)
|
||||
// We delete the timer
|
||||
lv_timer_del(watchFace->batteryIndicator.lowBatteryAnimationTimer);
|
||||
lv_timer_del(watchFace->handAnimationTimer);
|
||||
// Checking if timer is not NULL here because it could have been deleted already
|
||||
if(watchFace->handHideTimer)lv_timer_del(watchFace->handHideTimer);
|
||||
lv_timer_del(watchFace->stepCounterRefreshTimer);
|
||||
// We create the menu screen and switch to it
|
||||
extern MenuScreen_t menuScreen;
|
||||
@ -227,6 +239,13 @@ static void set_battery_state_icon(WatchFace_t * const watchFace)
|
||||
break;
|
||||
}
|
||||
}
|
||||
static void hide_hour_and_minutes_hand_timer_cb(lv_timer_t *timer)
|
||||
{
|
||||
WatchFace_t *watchFace = timer->user_data;
|
||||
watchFace->handHideTimer = NULL;
|
||||
|
||||
watch_face_show_hour_and_minute_hands(watchFace, true);
|
||||
}
|
||||
|
||||
static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
|
||||
{
|
||||
@ -234,13 +253,28 @@ static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
|
||||
|
||||
if(lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
||||
{
|
||||
lv_obj_clear_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
if(watchFace->handHideTimer)
|
||||
{
|
||||
/* Make the timer execute now to re-display hands
|
||||
and cleanly free the timer */
|
||||
lv_timer_ready(watchFace->handHideTimer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_add_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
// Let's hide the hands
|
||||
watch_face_show_hour_and_minute_hands(watchFace, false);
|
||||
|
||||
// Let's start the hand hide timer
|
||||
if(watchFace->handHideTimer)
|
||||
{
|
||||
LV_LOG_ERROR("handHideTimer should be NULL here !");
|
||||
lv_timer_del(watchFace->handHideTimer);
|
||||
watchFace->handHideTimer = NULL;
|
||||
}
|
||||
watchFace->handHideTimer = lv_timer_create(&(hide_hour_and_minutes_hand_timer_cb), 3000, watchFace);
|
||||
// After the timer expires once, delete it by setting the repeat count to 1
|
||||
lv_timer_set_repeat_count(watchFace->handHideTimer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,6 +618,7 @@ void watch_face_destroy(WatchFace_t * const watchFace)
|
||||
|
||||
watchFace->display = NULL;
|
||||
watchFace->handAnimationTimer = NULL;
|
||||
watchFace->handHideTimer = NULL;
|
||||
watchFace->stepCounterRefreshTimer = NULL;
|
||||
watchFace->dateWindow.dateWindowWidget = NULL;
|
||||
watchFace->hourHand.handImg = NULL;
|
||||
@ -611,6 +646,29 @@ void watch_face_force_sync(WatchFace_t *const watchFace)
|
||||
update_watch_hands_angles(watchFace, 0);
|
||||
}
|
||||
|
||||
void watch_face_show_hour_and_minute_hands(WatchFace_t * const watchFace, bool show)
|
||||
{
|
||||
if(!watchFace)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(watch_face_is_in_use(watchFace))
|
||||
{
|
||||
if(show && lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
||||
{
|
||||
lv_obj_clear_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
else if(!show && !lv_obj_has_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN))
|
||||
{
|
||||
lv_obj_add_flag(watchFace->hourHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(watchFace->minuteHand.handImg, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool watch_face_is_in_use(WatchFace_t * const watchFace)
|
||||
{
|
||||
if(!watchFace)
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file watch_face.h
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Watch face header file exposing related APIs.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#ifndef WATCH_FACE_H
|
||||
#define WATCH_FACE_H
|
||||
|
||||
@ -69,7 +79,9 @@ typedef struct WatchFace
|
||||
WatchHand_t minuteHand;
|
||||
WatchHand_t secondHand;
|
||||
WatchHand_t mediumHand24h;
|
||||
lv_timer_t *handAnimationTimer, *stepCounterRefreshTimer;
|
||||
lv_timer_t *handAnimationTimer;
|
||||
lv_timer_t *stepCounterRefreshTimer;
|
||||
lv_timer_t *handHideTimer;
|
||||
lv_obj_t *display;
|
||||
DateWindow_t dateWindow;
|
||||
BatteryIndicator_t batteryIndicator;
|
||||
@ -88,7 +100,7 @@ void watch_face_init(WatchFace_t * const watchFace);
|
||||
|
||||
/**
|
||||
* @brief Registers a call back function used by the watch face to retrieve the time and date
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param DateTimeCb a pointer to a function having the right definition.
|
||||
*/
|
||||
@ -97,7 +109,7 @@ void watch_face_register_date_time_cb(WatchFace_t * const watchFace, DateTimeCb_
|
||||
/**
|
||||
* @brief Registers a call back function used to refresh the battery indicator.
|
||||
* The refreshing is done every minute or every time the @ref watch_face_force_sync is called.
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param BatteryIndicatorCb a pointer to a function having the right definition.
|
||||
*/
|
||||
@ -119,16 +131,9 @@ void watch_face_register_step_counter_indicator_cb(WatchFace_t * const watchFace
|
||||
*/
|
||||
void watch_face_create(WatchFace_t * const watchFace);
|
||||
|
||||
/**
|
||||
* @brief Sets the battery indicator to the given value in percent.
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param percentage the value to set the indicator to in percent.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets the battery level in percent as well as it's current state to draw on the watch face.
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param levelInPercent the level to set the indicator to in percent.
|
||||
* @param batteryState the current state of the battery : BATTERY_STATE_DISCHARGING, BATTERY_STATE_CHARGING or BATTERY_STATE_CHARGED
|
||||
@ -137,7 +142,7 @@ void watch_face_set_battery_indicator(WatchFace_t * const watchFace, uint8_t lev
|
||||
|
||||
/**
|
||||
* @brief Sets the current bluetooth state to display on the watch face
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param bluetoothState the state of the bluetooth modem to show, can be : BLUETOOTH_STATE_OFF, BLUETOOTH_STATE_ON or BLUETOOTH_STATE_CONNECTED
|
||||
*/
|
||||
@ -145,31 +150,39 @@ void watch_face_set_bluetooth_indicator(WatchFace_t * const watchFace, Bluetooth
|
||||
|
||||
/**
|
||||
* @brief Shows the current step count passed as parameter on the watch face.
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @param step_count the step count to show on the watch face.
|
||||
*/
|
||||
void watch_face_set_step_count_indicator(WatchFace_t * const watchFace, uint32_t stepCount);
|
||||
|
||||
/**
|
||||
* @brief Forces the watch face to sync up with the RTC by calling the provided date_time_cb
|
||||
*
|
||||
* @brief Forces the watch face to sync up with the RTC by calling the provided date_time_cb.
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
*/
|
||||
void watch_face_force_sync(WatchFace_t * const watchFace);
|
||||
|
||||
/**
|
||||
* @brief Returns true if the watch face screen is currently being used and displayed.
|
||||
* @brief Show or hide the hour and minute hand on the watch face.
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @return true if the watch face screen is being used
|
||||
* @return false if the watch face screen is not being used/currently displayed
|
||||
* @param show a boolean value indicating if hands should be shown or not.
|
||||
*/
|
||||
void watch_face_show_hour_and_minute_hands(WatchFace_t * const watchFace, bool show);
|
||||
|
||||
/**
|
||||
* @brief Returns true if the watch face screen is currently being used and displayed.
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
* @return true if the watch face screen is being used.
|
||||
* @return false if the watch face screen is not being used/currently displayed.
|
||||
*/
|
||||
bool watch_face_is_in_use(WatchFace_t * const watchFace);
|
||||
|
||||
/**
|
||||
* @brief Frees all resources used by the WatchFace object.
|
||||
*
|
||||
*
|
||||
* @param watchFace a pointer to the watch face context structure.
|
||||
*/
|
||||
void watch_face_destroy(WatchFace_t * const watchFace);
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file translation.c
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Translation source file storing strings as const for each language.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#include "wm_type_def.h"
|
||||
#include "translation.h"
|
||||
#include "watch_settings.h"
|
||||
@ -64,6 +74,11 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
|
||||
[TRANSLATION_GERMAN] = "Konnektivität",
|
||||
[TRANSLATION_ENGLISH]= "Connectivity"
|
||||
},
|
||||
[TRANSLATION_SENSORS] = {
|
||||
[TRANSLATION_FRENCH] = "Capteurs",
|
||||
[TRANSLATION_GERMAN] = "Sensoren",
|
||||
[TRANSLATION_ENGLISH]= "Sensors"
|
||||
},
|
||||
[TRANSLATION_LANGUAGE] = {
|
||||
[TRANSLATION_FRENCH] = "Langue",
|
||||
[TRANSLATION_GERMAN] = "Sprache",
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file translation.h
|
||||
* @author Anatole SCHRAMM-HENRY
|
||||
* @brief Translation header file listing supported languages, translated words and translation API functions.
|
||||
* @version 0.1
|
||||
* @date 2025-04-29
|
||||
*
|
||||
* @copyright MIT
|
||||
*/
|
||||
|
||||
#ifndef TRANSLATION_H
|
||||
#define TRANSLATION_H
|
||||
|
||||
@ -26,6 +36,7 @@ typedef enum TranslationWord
|
||||
TRANSLATION_DISPLAY,
|
||||
TRANSLATION_NOTIFICATIONS,
|
||||
TRANSLATION_CONNECTIVITY,
|
||||
TRANSLATION_SENSORS,
|
||||
TRANSLATION_LANGUAGE,
|
||||
TRANSLATION_LANGUAGE_2,
|
||||
TRANSLATION_ABOUT,
|
||||
|
@ -3,7 +3,7 @@ sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||
|
||||
ifndef PDIR
|
||||
GEN_LIBS = liblvgl$(LIB_EXT)
|
||||
COMPONENTS_liblvgl = lvgl_v8.3/liblvglv8_3$(LIB_EXT) \
|
||||
COMPONENTS_liblvgl = lvgl_v8.4/liblvglv8_4$(LIB_EXT) \
|
||||
lvgl_port/liblvgl_port$(LIB_EXT)
|
||||
endif
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.3.3
|
||||
* Configuration file for v8.4.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -49,7 +49,7 @@
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (35 * 1024U) /*[bytes]*/
|
||||
#define LV_MEM_SIZE (35U * 1024U) /*[bytes]*/
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
#define LV_MEM_ADR 0 /*0: unused*/
|
||||
@ -89,6 +89,9 @@
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
/*If using lvgl as ESP32 component*/
|
||||
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
|
||||
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
@ -173,6 +176,9 @@
|
||||
* GPU
|
||||
*-----------*/
|
||||
|
||||
/*Use TSi's (aka Think Silicon) acceleration library NemaGFX */
|
||||
#define LV_USE_NEMA_GFX 0
|
||||
|
||||
/*Use Arm's 2D acceleration library Arm-2D */
|
||||
#define LV_USE_GPU_ARM2D 0
|
||||
|
||||
@ -180,10 +186,18 @@
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
e.g. "stm32f7xx.h" or "stm32f4xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Enable RA6M3 G2D GPU*/
|
||||
#define LV_USE_GPU_RA6M3_G2D 0
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
/*include path of target processor
|
||||
e.g. "hal_data.h"*/
|
||||
#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"
|
||||
#endif
|
||||
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
@ -628,6 +642,13 @@
|
||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/
|
||||
#define LV_USE_FS_LITTLEFS 0
|
||||
#if LV_USE_FS_LITTLEFS
|
||||
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*PNG decoder library*/
|
||||
#define LV_USE_PNG 0
|
||||
|
||||
@ -661,6 +682,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Tiny TTF library*/
|
||||
#define LV_USE_TINY_TTF 0
|
||||
#if LV_USE_TINY_TTF
|
||||
/*Load TTF data from files*/
|
||||
#define LV_TINY_TTF_FILE_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/*Rlottie library*/
|
||||
#define LV_USE_RLOTTIE 0
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
/* API collapsing */
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
document.querySelectorAll("dl.cpp").forEach(cppListing => {
|
||||
const dt = cppListing.querySelector("dt");
|
||||
let shouldBeExpanded = false;
|
||||
if(dt.id == document.location.hash.substring(1))
|
||||
shouldBeExpanded = true;
|
||||
cppListing.classList.add(shouldBeExpanded ? "expanded" : "unexpanded");
|
||||
const button = document.createElement("span");
|
||||
button.classList.add("lv-api-expansion-button");
|
||||
button.addEventListener("click", () => {
|
||||
cppListing.classList.toggle("unexpanded");
|
||||
cppListing.classList.toggle("expanded");
|
||||
});
|
||||
|
||||
dt.insertBefore(button, dt.firstChild);
|
||||
});
|
||||
})
|
@ -1,168 +0,0 @@
|
||||
# NXP
|
||||
NXP has integrated LVGL into the MCUXpresso SDK packages for several of their general purpose and crossover
|
||||
microcontrollers, allowing easy evaluation and migration into your product design.
|
||||
[Download an SDK for a supported board](https://www.nxp.com/design/software/embedded-software/littlevgl-open-source-graphics-library:LITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY?&tid=vanLITTLEVGL-OPEN-SOURCE-GRAPHICS-LIBRARY)
|
||||
today and get started with your next GUI application.
|
||||
|
||||
## Creating new project with LVGL
|
||||
Downloading the MCU SDK example project is recommended as a starting point. It comes fully configured with LVGL (and
|
||||
with PXP/VGLite support if the modules are present), no additional integration work is required.
|
||||
|
||||
## HW acceleration for NXP iMX RT platforms
|
||||
Depending on the RT platform used, the acceleration can be done by NXP PXP (PiXel Pipeline) and/or the Verisilicon GPU
|
||||
through an API named VGLite. There is a single NXP draw context that covers both GPUs allowing to have enabled either
|
||||
one or even both at the same time. While enableing both 2D accelerators, the VGLite can be used to accelerate widget
|
||||
drawing while the PXP accelerated blit and fill operations.
|
||||
|
||||
Supported draw callbacks are available in "src/draw/nxp/lv_gpu_nxp.c":
|
||||
```c
|
||||
nxp_draw_ctx->base_draw.draw_arc = lv_draw_nxp_arc;
|
||||
nxp_draw_ctx->base_draw.draw_rect = lv_draw_nxp_rect;
|
||||
nxp_draw_ctx->base_draw.draw_img_decoded = lv_draw_nxp_img_decoded;
|
||||
nxp_draw_ctx->blend = lv_draw_nxp_blend;
|
||||
```
|
||||
|
||||
If enabled both GPUs, the PXP is the preffered one to be used for drawing operation. A fallback mechanism is
|
||||
implemented so that if the feature is not supported by PXP (or if PXP fails), the VGLite will take over to handle the
|
||||
task. At the end, the CPU will assure that every widget drawing is fully covered (if not already done by GPU).
|
||||
|
||||
### PXP accelerator
|
||||
Several drawing features in LVGL can be offloaded to the PXP engine. The VGLite (if supported) and CPU are available for
|
||||
other operations while the PXP is running. An RTOS is required to block the LVGL drawing thread and switch to another
|
||||
task or suspend the CPU for power savings.
|
||||
|
||||
#### Features supported:
|
||||
- RGB565 and ARGB8888 color formats
|
||||
- Area fill + optional transparency
|
||||
- BLIT (BLock Image Transfer) + optional transparency
|
||||
- Color keying + optional transparency
|
||||
- Recoloring (color tint) + optional transparency
|
||||
- Image Rotation (90, 180, 270 degree) + optional transparency
|
||||
- Recoloring (color tint) + Image Rotation (90, 180, 270 degree) + optional transparency
|
||||
- Screen Rotation (90, 180, 270 degree)
|
||||
- RTOS integration layer
|
||||
- Default FreeRTOS and bare metal code provided
|
||||
|
||||
- Combination of recolor and/or rotation + color key/alpha blend/transparency is supported but PXP needs two steps.
|
||||
First step is to recolor/rotate the image to a temporarly buffer (please check LV_MEM_SIZE value for allocation limit)
|
||||
and another step is required to handle color keying, alpha chanel or to apply transparency.
|
||||
|
||||
#### Known limitations:
|
||||
- Rotation is not supported for images unaligned to blocks of 16x16 pixels.
|
||||
PXP is set to process 16x16 blocks to optimize the system for memory bandwidth and image processing time.
|
||||
The output engine essentially truncates any output pixels after the desired number of pixels has been written.
|
||||
When rotating a source image and the output is not divisible by the block size, the incorrect pixels could be truncated
|
||||
and the final output image can look shifted.
|
||||
|
||||
#### Basic configuration:
|
||||
- Select NXP PXP engine in lv_conf.h: Set `LV_USE_GPU_NXP_PXP` to 1
|
||||
- Enable default implementation for interrupt handling, PXP start function and automatic initialization:
|
||||
Set `LV_USE_GPU_NXP_PXP_AUTO_INIT` to 1
|
||||
- If `SDK_OS_FREE_RTOS` symbol is defined, FreeRTOS implementation will be used, otherwise bare metal code will be
|
||||
included
|
||||
|
||||
#### Basic initialization:
|
||||
- If `LV_USE_GPU_NXP_PXP_AUTO_INIT` is enabled, no user code is required; PXP is initialized automatically in
|
||||
`lv_init()`
|
||||
- For manual PXP initialization, default configuration structure for callbacks can be used. Initialize PXP before
|
||||
calling `lv_init()`
|
||||
```c
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "src/draw/nxp/pxp/lv_gpu_nxp_pxp.h"
|
||||
#endif
|
||||
. . .
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
PXP_COND_STOP(!lv_gpu_nxp_pxp_init(), "PXP init failed.");
|
||||
#endif
|
||||
```
|
||||
|
||||
#### Project setup:
|
||||
- Add PXP related files to project:
|
||||
- src/draw/nxp/pxp/lv_gpu_nxp_pxp.c, src/draw/nxp/pxp/lv_gpu_nxp_pxp.h: init, uninit, run/wait PXP device, log/trace
|
||||
- src/draw/nxp/pxp/lv_draw_pxp_blend.c, src/draw/nxp/pxp/lv_draw_pxp_blend.h: fill and blit (w/o transformation)
|
||||
- src/draw/nxp/pxp/lv_gpu_nxp_osa.c, src/draw/nxp/pxp/lv_gpu_osa.h: default implementation of OS-specific functions
|
||||
(bare metal and FreeRTOS only)
|
||||
- optional, required only if `LV_USE_GPU_NXP_PXP_AUTO_INIT` is set to 1
|
||||
- PXP related code depends on two drivers provided by MCU SDK. These drivers need to be added to project:
|
||||
- fsl_pxp.c, fsl_pxp.h: PXP driver
|
||||
- fsl_cache.c, fsl_cache.h: CPU cache handling functions
|
||||
|
||||
#### Logging:
|
||||
- By default, LV_GPU_NXP_PXP_LOG_ERRORS is enabled so that any PXP error will be seen on LVGL output
|
||||
- For tracing logs about the PXP limitations or size thresholds, the user can enable LV_GPU_NXP_PXP_LOG_TRACES
|
||||
|
||||
#### Advanced configuration:
|
||||
- Implementation depends on multiple OS-specific functions. The struct `lv_nxp_pxp_cfg_t` with callback pointers is
|
||||
used as a parameter for the `lv_gpu_nxp_pxp_init()` function. Default implementation for FreeRTOS and baremetal is
|
||||
provided in lv_gpu_nxp_osa.c
|
||||
- `pxp_interrupt_init()`: Initialize PXP interrupt (HW setup, OS setup)
|
||||
- `pxp_interrupt_deinit()`: Deinitialize PXP interrupt (HW setup, OS setup)
|
||||
- `pxp_run()`: Start PXP job. Use OS-specific mechanism to block drawing thread. PXP must finish drawing before
|
||||
leaving this function.
|
||||
- There are configurable area thresholds which are used to decide whether the area will be processed by CPU or by PXP.
|
||||
Areas smaller than a defined value will be processed by CPU and those bigger than the threshold will be processed by
|
||||
PXP. These thresholds may be defined as preprocessor variables. Default values are defined in lv_draw_pxp_blend.h
|
||||
- `LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT`: size threshold for image BLIT, BLIT with color keying, BLIT with recolor and
|
||||
BLIT with rotation (OPA >= LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT`: size threshold for image BLIT, BLIT with color keying, BLIT with recolor
|
||||
and BLIT with rotation and transparency (OPA < LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_PXP_FILL_SIZE_LIMIT`: size threshold for fill operation (OPA >= LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT`: size threshold for fill operation with transparency (OPA < LV_OPA_MAX)
|
||||
|
||||
### VGLite accelerator
|
||||
Extra drawing features in LVGL can be handled by the VGLite engine. The PXP (if supported) and CPU are available for
|
||||
other operations while the VGLite is running. An RTOS is required to block the LVGL drawing thread and switch to another
|
||||
task or suspend the CPU for power savings.
|
||||
|
||||
#### Features supported:
|
||||
- RGB565 and ARGB8888 color formats
|
||||
- Area fill + optional transparency
|
||||
- BLIT (BLock Image Transfer) + optional transparency
|
||||
- Image Rotation (any degree with decimal) + optional transparency
|
||||
- Image Scale + optional transparency
|
||||
- Draw background rectangle with radius or gradient
|
||||
- Draw arc
|
||||
- RTOS integration layer
|
||||
|
||||
#### Basic configuration:
|
||||
- Select NXP VGLite engine in lv_conf.h: Set `LV_USE_GPU_NXP_VG_LITE` to 1
|
||||
- `SDK_OS_FREE_RTOS` symbol needs to be defined so that the FreeRTOS implementation will be used
|
||||
|
||||
#### Basic initialization:
|
||||
- Initialize VGLite before calling `lv_init()` by specifying the width/height of tessellation window. Value should be
|
||||
a multiple of 16; minimum value is 16 pixels, maximum cannot be greater than frame width. If less than or equal to 0,
|
||||
then no tessellation buffer is created, in which case the function is used for a blit init.
|
||||
```c
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "vg_lite.h"
|
||||
#endif
|
||||
. . .
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
VG_LITE_COND_STOP(vg_lite_init(64, 64) != VG_LITE_SUCCESS, "VGLite init failed.");
|
||||
#endif
|
||||
```
|
||||
|
||||
#### Project setup:
|
||||
- Add VGLite related files to project:
|
||||
- src/draw/nxp/vglite/lv_gpu_nxp_vglite.c, src/draw/nxp/vglite/lv_gpu_nxp_vglite.h: buffer init, log/trace
|
||||
- src/draw/nxp/vglite/lv_draw_vglite_blend.c, src/draw/nxp/vglite/lv_draw_vglite_blend.h: fill and blit
|
||||
(w/o transformation)
|
||||
- src/draw/nxp/vglite/lv_draw_vglite_rect.c, src/draw/nxp/vglite/lv_draw_vglite_rect.h: rectangle draw
|
||||
- src/draw/nxp/vglite/lv_draw_vglite_arc.c, src/draw/nxp/vglite/lv_draw_vglite_arc.h: arc draw
|
||||
|
||||
#### Logging:
|
||||
- By default, LV_GPU_NXP_VG_LITE_LOG_ERRORS is enabled so that any VGLite error will be seen on LVGL output
|
||||
- For tracing logs about the VGLite limitations, size thresholds or stride alignment, the user can enable
|
||||
LV_GPU_NXP_VG_LITE_LOG_TRACES
|
||||
|
||||
#### Advanced configuration:
|
||||
- There are configurable area thresholds which are used to decide whether the area will be processed by CPU or by
|
||||
VGLite. Areas smaller than a defined value will be processed by CPU and those bigger than the threshold will be
|
||||
processed by VGLite. These thresholds may be defined as preprocessor variables. Default values are defined in
|
||||
lv_draw_vglite_blend.h
|
||||
- `LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT`: size threshold for image BLIT, BLIT with scale and BLIT with rotation
|
||||
(OPA >= LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT`: size threshold for image BLIT, BLIT with scale and BLIT with rotation
|
||||
and transparency (OPA < LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT`: size threshold for fill operation (OPA >= LV_OPA_MAX)
|
||||
- `LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT`: size threshold for fill operation with transparency (OPA < LV_OPA_MAX)
|
@ -1,21 +0,0 @@
|
||||
|
||||
# File System Interfaces
|
||||
|
||||
LVGL has a [File system](https://docs.lvgl.io/master/overview/file-system.html) module to provide an abstraction layer for various file system drivers.
|
||||
|
||||
LVG has built in support for:
|
||||
- [FATFS](http://elm-chan.org/fsw/ff/00index_e.html)
|
||||
- STDIO (Linux and Windows using C standard function .e.g fopen, fread)
|
||||
- POSIX (Linux and Windows using POSIX function .e.g open, read)
|
||||
- WIN32 (Windows using Win32 API function .e.g CreateFileA, ReadFile)
|
||||
|
||||
You still need to provide the drivers and libraries, this extension provides only the bridge between FATFS, STDIO, POSIX, WIN32 and LVGL.
|
||||
|
||||
## Usage
|
||||
|
||||
In `lv_conf.h` enable `LV_USE_FS_...` and assign an upper cased letter to `LV_FS_..._LETTER` (e.g. `'S'`).
|
||||
After that you can access files using that driver letter. E.g. `"S:path/to/file.txt"`.
|
||||
|
||||
The work directory can be set with `LV_FS_..._PATH`. E.g. `"/home/joe/projects/"` The actual file/directory paths will be appended to it.
|
||||
|
||||
Cached reading is also supported if `LV_FS_..._CACHE_SIZE` is set to not `0` value. `lv_fs_read` caches this size of data to lower the number of actual reads from the storage.
|
@ -1,4 +0,0 @@
|
||||
# ARM-2D GPU
|
||||
|
||||
TODO
|
||||
|
@ -1,13 +0,0 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = []
|
||||
CPPPATH =[]
|
||||
|
||||
src += Glob(cwd + '/ui/*.c')
|
||||
CPPPATH += [cwd+'/ui']
|
||||
|
||||
group = group + DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
@ -1,99 +0,0 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_USE_SLIDER && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * chart;
|
||||
/* Source: https://github.com/ankur219/ECG-Arrhythmia-classification/blob/642230149583adfae1e4bd26c6f0e1fd8af2be0e/sample.csv*/
|
||||
static const lv_coord_t ecg_sample[] = {
|
||||
-2, 2, 0, -15, -39, -63, -71, -68, -67, -69, -84, -95, -104, -107, -108, -107, -107, -107, -107, -114, -118, -117,
|
||||
-112, -100, -89, -83, -71, -64, -58, -58, -62, -62, -58, -51, -46, -39, -27, -10, 4, 7, 1, -3, 0, 14, 24, 30, 25, 19,
|
||||
13, 7, 12, 15, 18, 21, 13, 6, 9, 8, 17, 19, 13, 11, 11, 11, 23, 30, 37, 34, 25, 14, 15, 19, 28, 31, 26, 23, 25, 31,
|
||||
39, 37, 37, 34, 30, 32, 22, 29, 31, 33, 37, 23, 13, 7, 2, 4, -2, 2, 11, 22, 33, 19, -1, -27, -55, -67, -72, -71, -63,
|
||||
-49, -18, 35, 113, 230, 369, 525, 651, 722, 730, 667, 563, 454, 357, 305, 288, 274, 255, 212, 173, 143, 117, 82, 39,
|
||||
-13, -53, -78, -91, -101, -113, -124, -131, -131, -131, -129, -128, -129, -125, -123, -123, -129, -139, -148, -153,
|
||||
-159, -166, -183, -205, -227, -243, -248, -246, -254, -280, -327, -381, -429, -473, -517, -556, -592, -612, -620,
|
||||
-620, -614, -604, -591, -574, -540, -497, -441, -389, -358, -336, -313, -284, -222, -167, -114, -70, -47, -28, -4, 12,
|
||||
38, 52, 58, 56, 56, 57, 68, 77, 86, 86, 80, 69, 67, 70, 82, 85, 89, 90, 89, 89, 88, 91, 96, 97, 91, 83, 78, 82, 88, 95,
|
||||
96, 105, 106, 110, 102, 100, 96, 98, 97, 101, 98, 99, 100, 107, 113, 119, 115, 110, 96, 85, 73, 64, 69, 76, 79,
|
||||
78, 75, 85, 100, 114, 113, 105, 96, 84, 74, 66, 60, 75, 85, 89, 83, 67, 61, 67, 73, 79, 74, 63, 57, 56, 58, 61, 55,
|
||||
48, 45, 46, 55, 62, 55, 49, 43, 50, 59, 63, 57, 40, 31, 23, 25, 27, 31, 35, 34, 30, 36, 34, 42, 38, 36, 40, 46, 50,
|
||||
47, 32, 30, 32, 52, 67, 73, 71, 63, 54, 53, 45, 41, 28, 13, 3, 1, 4, 4, -8, -23, -32, -31, -19, -5, 3, 9, 13, 19,
|
||||
24, 27, 29, 25, 22, 26, 32, 42, 51, 56, 60, 57, 55, 53, 53, 54, 59, 54, 49, 26, -3, -11, -20, -47, -100, -194, -236,
|
||||
-212, -123, 8, 103, 142, 147, 120, 105, 98, 93, 81, 61, 40, 26, 28, 30, 30, 27, 19, 17, 21, 20, 19, 19, 22, 36, 40,
|
||||
35, 20, 7, 1, 10, 18, 27, 22, 6, -4, -2, 3, 6, -2, -13, -14, -10, -2, 3, 2, -1, -5, -10, -19, -32, -42, -55, -60,
|
||||
-68, -77, -86, -101, -110, -117, -115, -104, -92, -84, -85, -84, -73, -65, -52, -50, -45, -35, -20, -3, 12, 20, 25,
|
||||
26, 28, 28, 30, 28, 25, 28, 33, 42, 42, 36, 23, 9, 0, 1, -4, 1, -4, -4, 1, 5, 9, 9, -3, -1, -18, -50, -108, -190,
|
||||
-272, -340, -408, -446, -537, -643, -777, -894, -920, -853, -697, -461, -251, -60, 58, 103, 129, 139, 155, 170, 173,
|
||||
178, 185, 190, 193, 200, 208, 215, 225, 224, 232, 234, 240, 240, 236, 229, 226, 224, 232, 233, 232, 224, 219, 219,
|
||||
223, 231, 226, 223, 219, 218, 223, 223, 223, 233, 245, 268, 286, 296, 295, 283, 271, 263, 252, 243, 226, 210, 197,
|
||||
186, 171, 152, 133, 117, 114, 110, 107, 96, 80, 63, 48, 40, 38, 34, 28, 15, 2, -7, -11, -14, -18, -29, -37, -44, -50,
|
||||
-58, -63, -61, -52, -50, -48, -61, -59, -58, -54, -47, -52, -62, -61, -64, -54, -52, -59, -69, -76, -76, -69, -67,
|
||||
-74, -78, -81, -80, -73, -65, -57, -53, -51, -47, -35, -27, -22, -22, -24, -21, -17, -13, -10, -11, -13, -20, -20,
|
||||
-12, -2, 7, -1, -12, -16, -13, -2, 2, -4, -5, -2, 9, 19, 19, 14, 11, 13, 19, 21, 20, 18, 19, 19, 19, 16, 15, 13, 14,
|
||||
9, 3, -5, -9, -5, -3, -2, -3, -3, 2, 8, 9, 9, 5, 6, 8, 8, 7, 4, 3, 4, 5, 3, 5, 5, 13, 13, 12, 10, 10, 15, 22, 17,
|
||||
14, 7, 10, 15, 16, 11, 12, 10, 13, 9, -2, -4, -2, 7, 16, 16, 17, 16, 7, -1, -16, -18, -16, -9, -4, -5, -10, -9, -8,
|
||||
-3, -4, -10, -19, -20, -16, -9, -9, -23, -40, -48, -43, -33, -19, -21, -26, -31, -33, -19, 0, 17, 24, 9, -17, -47,
|
||||
-63, -67, -59, -52, -51, -50, -49, -42, -26, -21, -15, -20, -23, -22, -19, -12, -8, 5, 18, 27, 32, 26, 25, 26, 22,
|
||||
23, 17, 14, 17, 21, 25, 2, -45, -121, -196, -226, -200, -118, -9, 73, 126, 131, 114, 87, 60, 42, 29, 26, 34, 35, 34,
|
||||
25, 12, 9, 7, 3, 2, -8, -11, 2, 23, 38, 41, 23, 9, 10, 13, 16, 8, -8, -17, -23, -26, -25, -21, -15, -10, -13, -13,
|
||||
-19, -22, -29, -40, -48, -48, -54, -55, -66, -82, -85, -90, -92, -98, -114, -119, -124, -129, -132, -146, -146, -138,
|
||||
-124, -99, -85, -72, -65, -65, -65, -66, -63, -64, -64, -58, -46, -26, -9, 2, 2, 4, 0, 1, 4, 3, 10, 11, 10, 2, -4,
|
||||
0, 10, 18, 20, 6, 2, -9, -7, -3, -3, -2, -7, -12, -5, 5, 24, 36, 31, 25, 6, 3, 7, 12, 17, 11, 0, -6, -9, -8, -7, -5,
|
||||
-6, -2, -2, -6, -2, 2, 14, 24, 22, 15, 8, 4, 6, 7, 12, 16, 25, 20, 7, -16, -41, -60, -67, -65, -54, -35, -11, 30,
|
||||
84, 175, 302, 455, 603, 707, 743, 714, 625, 519, 414, 337, 300, 281, 263, 239, 197, 163, 136, 109, 77, 34, -18, -50,
|
||||
-66, -74, -79, -92, -107, -117, -127, -129, -135, -139, -141, -155, -159, -167, -171, -169, -174, -175, -178, -191,
|
||||
-202, -223, -235, -243, -237, -240, -256, -298, -345, -393, -432, -475, -518, -565, -596, -619, -623, -623, -614,
|
||||
-599, -583, -559, -524, -477, -425, -383, -357, -331, -301, -252, -198, -143, -96, -57, -29, -8, 10, 31, 45, 60, 65,
|
||||
70, 74, 76, 79, 82, 79, 75, 62,
|
||||
};
|
||||
|
||||
static void slider_x_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
int32_t v = lv_slider_get_value(obj);
|
||||
lv_chart_set_zoom_x(chart, v);
|
||||
}
|
||||
|
||||
static void slider_y_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
int32_t v = lv_slider_get_value(obj);
|
||||
lv_chart_set_zoom_y(chart, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display 1000 data points with zooming and scrolling.
|
||||
* See how the chart changes drawing mode (draw only vertical lines) when
|
||||
* the points get too crowded.
|
||||
*/
|
||||
void lv_example_chart_5(void)
|
||||
{
|
||||
/*Create a chart*/
|
||||
chart = lv_chart_create(lv_scr_act());
|
||||
lv_obj_set_size(chart, 200, 150);
|
||||
lv_obj_align(chart, LV_ALIGN_CENTER, -30, -30);
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, -1000, 1000);
|
||||
|
||||
/*Do not display points on the data*/
|
||||
lv_obj_set_style_size(chart, 0, LV_PART_INDICATOR);
|
||||
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
|
||||
uint32_t pcnt = sizeof(ecg_sample) / sizeof(ecg_sample[0]);
|
||||
lv_chart_set_point_count(chart, pcnt);
|
||||
lv_chart_set_ext_y_array(chart, ser, (lv_coord_t *)ecg_sample);
|
||||
|
||||
lv_obj_t * slider;
|
||||
slider = lv_slider_create(lv_scr_act());
|
||||
lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10);
|
||||
lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
lv_obj_set_size(slider, 200, 10);
|
||||
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
|
||||
|
||||
slider = lv_slider_create(lv_scr_act());
|
||||
lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10);
|
||||
lv_obj_add_event_cb(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
lv_obj_set_size(slider, 10, 150);
|
||||
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,2 +0,0 @@
|
||||
description: LVGL - Light and Versatile Graphics Library
|
||||
url: https://github.com/lvgl/lvgl
|
@ -1,418 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*
|
||||
* allow to use both PXP and VGLITE
|
||||
|
||||
* both 2D accelerators can be used at the same time:
|
||||
* thus VGLITE can be used to accelerate widget drawing
|
||||
* while PXP accelerates Blit & Fill operations.
|
||||
*/
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "pxp/lv_draw_pxp_blend.h"
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "vglite/lv_draw_vglite_blend.h"
|
||||
#include "vglite/lv_draw_vglite_rect.h"
|
||||
#include "vglite/lv_draw_vglite_arc.h"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH != 32
|
||||
#include "../../core/lv_refr.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf);
|
||||
|
||||
static void lv_draw_nxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
static lv_res_t draw_nxp_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_nxp_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
|
||||
lv_draw_nxp_ctx_t * nxp_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
|
||||
|
||||
nxp_draw_ctx->base_draw.draw_arc = lv_draw_nxp_arc;
|
||||
nxp_draw_ctx->base_draw.draw_rect = lv_draw_nxp_rect;
|
||||
nxp_draw_ctx->base_draw.draw_img_decoded = lv_draw_nxp_img_decoded;
|
||||
nxp_draw_ctx->blend = lv_draw_nxp_blend;
|
||||
//nxp_draw_ctx->base_draw.wait_for_finish = lv_draw_nxp_wait_cb;
|
||||
}
|
||||
|
||||
void lv_draw_nxp_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sw_deinit_ctx(drv, draw_ctx);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* During rendering, LVGL might initializes new draw_ctxs and start drawing into
|
||||
* a separate buffer (called layer). If the content to be rendered has "holes",
|
||||
* e.g. rounded corner, LVGL temporarily sets the disp_drv.screen_transp flag.
|
||||
* It means the renderers should draw into an ARGB buffer.
|
||||
* With 32 bit color depth it's not a big problem but with 16 bit color depth
|
||||
* the target pixel format is ARGB8565 which is not supported by the GPU.
|
||||
* In this case, the NXP callbacks should fallback to SW rendering.
|
||||
*/
|
||||
static inline bool need_argb8565_support()
|
||||
{
|
||||
#if LV_COLOR_DEPTH != 32
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(disp->driver->screen_transp == 1)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
lv_area_t blend_area;
|
||||
|
||||
/*Let's get the blend area which is the intersection of the area to fill and the clip area.*/
|
||||
if(!_lv_area_intersect(&blend_area, dsc->blend_area, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
bool done = false;
|
||||
|
||||
/*Fill/Blend only non masked, normal blended*/
|
||||
if(dsc->mask_buf == NULL && dsc->blend_mode == LV_BLEND_MODE_NORMAL && !need_argb8565_support()) {
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
lv_coord_t dest_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
lv_coord_t dest_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
#endif
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
|
||||
if(src_buf == NULL) {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
done = (lv_gpu_nxp_pxp_fill(dest_buf, dest_stride, &blend_area,
|
||||
dsc->color, dsc->opa) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP fill failed. Fallback.");
|
||||
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done) {
|
||||
done = (lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &blend_area,
|
||||
dsc->color, dsc->opa) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite fill failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
done = (lv_gpu_nxp_pxp_blit(dest_buf, &blend_area, dest_stride, src_buf, dsc->blend_area,
|
||||
dsc->opa, LV_DISP_ROT_NONE) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP blit failed. Fallback.");
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done) {
|
||||
lv_gpu_nxp_vglite_blit_info_t blit;
|
||||
lv_coord_t src_stride = lv_area_get_width(dsc->blend_area);
|
||||
|
||||
blit.src = src_buf;
|
||||
blit.src_width = lv_area_get_width(dsc->blend_area);
|
||||
blit.src_height = lv_area_get_height(dsc->blend_area);
|
||||
blit.src_stride = src_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.src_area.x1 = (blend_area.x1 - (dsc->blend_area->x1 - draw_ctx->buf_area->x1));
|
||||
blit.src_area.y1 = (blend_area.y1 - (dsc->blend_area->y1 - draw_ctx->buf_area->y1));
|
||||
blit.src_area.x2 = blit.src_area.x1 + blit.src_width - 1;
|
||||
blit.src_area.y2 = blit.src_area.y1 + blit.src_height - 1;
|
||||
|
||||
blit.dst = dest_buf;
|
||||
blit.dst_width = dest_width;
|
||||
blit.dst_height = dest_height;
|
||||
blit.dst_stride = dest_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.dst_area.x1 = blend_area.x1;
|
||||
blit.dst_area.y1 = blend_area.y1;
|
||||
blit.dst_area.x2 = blend_area.x2;
|
||||
blit.dst_area.y2 = blend_area.y2;
|
||||
|
||||
blit.opa = dsc->opa;
|
||||
blit.zoom = LV_IMG_ZOOM_NONE;
|
||||
blit.angle = 0;
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK);
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf)
|
||||
{
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, draw_ctx->clip_area);
|
||||
bool mask_any = lv_draw_mask_is_any(&draw_area);
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
bool recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
#endif
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
bool scale = (dsc->zoom != LV_IMG_ZOOM_NONE);
|
||||
#endif
|
||||
bool done = false;
|
||||
|
||||
lv_area_t blend_area;
|
||||
/*Let's get the blend area which is the intersection of the area to fill and the clip area.*/
|
||||
if(!_lv_area_intersect(&blend_area, coords, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
const lv_color_t * src_buf = (const lv_color_t *)map_p;
|
||||
if(!src_buf) {
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, cf);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
if(!mask_any && !scale && !need_argb8565_support()
|
||||
#if LV_COLOR_DEPTH!=32
|
||||
&& !lv_img_cf_has_alpha(cf)
|
||||
#endif
|
||||
) {
|
||||
done = (lv_gpu_nxp_pxp_blit_transform(dest_buf, &blend_area, dest_stride, src_buf, coords,
|
||||
dsc, cf) == LV_RES_OK);
|
||||
if(!done)
|
||||
PXP_LOG_TRACE("PXP blit transform failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!done && !mask_any && !need_argb8565_support() &&
|
||||
!lv_img_cf_is_chroma_keyed(cf) && !recolor
|
||||
#if LV_COLOR_DEPTH!=32
|
||||
&& !lv_img_cf_has_alpha(cf)
|
||||
#endif
|
||||
) {
|
||||
lv_gpu_nxp_vglite_blit_info_t blit;
|
||||
lv_coord_t src_stride = lv_area_get_width(coords);
|
||||
|
||||
blit.src = src_buf;
|
||||
blit.src_width = lv_area_get_width(coords);
|
||||
blit.src_height = lv_area_get_height(coords);
|
||||
blit.src_stride = src_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.src_area.x1 = (blend_area.x1 - (coords->x1 - draw_ctx->buf_area->x1));
|
||||
blit.src_area.y1 = (blend_area.y1 - (coords->y1 - draw_ctx->buf_area->y1));
|
||||
blit.src_area.x2 = blit.src_area.x1 + blit.src_width - 1;
|
||||
blit.src_area.y2 = blit.src_area.y1 + blit.src_height - 1;
|
||||
|
||||
blit.dst = dest_buf;
|
||||
blit.dst_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
blit.dst_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
blit.dst_stride = dest_stride * (int32_t)sizeof(lv_color_t);
|
||||
blit.dst_area.x1 = blend_area.x1;
|
||||
blit.dst_area.y1 = blend_area.y1;
|
||||
blit.dst_area.x2 = blend_area.x2;
|
||||
blit.dst_area.y2 = blend_area.y2;
|
||||
|
||||
blit.opa = dsc->opa;
|
||||
blit.angle = dsc->angle;
|
||||
blit.pivot = dsc->pivot;
|
||||
blit.zoom = dsc->zoom;
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit_transform(&blit) == LV_RES_OK);
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit transform failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, cf);
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
bool done = false;
|
||||
lv_draw_rect_dsc_t nxp_dsc;
|
||||
|
||||
lv_memcpy(&nxp_dsc, dsc, sizeof(nxp_dsc));
|
||||
#if LV_DRAW_COMPLEX
|
||||
/* Draw only the shadow */
|
||||
nxp_dsc.bg_opa = 0;
|
||||
nxp_dsc.bg_img_opa = 0;
|
||||
nxp_dsc.border_opa = 0;
|
||||
nxp_dsc.outline_opa = 0;
|
||||
|
||||
lv_draw_sw_rect(draw_ctx, &nxp_dsc, coords);
|
||||
|
||||
/* Draw the background */
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
nxp_dsc.bg_opa = dsc->bg_opa;
|
||||
done = (draw_nxp_bg(draw_ctx, &nxp_dsc, coords) == LV_RES_OK);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/* Draw the remaining parts */
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
if(done)
|
||||
nxp_dsc.bg_opa = 0;
|
||||
nxp_dsc.bg_img_opa = dsc->bg_img_opa;
|
||||
nxp_dsc.border_opa = dsc->border_opa;
|
||||
nxp_dsc.outline_opa = dsc->outline_opa;
|
||||
|
||||
lv_draw_sw_rect(draw_ctx, &nxp_dsc, coords);
|
||||
}
|
||||
|
||||
static lv_res_t draw_nxp_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
if(dsc->bg_opa <= LV_OPA_MIN)
|
||||
return LV_RES_INV;
|
||||
|
||||
lv_area_t bg_coords;
|
||||
lv_area_copy(&bg_coords, coords);
|
||||
|
||||
/*If the border fully covers make the bg area 1px smaller to avoid artifacts on the corners*/
|
||||
if(dsc->border_width > 1 && dsc->border_opa >= (lv_opa_t)LV_OPA_MAX && dsc->radius != 0) {
|
||||
bg_coords.x1 += (dsc->border_side & LV_BORDER_SIDE_LEFT) ? 1 : 0;
|
||||
bg_coords.y1 += (dsc->border_side & LV_BORDER_SIDE_TOP) ? 1 : 0;
|
||||
bg_coords.x2 -= (dsc->border_side & LV_BORDER_SIDE_RIGHT) ? 1 : 0;
|
||||
bg_coords.y2 -= (dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? 1 : 0;
|
||||
}
|
||||
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &bg_coords, draw_ctx->clip_area))
|
||||
return LV_RES_INV;
|
||||
|
||||
lv_grad_dir_t grad_dir = dsc->bg_grad.dir;
|
||||
lv_color_t bg_color = grad_dir == LV_GRAD_DIR_NONE ? dsc->bg_color : dsc->bg_grad.stops[0].color;
|
||||
if(bg_color.full == dsc->bg_grad.stops[1].color.full) grad_dir = LV_GRAD_DIR_NONE;
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(&bg_coords);
|
||||
|
||||
/*
|
||||
* Most simple case: just a plain rectangle (no mask, no radius, no gradient)
|
||||
* shall fallback to lv_draw_sw_blend().
|
||||
*
|
||||
* Complex case: gradient or radius but no mask.
|
||||
*/
|
||||
if(!mask_any && ((dsc->radius != 0) || (grad_dir != LV_GRAD_DIR_NONE)) && !need_argb8565_support()) {
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
lv_res_t res = lv_gpu_nxp_vglite_draw_bg(draw_ctx, dsc, &bg_coords);
|
||||
if(res != LV_RES_OK)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw bg failed. Fallback.");
|
||||
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(dsc->opa <= LV_OPA_MIN)
|
||||
return;
|
||||
if(dsc->width == 0)
|
||||
return;
|
||||
if(start_angle == end_angle)
|
||||
return;
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
if(!need_argb8565_support()) {
|
||||
done = (lv_gpu_nxp_vglite_draw_arc(draw_ctx, dsc, center, (int32_t)radius,
|
||||
(int32_t)start_angle, (int32_t)end_angle) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw arc failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
#endif/*LV_DRAW_COMPLEX*/
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_arc(draw_ctx, dsc, center, radius, start_angle, end_angle);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE*/
|
@ -1,143 +0,0 @@
|
||||
/**
|
||||
* @file lv_draw_pxp_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_PXP_BLEND_H
|
||||
#define LV_DRAW_PXP_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
|
||||
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
|
||||
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency*/
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity. This function can also
|
||||
* rotate the display output buffer to a specified angle (90x step).
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] opa opacity of the result
|
||||
* @param[in] angle display rotation angle (90x)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation.
|
||||
*
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_PXP_BLEND_H*/
|
@ -1,618 +0,0 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_blend.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_vglite_blend.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* Enable BLIT quality degradation workaround for RT595, recommended for screen's dimension > 352 pixels */
|
||||
#define RT595_BLIT_WRKRND_ENABLED 1
|
||||
|
||||
/* Internal compound symbol */
|
||||
#if (defined(CPU_MIMXRT595SFFOB) || defined(CPU_MIMXRT595SFFOB_cm33) || \
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BLIT split threshold - BLITs with width or height higher than this value will be done
|
||||
* in multiple steps. Value must be 16-aligned. Don't change.
|
||||
*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR 352
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - single direct BLIT.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
/**
|
||||
* Move buffer pointer as close as possible to area, but with respect to alignment requirements. X-axis only.
|
||||
*
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
*/
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf);
|
||||
|
||||
/**
|
||||
* Move buffer pointer to the area start and update variables, Y-axis only.
|
||||
*
|
||||
* @param[in,out] area Area to be updated
|
||||
* @param[in,out] buf Pointer to be updated
|
||||
* @param[in] stridePx Buffer stride in pixels
|
||||
*/
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx);
|
||||
|
||||
/**
|
||||
* Software BLIT as a fall-back scenario.
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
*/
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* Verify BLIT structure - widths, stride, pointer alignment
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
* @retval LV_RES_OK
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - split BLIT.
|
||||
*
|
||||
* @param[in] blit BLIT configuration
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_split(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
uint32_t area_size = lv_area_get_size(fill_area);
|
||||
lv_coord_t area_w = lv_area_get_width(fill_area);
|
||||
lv_coord_t area_h = lv_area_get_height(fill_area);
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(area_size < LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(area_size < LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", area_size, LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
vg_lite_buffer_t vgbuf;
|
||||
vg_lite_rectangle_t rect;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_color32_t col32 = {.full = lv_color_to32(color)}; /*Convert color to RGBA8888*/
|
||||
vg_lite_color_t vgcol; /* vglite takes ABGR */
|
||||
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *)dest_buf, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
if(opa >= (lv_opa_t)LV_OPA_MAX) { /*Opaque fill*/
|
||||
rect.x = fill_area->x1;
|
||||
rect.y = fill_area->y1;
|
||||
rect.width = area_w;
|
||||
rect.height = area_h;
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)col32.ch.alpha << 24) | ((uint32_t)col32.ch.blue << 16) | ((uint32_t)col32.ch.green << 8) |
|
||||
(uint32_t)col32.ch.red;
|
||||
#endif
|
||||
|
||||
err = vg_lite_clear(&vgbuf, &rect, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
}
|
||||
else { /*fill with transparency*/
|
||||
|
||||
vg_lite_path_t path;
|
||||
int32_t path_data[] = { /*VG rectangular path*/
|
||||
VLC_OP_MOVE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y1,
|
||||
VLC_OP_LINE, fill_area->x2 + 1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y2 + 1,
|
||||
VLC_OP_LINE, fill_area->x1, fill_area->y1,
|
||||
VLC_OP_END
|
||||
};
|
||||
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_LOW, sizeof(path_data), path_data,
|
||||
(vg_lite_float_t) fill_area->x1, (vg_lite_float_t) fill_area->y1,
|
||||
((vg_lite_float_t) fill_area->x2) + 1.0f, ((vg_lite_float_t) fill_area->y2) + 1.0f);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init path failed.");
|
||||
|
||||
/* Only pre-multiply color if hardware pre-multiplication is not present */
|
||||
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
col32.ch.red = (uint8_t)(((uint16_t)col32.ch.red * opa) >> 8);
|
||||
col32.ch.green = (uint8_t)(((uint16_t)col32.ch.green * opa) >> 8);
|
||||
col32.ch.blue = (uint8_t)(((uint16_t)col32.ch.blue * opa) >> 8);
|
||||
}
|
||||
col32.ch.alpha = opa;
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)col32.ch.alpha << 24) | ((uint32_t)col32.ch.blue << 16) | ((uint32_t)col32.ch.green << 8) |
|
||||
(uint32_t)col32.ch.red;
|
||||
#endif
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/*Draw rectangle*/
|
||||
err = vg_lite_draw(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw rectangle failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(&blit->dst_area);
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
return _lv_gpu_nxp_vglite_blit_split(blit);
|
||||
#endif /* non RT595 */
|
||||
|
||||
/* Just pass down */
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
uint32_t dest_size = lv_area_get_size(&blit->dst_area);
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT);
|
||||
}
|
||||
else {
|
||||
if(dest_size < LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT)
|
||||
VG_LITE_RETURN_INV("Area size %d smaller than limit %d.", dest_size, LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_split(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
lv_res_t rv = LV_RES_INV;
|
||||
|
||||
if(_lv_gpu_nxp_vglite_check_blit(blit) != LV_RES_OK) {
|
||||
PRINT_BLT("Blit check failed\n");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
PRINT_BLT("BLIT from: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->src_area.x1, blit->src_area.y1,
|
||||
blit->src_area.x2, blit->src_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
PRINT_BLT("BLIT to: "
|
||||
"Area: %03d,%03d - %03d,%03d "
|
||||
"Addr: %d\n\n",
|
||||
blit->dst_area.x1, blit->dst_area.y1,
|
||||
blit->dst_area.x2, blit->dst_area.y2,
|
||||
(uintptr_t) blit->src);
|
||||
|
||||
/* Stage 1: Move starting pointers as close as possible to [x1, y1], so coordinates are as small as possible. */
|
||||
_align_x(&blit->src_area, (lv_color_t **)&blit->src);
|
||||
_align_y(&blit->src_area, (lv_color_t **)&blit->src, blit->src_stride / sizeof(lv_color_t));
|
||||
_align_x(&blit->dst_area, (lv_color_t **)&blit->dst);
|
||||
_align_y(&blit->dst_area, (lv_color_t **)&blit->dst, blit->dst_stride / sizeof(lv_color_t));
|
||||
|
||||
/* Stage 2: If we're in limit, do a single BLIT */
|
||||
if((blit->src_area.x2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) &&
|
||||
(blit->src_area.y2 < LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR)) {
|
||||
PRINT_BLT("Simple blit!\n");
|
||||
return _lv_gpu_nxp_vglite_blit_single(blit);
|
||||
};
|
||||
|
||||
/* Stage 3: Split the BLIT into multiple tiles */
|
||||
PRINT_BLT("Split blit!\n");
|
||||
|
||||
PRINT_BLT("Blit "
|
||||
"([%03d,%03d], [%03d,%03d]) -> "
|
||||
"([%03d,%03d], [%03d,%03d]) | "
|
||||
"([%03dx%03d] -> [%03dx%03d]) | "
|
||||
"A:(%d -> %d)\n",
|
||||
blit->src_area.x1, blit->src_area.y1, blit->src_area.x2, blit->src_area.y2,
|
||||
blit->dst_area.x1, blit->dst_area.y1, blit->dst_area.x2, blit->dst_area.y2,
|
||||
lv_area_get_width(&blit->src_area), lv_area_get_height(&blit->src_area),
|
||||
lv_area_get_width(&blit->dst_area), lv_area_get_height(&blit->dst_area),
|
||||
(uintptr_t) blit->src, (uintptr_t) blit->dst);
|
||||
|
||||
|
||||
lv_coord_t totalWidth = lv_area_get_width(&blit->src_area);
|
||||
lv_coord_t totalHeight = lv_area_get_height(&blit->src_area);
|
||||
|
||||
lv_gpu_nxp_vglite_blit_info_t tileBlit;
|
||||
|
||||
/* Number of tiles needed */
|
||||
int totalTilesX = (blit->src_area.x1 + totalWidth + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
int totalTilesY = (blit->src_area.y1 + totalHeight + LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1) /
|
||||
LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
|
||||
/* src and dst buffer shift against each other. Src buffer real data [0,0] may start actually at [3,0] in buffer, as
|
||||
* the buffer pointer has to be aligned, while dst buffer real data [0,0] may start at [1,0] in buffer. alignment may be
|
||||
* different */
|
||||
int shiftSrcX = (blit->src_area.x1 > blit->dst_area.x1) ? (blit->src_area.x1 - blit->dst_area.x1) : 0;
|
||||
int shiftDstX = (blit->src_area.x1 < blit->dst_area.x1) ? (blit->dst_area.x1 - blit->src_area.x1) : 0;
|
||||
|
||||
PRINT_BLT("\n");
|
||||
PRINT_BLT("Align shift: src: %d, dst: %d\n", shiftSrcX, shiftDstX);
|
||||
|
||||
tileBlit = *blit;
|
||||
|
||||
for(int tileY = 0; tileY < totalTilesY; tileY++) {
|
||||
|
||||
tileBlit.src_area.y1 = 0; /* no vertical alignment, always start from 0 */
|
||||
tileBlit.src_area.y2 = totalHeight - tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.y2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.y2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1; /* Should never happen */
|
||||
}
|
||||
tileBlit.src = blit->src + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->src_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
tileBlit.dst_area.y1 = tileBlit.src_area.y1; /* y has no alignment, always in sync with src */
|
||||
tileBlit.dst_area.y2 = tileBlit.src_area.y2;
|
||||
|
||||
tileBlit.dst = blit->dst + tileY * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR * blit->dst_stride / sizeof(
|
||||
lv_color_t); /* stride in px! */
|
||||
|
||||
for(int tileX = 0; tileX < totalTilesX; tileX++) {
|
||||
|
||||
if(tileX == 0) {
|
||||
/* 1st tile is special - there may be a gap between buffer start pointer
|
||||
* and area.x1 value, as the pointer has to be aligned.
|
||||
* tileBlit.src pointer - keep init value from Y-loop.
|
||||
* Also, 1st tile start is not shifted! shift is applied from 2nd tile */
|
||||
tileBlit.src_area.x1 = blit->src_area.x1;
|
||||
tileBlit.dst_area.x1 = blit->dst_area.x1;
|
||||
}
|
||||
else {
|
||||
/* subsequent tiles always starts from 0, but shifted*/
|
||||
tileBlit.src_area.x1 = 0 + shiftSrcX;
|
||||
tileBlit.dst_area.x1 = 0 + shiftDstX;
|
||||
/* and advance start pointer + 1 tile size */
|
||||
tileBlit.src += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
tileBlit.dst += LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR;
|
||||
}
|
||||
|
||||
/* Clip tile end coordinates */
|
||||
tileBlit.src_area.x2 = totalWidth + blit->src_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.src_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.src_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
tileBlit.dst_area.x2 = totalWidth + blit->dst_area.x1 - tileX * LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
if(tileBlit.dst_area.x2 >= LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR) {
|
||||
tileBlit.dst_area.x2 = LV_GPU_NXP_VG_LITE_BLIT_SPLIT_THR - 1;
|
||||
}
|
||||
|
||||
if(tileX < (totalTilesX - 1)) {
|
||||
/* And adjust end coords if shifted, but not for last tile! */
|
||||
tileBlit.src_area.x2 += shiftSrcX;
|
||||
tileBlit.dst_area.x2 += shiftDstX;
|
||||
}
|
||||
|
||||
rv = _lv_gpu_nxp_vglite_blit_single(&tileBlit);
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
lv_vglite_dbg_draw_rectangle((lv_color_t *) tileBlit.dst, tileBlit.dst_width, tileBlit.dst_height, &tileBlit.dst_area,
|
||||
LV_COLOR_RED);
|
||||
lv_vglite_dbg_draw_rectangle((lv_color_t *) tileBlit.src, tileBlit.src_width, tileBlit.src_height, &tileBlit.src_area,
|
||||
LV_COLOR_GREEN);
|
||||
#endif
|
||||
|
||||
PRINT_BLT("Tile [%d, %d]: "
|
||||
"([%d,%d], [%d,%d]) -> "
|
||||
"([%d,%d], [%d,%d]) | "
|
||||
"([%dx%d] -> [%dx%d]) | "
|
||||
"A:(0x%8X -> 0x%8X) %s\n",
|
||||
tileX, tileY,
|
||||
tileBlit.src_area.x1, tileBlit.src_area.y1, tileBlit.src_area.x2, tileBlit.src_area.y2,
|
||||
tileBlit.dst_area.x1, tileBlit.dst_area.y1, tileBlit.dst_area.x2, tileBlit.dst_area.y2,
|
||||
lv_area_get_width(&tileBlit.src_area), lv_area_get_height(&tileBlit.src_area),
|
||||
lv_area_get_width(&tileBlit.dst_area), lv_area_get_height(&tileBlit.dst_area),
|
||||
(uintptr_t) tileBlit.src, (uintptr_t) tileBlit.dst,
|
||||
rv == LV_RES_OK ? "OK!" : "!!! FAILED !!!");
|
||||
|
||||
if(rv != LV_RES_OK) { /* if anything goes wrong... */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("Split blit failed. Trying SW blit instead.");
|
||||
#endif
|
||||
_sw_blit(&tileBlit);
|
||||
rv = LV_RES_OK; /* Don't report error, as SW BLIT was performed */
|
||||
}
|
||||
|
||||
}
|
||||
PRINT_BLT(" \n");
|
||||
}
|
||||
|
||||
return rv; /* should never fail */
|
||||
}
|
||||
#endif /* VG_LITE_BLIT_SPLIT_ENABLED */
|
||||
|
||||
static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
vg_lite_buffer_t src_vgbuf, dst_vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
uint32_t rect[4];
|
||||
vg_lite_float_t scale = 1.0;
|
||||
|
||||
if(blit == NULL) {
|
||||
/*Wrong parameter*/
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(blit->opa < (lv_opa_t) LV_OPA_MIN) {
|
||||
return LV_RES_OK; /*Nothing to BLIT*/
|
||||
}
|
||||
|
||||
/*Wrap src/dst buffer into VG-Lite buffer*/
|
||||
if(lv_vglite_init_buf(&src_vgbuf, (uint32_t)blit->src_width, (uint32_t)blit->src_height, (uint32_t)blit->src_stride,
|
||||
blit->src, true) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
if(lv_vglite_init_buf(&dst_vgbuf, (uint32_t)blit->dst_width, (uint32_t)blit->dst_height, (uint32_t)blit->dst_stride,
|
||||
blit->dst, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
rect[0] = (uint32_t)blit->src_area.x1; /* start x */
|
||||
rect[1] = (uint32_t)blit->src_area.y1; /* start y */
|
||||
rect[2] = (uint32_t)blit->src_area.x2 - (uint32_t)blit->src_area.x1 + 1U; /* width */
|
||||
rect[3] = (uint32_t)blit->src_area.y2 - (uint32_t)blit->src_area.y1 + 1U; /* height */
|
||||
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
vg_lite_translate((vg_lite_float_t)blit->dst_area.x1, (vg_lite_float_t)blit->dst_area.y1, &matrix);
|
||||
|
||||
if((blit->angle != 0) || (blit->zoom != LV_IMG_ZOOM_NONE)) {
|
||||
vg_lite_translate(blit->pivot.x, blit->pivot.y, &matrix);
|
||||
vg_lite_rotate(blit->angle / 10.0f, &matrix); /* angle is 1/10 degree */
|
||||
scale = 1.0f * blit->zoom / LV_IMG_ZOOM_NONE;
|
||||
vg_lite_scale(scale, scale, &matrix);
|
||||
vg_lite_translate(0.0f - blit->pivot.x, 0.0f - blit->pivot.y, &matrix);
|
||||
}
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
uint32_t color;
|
||||
vg_lite_blend_t blend;
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
color = 0xFFFFFFFFU;
|
||||
blend = VG_LITE_BLEND_SRC_OVER;
|
||||
src_vgbuf.transparency_mode = VG_LITE_IMAGE_TRANSPARENT;
|
||||
}
|
||||
else {
|
||||
uint32_t opa = (uint32_t)blit->opa;
|
||||
if(vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
color = (opa << 24) | 0x00FFFFFFU;
|
||||
}
|
||||
else {
|
||||
color = (opa << 24) | (opa << 16) | (opa << 8) | opa;
|
||||
}
|
||||
blend = VG_LITE_BLEND_SRC_OVER;
|
||||
src_vgbuf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
src_vgbuf.transparency_mode = VG_LITE_IMAGE_TRANSPARENT;
|
||||
}
|
||||
|
||||
err = vg_lite_blit_rect(&dst_vgbuf, &src_vgbuf, rect, &matrix, blend, color, VG_LITE_FILTER_POINT);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Blit rectangle failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
static void _sw_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&blit->src_area);
|
||||
lv_coord_t h = lv_area_get_height(&blit->src_area);
|
||||
|
||||
int32_t srcStridePx = blit->src_stride / (int32_t)sizeof(lv_color_t);
|
||||
int32_t dstStridePx = blit->dst_stride / (int32_t)sizeof(lv_color_t);
|
||||
|
||||
lv_color_t * src = (lv_color_t *)blit->src + blit->src_area.y1 * srcStridePx + blit->src_area.x1;
|
||||
lv_color_t * dst = (lv_color_t *)blit->dst + blit->dst_area.y1 * dstStridePx + blit->dst_area.x1;
|
||||
|
||||
if(blit->opa >= (lv_opa_t)LV_OPA_MAX) {
|
||||
/* simple copy */
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(dst, src, (uint32_t)w * sizeof(lv_color_t));
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
else if(blit->opa >= LV_OPA_MIN) {
|
||||
/* alpha blending */
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dst[x] = lv_color_mix(src[x], dst[x], blit->opa);
|
||||
}
|
||||
src += srcStridePx;
|
||||
dst += dstStridePx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * blit)
|
||||
{
|
||||
|
||||
/* Test for minimal width */
|
||||
if(lv_area_get_width(&blit->src_area) < (lv_coord_t)LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX)
|
||||
VG_LITE_RETURN_INV("Src area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->src_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for minimal width */
|
||||
if(lv_area_get_width(&blit->dst_area) < (lv_coord_t)LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX)
|
||||
VG_LITE_RETURN_INV("Dest area width (%d) is smaller than required (%d).", lv_area_get_width(&blit->dst_area),
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for pointer alignment */
|
||||
if((((uintptr_t) blit->src) % LV_ATTRIBUTE_MEM_ALIGN_SIZE) != 0x0)
|
||||
VG_LITE_RETURN_INV("Src buffer ptr (0x%X) not aligned to %d.", (size_t) blit->src, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
|
||||
/* No alignment requirement for destination pixel buffer when using mode VG_LITE_LINEAR */
|
||||
|
||||
/* Test for stride alignment */
|
||||
if((blit->src_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0)
|
||||
VG_LITE_RETURN_INV("Src buffer stride (%d px) not aligned to %d px.", blit->src_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
/* Test for stride alignment */
|
||||
if((blit->dst_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0)
|
||||
VG_LITE_RETURN_INV("Dest buffer stride (%d px) not aligned to %d px.", blit->dst_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
|
||||
if((lv_area_get_width(&blit->src_area) != lv_area_get_width(&blit->dst_area)) ||
|
||||
(lv_area_get_height(&blit->src_area) != lv_area_get_height(&blit->dst_area)))
|
||||
VG_LITE_RETURN_INV("Src and dest buffer areas are not equal.");
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf)
|
||||
{
|
||||
|
||||
int alignedAreaStartPx = area->x1 - (area->x1 % (LV_ATTRIBUTE_MEM_ALIGN_SIZE * 8 / LV_COLOR_DEPTH));
|
||||
VG_LITE_COND_STOP(alignedAreaStartPx < 0, "Negative X alignment.");
|
||||
|
||||
area->x1 -= alignedAreaStartPx;
|
||||
area->x2 -= alignedAreaStartPx;
|
||||
*buf += alignedAreaStartPx;
|
||||
}
|
||||
|
||||
static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx)
|
||||
{
|
||||
int LineToAlignMem;
|
||||
int alignedAreaStartPy;
|
||||
/* find how many lines of pixels will respect memory alignment requirement */
|
||||
if(stridePx % (uint32_t)LV_ATTRIBUTE_MEM_ALIGN_SIZE == 0U) {
|
||||
alignedAreaStartPy = area->y1;
|
||||
}
|
||||
else {
|
||||
LineToAlignMem = LV_ATTRIBUTE_MEM_ALIGN_SIZE / (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
VG_LITE_COND_STOP(LV_ATTRIBUTE_MEM_ALIGN_SIZE % (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX),
|
||||
"Complex case: need gcd function.");
|
||||
alignedAreaStartPy = area->y1 - (area->y1 % LineToAlignMem);
|
||||
VG_LITE_COND_STOP(alignedAreaStartPy < 0, "Negative Y alignment.");
|
||||
}
|
||||
|
||||
area->y1 -= alignedAreaStartPy;
|
||||
area->y2 -= alignedAreaStartPy;
|
||||
*buf += (uint32_t)alignedAreaStartPy * stridePx;
|
||||
}
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -1,149 +0,0 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_BLEND_H
|
||||
#define LV_DRAW_VGLITE_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with transparency*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by VG-Lite during buffer sync */
|
||||
#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer descriptor structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
const lv_color_t * src; /**< Source buffer pointer (must be aligned on 32 bytes)*/
|
||||
lv_area_t src_area; /**< Area to be copied from source*/
|
||||
lv_coord_t src_width; /**< Source buffer width*/
|
||||
lv_coord_t src_height; /**< Source buffer height*/
|
||||
int32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
const lv_color_t * dst; /**< Destination buffer pointer (must be aligned on 32 bytes)*/
|
||||
lv_area_t dst_area; /**< Target area in destination buffer (must be the same as src_area)*/
|
||||
lv_coord_t dst_width; /**< Destination buffer width*/
|
||||
lv_coord_t dst_height; /**< Destination buffer height*/
|
||||
int32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
lv_opa_t opa; /**< Opacity - alpha mix (0 = source not copied, 255 = 100% opaque)*/
|
||||
uint32_t angle; /**< Rotation angle (1/10 of degree)*/
|
||||
uint32_t zoom; /**< 256 = no zoom (1:1 scale ratio)*/
|
||||
lv_point_t pivot; /**< The coordinates of rotation pivot in source image buffer*/
|
||||
} lv_gpu_nxp_vglite_blit_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf Destination buffer pointer (must be aligned on 32 bytes)
|
||||
* @param[in] dest_width Destination buffer width in pixels (must be aligned on 16 px)
|
||||
* @param[in] dest_height Destination buffer height in pixels
|
||||
* @param[in] fill_area Area to be filled
|
||||
* @param[in] color Fill color
|
||||
* @param[in] opa Opacity (255 = full, 128 = 50% background/50% color, 0 = no fill)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer with transformation.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_BLEND_H*/
|
@ -1,244 +0,0 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_rect.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_draw_vglite_rect.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords)
|
||||
{
|
||||
vg_lite_buffer_t vgbuf;
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
lv_coord_t dest_width = lv_area_get_width(draw_ctx->buf_area);
|
||||
lv_coord_t dest_height = lv_area_get_height(draw_ctx->buf_area);
|
||||
vg_lite_path_t path;
|
||||
vg_lite_color_t vgcol; /* vglite takes ABGR */
|
||||
vg_lite_matrix_t matrix;
|
||||
lv_coord_t width = lv_area_get_width(coords);
|
||||
lv_coord_t height = lv_area_get_height(coords);
|
||||
vg_lite_linear_gradient_t gradient;
|
||||
vg_lite_matrix_t * grad_matrix;
|
||||
|
||||
if(dsc->radius < 0)
|
||||
return LV_RES_INV;
|
||||
|
||||
/* Make areas relative to draw buffer */
|
||||
lv_area_t rel_coords;
|
||||
lv_area_copy(&rel_coords, coords);
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t rel_clip;
|
||||
lv_area_copy(&rel_clip, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
/*** Init destination buffer ***/
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *)draw_ctx->buf, false) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Init buffer failed.");
|
||||
|
||||
/*** Init path ***/
|
||||
int32_t rad = dsc->radius;
|
||||
if(dsc->radius == LV_RADIUS_CIRCLE) {
|
||||
rad = (width > height) ? height / 2 : width / 2;
|
||||
}
|
||||
|
||||
if((dsc->radius == LV_RADIUS_CIRCLE) && (width == height)) {
|
||||
float tang = ((float)rad * BEZIER_OPTIM_CIRCLE);
|
||||
int32_t cpoff = (int32_t)tang;
|
||||
int32_t circle_path[] = { /*VG circle path*/
|
||||
VLC_OP_MOVE, rel_coords.x1 + rad, rel_coords.y1,
|
||||
VLC_OP_CUBIC_REL, cpoff, 0, rad, rad - cpoff, rad, rad, /* top-right */
|
||||
VLC_OP_CUBIC_REL, 0, cpoff, cpoff - rad, rad, 0 - rad, rad, /* bottom-right */
|
||||
VLC_OP_CUBIC_REL, 0 - cpoff, 0, 0 - rad, cpoff - rad, 0 - rad, 0 - rad, /* bottom-left */
|
||||
VLC_OP_CUBIC_REL, 0, 0 - cpoff, rad - cpoff, 0 - rad, rad, 0 - rad, /* top-left */
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_HIGH, sizeof(circle_path), circle_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
else if(dsc->radius > 0) {
|
||||
float tang = ((float)rad * BEZIER_OPTIM_CIRCLE);
|
||||
int32_t cpoff = (int32_t)tang;
|
||||
int32_t rounded_path[] = { /*VG rounded rectangular path*/
|
||||
VLC_OP_MOVE, rel_coords.x1 + rad, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 - rad + 1, rel_coords.y1, /* top */
|
||||
VLC_OP_CUBIC_REL, cpoff, 0, rad, rad - cpoff, rad, rad, /* top-right */
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y2 - rad + 1, /* right */
|
||||
VLC_OP_CUBIC_REL, 0, cpoff, cpoff - rad, rad, 0 - rad, rad, /* bottom-right */
|
||||
VLC_OP_LINE, rel_coords.x1 + rad, rel_coords.y2 + 1, /* bottom */
|
||||
VLC_OP_CUBIC_REL, 0 - cpoff, 0, 0 - rad, cpoff - rad, 0 - rad, 0 - rad, /* bottom-left */
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y1 + rad, /* left */
|
||||
VLC_OP_CUBIC_REL, 0, 0 - cpoff, rad - cpoff, 0 - rad, rad, 0 - rad, /* top-left */
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_HIGH, sizeof(rounded_path), rounded_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
else {
|
||||
int32_t rect_path[] = { /*VG rectangular path*/
|
||||
VLC_OP_MOVE, rel_coords.x1, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y1,
|
||||
VLC_OP_LINE, rel_coords.x2 + 1, rel_coords.y2 + 1,
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y2 + 1,
|
||||
VLC_OP_LINE, rel_coords.x1, rel_coords.y1,
|
||||
VLC_OP_END
|
||||
};
|
||||
err = vg_lite_init_path(&path, VG_LITE_S32, VG_LITE_LOW, sizeof(rect_path), rect_path,
|
||||
(vg_lite_float_t) rel_clip.x1, (vg_lite_float_t) rel_clip.y1,
|
||||
((vg_lite_float_t) rel_clip.x2) + 1.0f, ((vg_lite_float_t) rel_clip.y2) + 1.0f);
|
||||
}
|
||||
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init path failed.");
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/*** Init Color/Gradient ***/
|
||||
if(dsc->bg_grad.dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
uint32_t colors[2];
|
||||
uint32_t stops[2];
|
||||
lv_color32_t col32[2];
|
||||
|
||||
/* Gradient setup */
|
||||
uint8_t cnt = MAX(dsc->bg_grad.stops_count, 2);
|
||||
for(uint8_t i = 0; i < cnt; i++) {
|
||||
col32[i].full = lv_color_to32(dsc->bg_grad.stops[i].color); /*Convert color to RGBA8888*/
|
||||
stops[i] = dsc->bg_grad.stops[i].frac;
|
||||
#if LV_COLOR_DEPTH==16
|
||||
colors[i] = ((uint32_t)col32[i].ch.alpha << 24) | ((uint32_t)col32[i].ch.blue << 16) |
|
||||
((uint32_t)col32[i].ch.green << 8) | (uint32_t)col32[i].ch.red;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
/* watchout: red and blue color components are inverted versus vg_lite_color_t order */
|
||||
colors[i] = ((uint32_t)col32[i].ch.alpha << 24) | ((uint32_t)col32[i].ch.red << 16) |
|
||||
((uint32_t)col32[i].ch.green << 8) | (uint32_t)col32[i].ch.blue;
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_memset_00(&gradient, sizeof(vg_lite_linear_gradient_t));
|
||||
|
||||
err = vg_lite_init_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init gradient failed");
|
||||
|
||||
err = vg_lite_set_grad(&gradient, cnt, colors, stops);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Set gradient failed.");
|
||||
|
||||
err = vg_lite_update_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Update gradient failed.");
|
||||
|
||||
grad_matrix = vg_lite_get_grad_matrix(&gradient);
|
||||
vg_lite_identity(grad_matrix);
|
||||
vg_lite_translate((float)rel_coords.x1, (float)rel_coords.y1, grad_matrix);
|
||||
|
||||
if(dsc->bg_grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_VER) {
|
||||
vg_lite_scale(1.0f, (float)height / 256.0f, grad_matrix);
|
||||
vg_lite_rotate(90.0f, grad_matrix);
|
||||
}
|
||||
else { /*LV_GRAD_DIR_HOR*/
|
||||
vg_lite_scale((float)width / 256.0f, 1.0f, grad_matrix);
|
||||
}
|
||||
}
|
||||
|
||||
lv_opa_t bg_opa = dsc->bg_opa;
|
||||
lv_color32_t bg_col32 = {.full = lv_color_to32(dsc->bg_color)}; /*Convert color to RGBA8888*/
|
||||
if(bg_opa <= (lv_opa_t)LV_OPA_MAX) {
|
||||
/* Only pre-multiply color if hardware pre-multiplication is not present */
|
||||
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_PE_PREMULTIPLY)) {
|
||||
bg_col32.ch.red = (uint8_t)(((uint16_t)bg_col32.ch.red * bg_opa) >> 8);
|
||||
bg_col32.ch.green = (uint8_t)(((uint16_t)bg_col32.ch.green * bg_opa) >> 8);
|
||||
bg_col32.ch.blue = (uint8_t)(((uint16_t)bg_col32.ch.blue * bg_opa) >> 8);
|
||||
}
|
||||
bg_col32.ch.alpha = bg_opa;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
vgcol = bg_col32.full;
|
||||
#else /*LV_COLOR_DEPTH==32*/
|
||||
vgcol = ((uint32_t)bg_col32.ch.alpha << 24) | ((uint32_t)bg_col32.ch.blue << 16) |
|
||||
((uint32_t)bg_col32.ch.green << 8) | (uint32_t)bg_col32.ch.red;
|
||||
#endif
|
||||
|
||||
/*Clean & invalidate cache*/
|
||||
lv_vglite_invalidate_cache();
|
||||
|
||||
/*** Draw rectangle ***/
|
||||
if(dsc->bg_grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
err = vg_lite_draw(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
}
|
||||
else {
|
||||
err = vg_lite_draw_gradient(&vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, &gradient, VG_LITE_BLEND_SRC_OVER);
|
||||
}
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw gradient failed.");
|
||||
|
||||
err = vg_lite_finish();
|
||||
VG_LITE_ERR_RETURN_INV(err, "Finish failed.");
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
if(dsc->bg_grad.dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
err = vg_lite_clear_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear gradient failed.");
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -1,153 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.c
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "../../../core/lv_refr.h"
|
||||
#if BLIT_DBG_AREAS
|
||||
#include "lv_draw_vglite_blend.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_DEPTH==16
|
||||
#define VG_LITE_PX_FMT VG_LITE_RGB565
|
||||
#elif LV_COLOR_DEPTH==32
|
||||
#define VG_LITE_PX_FMT VG_LITE_BGRA8888
|
||||
#else
|
||||
#error Only 16bit and 32bit color depth are supported. Set LV_COLOR_DEPTH to 16 or 32.
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_res_t lv_vglite_init_buf(vg_lite_buffer_t * vgbuf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source)
|
||||
{
|
||||
/*Test for memory alignment*/
|
||||
if((((uintptr_t)ptr) % (uintptr_t)LV_ATTRIBUTE_MEM_ALIGN_SIZE) != (uintptr_t)0x0U)
|
||||
VG_LITE_RETURN_INV("%s buffer (0x%x) not aligned to %d.", source ? "Src" : "Dest",
|
||||
(size_t) ptr, LV_ATTRIBUTE_MEM_ALIGN_SIZE);
|
||||
|
||||
/*Test for stride alignment*/
|
||||
if(source && (stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t))) != 0x0U)
|
||||
VG_LITE_RETURN_INV("Src buffer stride (%d bytes) not aligned to %d bytes.", stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t));
|
||||
|
||||
vgbuf->format = VG_LITE_PX_FMT;
|
||||
vgbuf->tiled = VG_LITE_LINEAR;
|
||||
vgbuf->image_mode = VG_LITE_NORMAL_IMAGE_MODE;
|
||||
vgbuf->transparency_mode = VG_LITE_IMAGE_OPAQUE;
|
||||
|
||||
vgbuf->width = (int32_t)width;
|
||||
vgbuf->height = (int32_t)height;
|
||||
vgbuf->stride = (int32_t)stride;
|
||||
|
||||
lv_memset_00(&vgbuf->yuv, sizeof(vgbuf->yuv));
|
||||
|
||||
vgbuf->memory = (void *)ptr;
|
||||
vgbuf->address = (uint32_t)vgbuf->memory;
|
||||
vgbuf->handle = NULL;
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
void lv_vglite_dbg_draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color)
|
||||
{
|
||||
lv_area_t a;
|
||||
|
||||
/* top line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y1;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
|
||||
/* bottom line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y2;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* left line */
|
||||
a.x1 = fill_area->x1;
|
||||
a.x2 = fill_area->x1;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
|
||||
/* right line */
|
||||
a.x1 = fill_area->x2;
|
||||
a.x2 = fill_area->x2;
|
||||
a.y1 = fill_area->y1;
|
||||
a.y2 = fill_area->y2;
|
||||
lv_gpu_nxp_vglite_fill(dest_buf, dest_width, dest_height, &a, color, LV_OPA_COVER);
|
||||
}
|
||||
#endif /* BLIT_DBG_AREAS */
|
||||
|
||||
void lv_vglite_invalidate_cache(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->clean_dcache_cb)
|
||||
disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
@ -1,265 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_stm32_dma2d.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_gpu_stm32_dma2d.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
|
||||
#include LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
// TODO: F7 has red blue swap bit in control register for all layers and output
|
||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#error "Can't use DMA2D with LV_COLOR_DEPTH == 8"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_RGB565
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_ARGB8888
|
||||
#else
|
||||
/*Can't use GPU with other formats*/
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void lv_draw_stm32_dma2d_blend_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color);
|
||||
|
||||
|
||||
static void lv_draw_stm32_dma2d_blend_map(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_coord_t src_stride, lv_opa_t opa);
|
||||
|
||||
static void lv_draw_stm32_dma2d_img_decoded(lv_draw_ctx_t * draw, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format);
|
||||
|
||||
|
||||
static void invalidate_cache(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||
*/
|
||||
void lv_draw_stm32_dma2d_init(void)
|
||||
{
|
||||
/*Enable DMA2D clock*/
|
||||
#if defined(STM32F4) || defined(STM32F7)
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
|
||||
#elif defined(STM32H7)
|
||||
RCC->AHB3ENR |= RCC_AHB3ENR_DMA2DEN;
|
||||
#else
|
||||
# warning "LVGL can't enable the clock of DMA2D"
|
||||
#endif
|
||||
|
||||
/*Wait for hardware access to complete*/
|
||||
__asm volatile("DSB\n");
|
||||
|
||||
/*Delay after setting peripheral clock*/
|
||||
volatile uint32_t temp = RCC->AHB1ENR;
|
||||
LV_UNUSED(temp);
|
||||
|
||||
/*set output colour mode*/
|
||||
DMA2D->OPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
}
|
||||
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
|
||||
lv_draw_stm32_dma2d_ctx_t * dma2d_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
|
||||
|
||||
dma2d_draw_ctx->blend = lv_draw_stm32_dma2d_blend;
|
||||
// dma2d_draw_ctx->base_draw.draw_img_decoded = lv_draw_stm32_dma2d_img_decoded;
|
||||
dma2d_draw_ctx->base_draw.wait_for_finish = lv_gpu_stm32_dma2d_wait_cb;
|
||||
dma2d_draw_ctx->base_draw.buffer_copy = lv_draw_stm32_dma2d_buffer_copy;
|
||||
|
||||
}
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
LV_UNUSED(drv);
|
||||
LV_UNUSED(draw_ctx);
|
||||
}
|
||||
|
||||
|
||||
void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
lv_area_t blend_area;
|
||||
if(!_lv_area_intersect(&blend_area, dsc->blend_area, draw_ctx->clip_area)) return;
|
||||
|
||||
bool done = false;
|
||||
|
||||
if(dsc->mask_buf == NULL && dsc->blend_mode == LV_BLEND_MODE_NORMAL && lv_area_get_size(&blend_area) > 100) {
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
dest_buf += dest_stride * (blend_area.y1 - draw_ctx->buf_area->y1) + (blend_area.x1 - draw_ctx->buf_area->x1);
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
if(src_buf) {
|
||||
lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
lv_coord_t src_stride;
|
||||
src_stride = lv_area_get_width(dsc->blend_area);
|
||||
src_buf += src_stride * (blend_area.y1 - dsc->blend_area->y1) + (blend_area.x1 - dsc->blend_area->x1);
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
lv_draw_stm32_dma2d_blend_map(dest_buf, &blend_area, dest_stride, src_buf, src_stride, dsc->opa);
|
||||
done = true;
|
||||
}
|
||||
else if(dsc->opa >= LV_OPA_MAX) {
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
lv_draw_stm32_dma2d_blend_fill(dest_buf, dest_stride, &blend_area, dsc->color);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!done) lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area)
|
||||
{
|
||||
LV_UNUSED(draw_ctx);
|
||||
lv_draw_stm32_dma2d_blend_map(dest_buf, dest_area, dest_stride, src_buf, src_stride, LV_OPA_MAX);
|
||||
}
|
||||
|
||||
|
||||
static void lv_draw_stm32_dma2d_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format)
|
||||
{
|
||||
/*TODO basic ARGB8888 image can be handles here*/
|
||||
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, color_format);
|
||||
}
|
||||
|
||||
static void lv_draw_stm32_dma2d_blend_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color)
|
||||
{
|
||||
/*Simply fill an area*/
|
||||
int32_t area_w = lv_area_get_width(fill_area);
|
||||
int32_t area_h = lv_area_get_height(fill_area);
|
||||
invalidate_cache();
|
||||
|
||||
DMA2D->CR = 0x30000;
|
||||
DMA2D->OMAR = (uint32_t)dest_buf;
|
||||
/*as input color mode is same as output we don't need to convert here do we?*/
|
||||
DMA2D->OCOLR = color.full;
|
||||
DMA2D->OOR = dest_stride - area_w;
|
||||
DMA2D->NLR = (area_w << DMA2D_NLR_PL_Pos) | (area_h << DMA2D_NLR_NL_Pos);
|
||||
|
||||
/*start transfer*/
|
||||
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void lv_draw_stm32_dma2d_blend_map(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_coord_t src_stride, lv_opa_t opa)
|
||||
{
|
||||
|
||||
/*Simple copy*/
|
||||
int32_t dest_w = lv_area_get_width(dest_area);
|
||||
int32_t dest_h = lv_area_get_height(dest_area);
|
||||
|
||||
invalidate_cache();
|
||||
if(opa >= LV_OPA_MAX) {
|
||||
DMA2D->CR = 0;
|
||||
/*copy output colour mode, this register controls both input and output colour format*/
|
||||
DMA2D->FGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
DMA2D->FGMAR = (uint32_t)src_buf;
|
||||
DMA2D->FGOR = src_stride - dest_w;
|
||||
DMA2D->OMAR = (uint32_t)dest_buf;
|
||||
DMA2D->OOR = dest_stride - dest_w;
|
||||
DMA2D->NLR = (dest_w << DMA2D_NLR_PL_Pos) | (dest_h << DMA2D_NLR_NL_Pos);
|
||||
|
||||
/*start transfer*/
|
||||
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||
}
|
||||
else {
|
||||
DMA2D->CR = 0x20000;
|
||||
|
||||
DMA2D->BGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
DMA2D->BGMAR = (uint32_t)dest_buf;
|
||||
DMA2D->BGOR = dest_stride - dest_w;
|
||||
|
||||
DMA2D->FGPFCCR = (uint32_t)LV_DMA2D_COLOR_FORMAT
|
||||
/*alpha mode 2, replace with foreground * alpha value*/
|
||||
| (2 << DMA2D_FGPFCCR_AM_Pos)
|
||||
/*alpha value*/
|
||||
| (opa << DMA2D_FGPFCCR_ALPHA_Pos);
|
||||
DMA2D->FGMAR = (uint32_t)src_buf;
|
||||
DMA2D->FGOR = src_stride - dest_w;
|
||||
|
||||
DMA2D->OMAR = (uint32_t)dest_buf;
|
||||
DMA2D->OOR = dest_stride - dest_w;
|
||||
DMA2D->NLR = (dest_w << DMA2D_NLR_PL_Pos) | (dest_h << DMA2D_NLR_NL_Pos);
|
||||
|
||||
/*start transfer*/
|
||||
DMA2D->CR |= DMA2D_CR_START_Msk;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver && disp->driver->wait_cb) {
|
||||
while(DMA2D->CR & DMA2D_CR_START_Msk) {
|
||||
disp->driver->wait_cb(disp->driver);
|
||||
}
|
||||
}
|
||||
else {
|
||||
while(DMA2D->CR & DMA2D_CR_START_Msk);
|
||||
}
|
||||
lv_draw_sw_wait_for_finish(draw_ctx);
|
||||
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void invalidate_cache(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->clean_dcache_cb) disp->driver->clean_dcache_cb(disp->driver);
|
||||
else {
|
||||
#if __CORTEX_M >= 0x07
|
||||
if((SCB->CCR) & (uint32_t)SCB_CCR_DC_Msk)
|
||||
SCB_CleanInvalidateDCache();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
* @file lv_gpu_stm32_dma2d.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_STM32_DMA2D_H
|
||||
#define LV_GPU_STM32_DMA2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../misc/lv_color.h"
|
||||
#include "../../hal/lv_hal_disp.h"
|
||||
#include "../sw/lv_draw_sw.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_DMA2D_ARGB8888 0
|
||||
#define LV_DMA2D_RGB888 1
|
||||
#define LV_DMA2D_RGB565 2
|
||||
#define LV_DMA2D_ARGB1555 3
|
||||
#define LV_DMA2D_ARGB4444 4
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_stm32_dma2d_ctx_t;
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||
*/
|
||||
void lv_draw_stm32_dma2d_init(void);
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_STM32_DMA2D*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_STM32_DMA2D_H*/
|
Before Width: | Height: | Size: 12 KiB |
@ -1,237 +0,0 @@
|
||||
/**
|
||||
* @file lv_test_assert.c
|
||||
*
|
||||
* Copyright 2002-2010 Guillaume Cottenceau.
|
||||
*
|
||||
* This software may be freely redistributed under the terms
|
||||
* of the X11 license.
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "unity.h"
|
||||
#define PNG_DEBUG 3
|
||||
#include <png.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
//#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/"
|
||||
#define REF_IMGS_PATH "ref_imgs/"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
int width, height;
|
||||
png_byte color_type;
|
||||
png_byte bit_depth;
|
||||
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
int number_of_passes;
|
||||
png_bytep * row_pointers;
|
||||
}png_img_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static int read_png_file(png_img_t * p, const char* file_name);
|
||||
static void png_release(png_img_t * p);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
bool lv_test_assert_img_eq(const char * fn_ref)
|
||||
{
|
||||
char fn_ref_full[512];
|
||||
sprintf(fn_ref_full, "%s%s", REF_IMGS_PATH, fn_ref);
|
||||
|
||||
png_img_t p;
|
||||
int res = read_png_file(&p, fn_ref_full);
|
||||
if(res < 0) return false;
|
||||
uint8_t * screen_buf;
|
||||
|
||||
lv_obj_invalidate(lv_scr_act());
|
||||
lv_refr_now(NULL);
|
||||
|
||||
extern lv_color_t test_fb[];
|
||||
|
||||
screen_buf = (uint8_t *)test_fb;
|
||||
|
||||
uint8_t * ptr_act = NULL;
|
||||
const png_byte* ptr_ref = NULL;
|
||||
|
||||
bool err = false;
|
||||
int x, y, i_buf = 0;
|
||||
for (y = 0; y < p.height; y++) {
|
||||
png_byte* row = p.row_pointers[y];
|
||||
|
||||
for (x = 0; x < p.width; x++) {
|
||||
ptr_ref = &(row[x*3]);
|
||||
ptr_act = &(screen_buf[i_buf*4]);
|
||||
|
||||
uint32_t ref_px = 0;
|
||||
uint32_t act_px = 0;
|
||||
memcpy(&ref_px, ptr_ref, 3);
|
||||
memcpy(&act_px, ptr_act, 3);
|
||||
//printf("0xFF%06x, ", act_px);
|
||||
|
||||
uint8_t act_swap[3] = {ptr_act[2], ptr_act[1], ptr_act[0]};
|
||||
|
||||
if(memcmp(act_swap, ptr_ref, 3) != 0) {
|
||||
err = true;
|
||||
break;
|
||||
}
|
||||
i_buf++;
|
||||
}
|
||||
if(err) break;
|
||||
}
|
||||
|
||||
if(err) {
|
||||
uint32_t ref_px = 0;
|
||||
uint32_t act_px = 0;
|
||||
memcpy(&ref_px, ptr_ref, 3);
|
||||
memcpy(&act_px, ptr_act, 3);
|
||||
|
||||
FILE * f = fopen("../test_screenshot_error.h", "w");
|
||||
|
||||
fprintf(f, "//Diff in %s at (%d;%d), %x instead of %x)\n\n", fn_ref, x, y, act_px, ref_px);
|
||||
fprintf(f, "static const uint32_t test_screenshot_error_data[] = {\n");
|
||||
|
||||
i_buf = 0;
|
||||
for (y = 0; y < 480; y++) {
|
||||
fprintf(f, "\n");
|
||||
for (x = 0; x < 800; x++) {
|
||||
ptr_act = &(screen_buf[i_buf * 4]);
|
||||
act_px = 0;
|
||||
memcpy(&act_px, ptr_act, 3);
|
||||
fprintf(f, "0xFF%06X, ", act_px);
|
||||
i_buf++;
|
||||
}
|
||||
}
|
||||
fprintf(f, "};\n\n");
|
||||
|
||||
fprintf(f, "static lv_img_dsc_t test_screenshot_error_dsc = { \n"
|
||||
" .header.w = 800,\n"
|
||||
" .header.h = 480,\n"
|
||||
" .header.always_zero = 0,\n"
|
||||
" .header.cf = LV_IMG_CF_TRUE_COLOR,\n"
|
||||
" .data_size = 800 * 480 * 4,\n"
|
||||
" .data = test_screenshot_error_data};\n\n"
|
||||
"static inline void test_screenshot_error_show(void)\n"
|
||||
"{\n"
|
||||
" lv_obj_t * img = lv_img_create(lv_scr_act());\n"
|
||||
" lv_img_set_src(img, &test_screenshot_error_dsc);\n"
|
||||
"}\n");
|
||||
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
png_release(&p);
|
||||
|
||||
return !err;
|
||||
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static int read_png_file(png_img_t * p, const char* file_name)
|
||||
{
|
||||
char header[8]; // 8 is the maximum size that can be checked
|
||||
|
||||
/*open file and test for it being a png*/
|
||||
FILE *fp = fopen(file_name, "rb");
|
||||
if (!fp) {
|
||||
TEST_PRINTF("%s", "PNG file %s could not be opened for reading");
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t rcnt = fread(header, 1, 8, fp);
|
||||
if (rcnt != 8 || png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
||||
TEST_PRINTF("%s is not recognized as a PNG file", file_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*initialize stuff*/
|
||||
p->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
||||
if (!p->png_ptr) {
|
||||
TEST_PRINTF("%s", "png_create_read_struct failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p->info_ptr = png_create_info_struct(p->png_ptr);
|
||||
if (!p->info_ptr) {
|
||||
TEST_PRINTF("%s", "png_create_info_struct failed");
|
||||
return -1;
|
||||
}
|
||||
if (setjmp(png_jmpbuf(p->png_ptr))) {
|
||||
TEST_PRINTF("%s", "Error during init_io");
|
||||
return -1;
|
||||
}
|
||||
png_init_io(p->png_ptr, fp);
|
||||
png_set_sig_bytes(p->png_ptr, 8);
|
||||
|
||||
png_read_info(p->png_ptr, p->info_ptr);
|
||||
|
||||
p->width = png_get_image_width(p->png_ptr, p->info_ptr);
|
||||
p->height = png_get_image_height(p->png_ptr, p->info_ptr);
|
||||
p->color_type = png_get_color_type(p->png_ptr, p->info_ptr);
|
||||
p->bit_depth = png_get_bit_depth(p->png_ptr, p->info_ptr);
|
||||
|
||||
p->number_of_passes = png_set_interlace_handling(p->png_ptr);
|
||||
png_read_update_info(p->png_ptr, p->info_ptr);
|
||||
|
||||
/*read file*/
|
||||
if (setjmp(png_jmpbuf(p->png_ptr))) {
|
||||
TEST_PRINTF("%s", "Error during read_image");
|
||||
return -1;
|
||||
}
|
||||
p->row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * p->height);
|
||||
|
||||
int y;
|
||||
for (y=0; y<p->height; y++)
|
||||
p->row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(p->png_ptr,p->info_ptr));
|
||||
|
||||
png_read_image(p->png_ptr, p->row_pointers);
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void png_release(png_img_t * p)
|
||||
{
|
||||
int y;
|
||||
for (y=0; y<p->height; y++) free(p->row_pointers[y]);
|
||||
|
||||
free(p->row_pointers);
|
||||
|
||||
png_destroy_read_struct(&p->png_ptr, &p->info_ptr, NULL);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
1
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
open_collective: lvgl
|
44
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a bug report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
IMPORTANT
|
||||
Issues that don't use this template will be ignored and closed.
|
||||
-->
|
||||
|
||||
### Perform all steps below and tick them with [x]
|
||||
- [ ] Read the [FAQ](https://docs.lvgl.io/master/intro/index.html#faq)
|
||||
- [ ] Check the related part of the [Documentation](https://docs.lvgl.io/)
|
||||
- [ ] Update lvgl to the latest version
|
||||
- [ ] Reproduce the issue in a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html)
|
||||
|
||||
### Describe the bug
|
||||
<!--
|
||||
A clear and concise description of what the bug is.
|
||||
-->
|
||||
|
||||
### To Reproduce
|
||||
<!--
|
||||
Provide a small, independent code sample that can be used to reproduce the issue.
|
||||
Ideally this should work in the PC simulator unless the problem is specific to a platform.
|
||||
Format the code like this:
|
||||
```c
|
||||
your code here
|
||||
```
|
||||
-->
|
||||
|
||||
### Expected behavior
|
||||
<!--
|
||||
A clear and concise description of what you expected to happen.
|
||||
-->
|
||||
|
||||
### Screenshots or video
|
||||
<!--
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
14
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Documentation
|
||||
url: https://docs.lvgl.io
|
||||
about: Be sure to read to documentation first
|
||||
- name: Forum
|
||||
url: https://forum.lvgl.io
|
||||
about: For topics like How-to, Getting started, Feature request
|
||||
- name: CONTIBUTING.md
|
||||
url: https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md#faq-about-contributing
|
||||
about: The basic rules of contributing
|
||||
- name: CODING_STYLE.md
|
||||
url: https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md
|
||||
about: Quick summary of LVGL's code style
|
29
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/ISSUE_TEMPLATE/dev-discussion.md
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Development discussion
|
||||
about: Discussion strictly related to the development of the LVGL.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!--
|
||||
IMPORTANT
|
||||
Issues that don't use this template will be ignored and closed.
|
||||
|
||||
Normal Feature requests should go to the Forum: https://forum.lvgl.io/c/feature-request/9
|
||||
-->
|
||||
|
||||
### Introduce the problem
|
||||
<!--
|
||||
A clear and concise description of the problem.
|
||||
-->
|
||||
|
||||
### Examples and cases
|
||||
<!--
|
||||
Mention some examples and cases where the problem or the missing feature is relevant
|
||||
-->
|
||||
|
||||
### Suggested solution
|
||||
<!--
|
||||
If you already have an idea about the solution share it here
|
||||
-->
|
12
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/auto-comment.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Comment to a new issue.
|
||||
pullRequestOpened: |
|
||||
Thank you for raising your pull request.
|
||||
|
||||
To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin).
|
||||
|
||||
The text of DCO can be read here: https://developercertificate.org/
|
||||
For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site.
|
||||
|
||||
By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO.
|
||||
|
||||
No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment.
|
10
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
A clear and concise description of what the bug or new feature is.
|
||||
|
||||
- Update the [Documentation](https://github.com/lvgl/lvgl/tree/master/docs) if needed.
|
||||
- Add [Examples](https://github.com/lvgl/lvgl/tree/master/examples) if relevant.
|
||||
- Add [Tests](https://github.com/lvgl/lvgl/blob/master/tests/README.md) if applicable.
|
||||
- If you added new options to `lv_conf_template.h` run [lv_conf_internal_gen.py](https://github.com/lvgl/lvgl/blob/master/scripts/lv_conf_internal_gen.py) and update [Kconfig](https://github.com/lvgl/lvgl/blob/master/Kconfig).
|
||||
- Run `scripts/code-format.py` (`astyle v3.4.12` needs to installed by running `cd scripts; ./install_astyle.sh`) and follow the [Code Conventions](https://docs.lvgl.io/master/CODING_STYLE.html).
|
||||
- Mark the Pull request as [Draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) while you are working on the first version, and mark is as _Ready_ when it's ready for review.
|
||||
- When changes were requested, [re-request review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) to notify the maintainers.
|
||||
- Help us to review this Pull Request! Anyone can [approve or request changes](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/approving-a-pull-request-with-required-reviews).
|
15
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/arduino.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: Arduino Lint
|
||||
on:
|
||||
push:
|
||||
branches: [ master, release/v8.* ]
|
||||
pull_request:
|
||||
branches: [ master, release/v8.* ]
|
||||
jobs:
|
||||
lint:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
library-manager: update
|
74
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/build_micropython.yml
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
name: Micropython CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
name: Build ${{ matrix.port }} port
|
||||
runs-on: ubuntu-20.04
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
port: ['unix', 'esp32', 'stm32', 'rp2']
|
||||
steps:
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install libsdl2-dev parallel libfreetype-dev librlottie-dev
|
||||
- name: Clone lv_micropython
|
||||
run: |
|
||||
git clone https://github.com/lvgl/lv_micropython.git .
|
||||
git checkout release/v8
|
||||
- name: Initialize lv_bindings submodule
|
||||
run: git submodule update --init --recursive lib/lv_bindings
|
||||
- name: Update ${{ matrix.port }} port submodules
|
||||
if: matrix.port != 'esp32'
|
||||
# VARIANT needed for unix
|
||||
run: make -C ports/${{ matrix.port }} VARIANT=dev DEBUG=1 USER_C_MODULES=../../lib/lv_bindings/bindings.cmake submodules
|
||||
- name: Checkout LVGL submodule
|
||||
working-directory: ./lib/lv_bindings/lvgl
|
||||
run: |
|
||||
git fetch --force ${{ github.event.repository.html_url }} "+refs/heads/*:refs/remotes/origin/*"
|
||||
git fetch --force ${{ github.event.repository.html_url }} "+refs/pull/*:refs/remotes/origin/pr/*"
|
||||
git checkout ${{ github.sha }} || git checkout ${{ github.event.pull_request.head.sha }}
|
||||
git submodule update --init --recursive
|
||||
- name: Build mpy-cross
|
||||
run: make -j $(nproc) -C mpy-cross
|
||||
|
||||
# ESP32 port
|
||||
- name: Setup ESP-IDF
|
||||
if: matrix.port == 'esp32'
|
||||
run: |
|
||||
source tools/ci.sh && ci_esp32_idf44_setup
|
||||
- name: Build ESP32 port
|
||||
if: matrix.port == 'esp32'
|
||||
run: |
|
||||
source tools/ci.sh && ci_esp32_build
|
||||
|
||||
# STM32 & RPi Pico port
|
||||
- name: arm-none-eabi-gcc
|
||||
if: matrix.port == 'stm32' || matrix.port == 'rp2'
|
||||
uses: carlosperate/arm-none-eabi-gcc-action@v1.3.0
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
- name: Build STM32 port
|
||||
if: matrix.port == 'stm32'
|
||||
run: make -j $(nproc) -C ports/stm32 BOARD=STM32F7DISC
|
||||
- name: Build Raspberry Pi PICO port
|
||||
if: matrix.port == 'rp2'
|
||||
run: make -j $(nproc) -C ports/rp2 BOARD=PICO USER_C_MODULES=../../lib/lv_bindings/bindings.cmake
|
||||
# Unix port
|
||||
- name: Build Unix port
|
||||
if: matrix.port == 'unix'
|
||||
run: make -j $(nproc) -C ports/unix VARIANT=dev DEBUG=1
|
||||
- name: Run tests
|
||||
if: success() && matrix.port == 'unix'
|
||||
run: |
|
||||
export XDG_RUNTIME_DIR=/tmp
|
||||
lib/lv_bindings/tests/run.sh
|
||||
|
109
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/ccpp.yml
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, release/v8.* ]
|
||||
pull_request:
|
||||
branches: [ master, release/v8.* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# A valid option parameter to the cmake file.
|
||||
# See BUILD_OPTIONS in tests/CMakeLists.txt.
|
||||
build_option: ['OPTIONS_MINIMAL_MONOCHROME',
|
||||
'OPTIONS_NORMAL_8BIT',
|
||||
'OPTIONS_16BIT',
|
||||
'OPTIONS_16BIT_SWAP',
|
||||
'OPTIONS_FULL_32BIT']
|
||||
name: Build ${{ matrix.build_option }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: Install prerequisites
|
||||
run: scripts/install-prerequisites.sh
|
||||
- name: Building ${{ matrix.build_option }}
|
||||
run: python tests/main.py --build-option=${{ matrix.build_option }} build
|
||||
|
||||
test-native:
|
||||
runs-on: ubuntu-latest
|
||||
name: amd64 Executable Tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: Install prerequisites
|
||||
run: scripts/install-prerequisites.sh
|
||||
- name: Fix kernel mmap rnd bits
|
||||
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
|
||||
# high-entropy ASLR in much newer kernels that GitHub runners are
|
||||
# using leading to random crashes: https://reviews.llvm.org/D148280
|
||||
run: sudo sysctl vm.mmap_rnd_bits=28
|
||||
- name: Run tests
|
||||
run: python tests/main.py --report test
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
if: github.event_name == 'push'
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
test-cross:
|
||||
# The host should always be linux
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.arch }} Executable Tests
|
||||
|
||||
# Run steps on a matrix of 3 arch/distro combinations
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ 'aarch64', 'armv6', 'armv7' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.1.0
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.ccache
|
||||
key: lvgl_ci_cross_test_ccache_${{ matrix.arch }}_${{ github.sha }}
|
||||
restore-keys: |
|
||||
lvgl_ci_cross_test_ccache_${{ matrix.arch }}
|
||||
- uses: uraimo/run-on-arch-action@v2.1.1
|
||||
name: Run tests
|
||||
id: build
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
distro: bullseye
|
||||
|
||||
# Not required, but speeds up builds
|
||||
githubToken: ${{ github.token }}
|
||||
|
||||
# The shell to run commands with in the container
|
||||
shell: /bin/bash
|
||||
|
||||
# Create cached/volume directories on host
|
||||
setup: |
|
||||
mkdir -p ~/.ccache
|
||||
|
||||
# Mount cached directories in the container for faster builds
|
||||
dockerRunArgs: |
|
||||
--volume "${HOME}/.ccache:/root/.ccache"
|
||||
|
||||
install: |
|
||||
apt-get update -y
|
||||
apt-get install build-essential ccache python3 libpng-dev ruby-full gcovr cmake -q -y
|
||||
/usr/sbin/update-ccache-symlinks
|
||||
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
|
||||
|
||||
run: |
|
||||
if [[ "${{ matrix.distro }}" == "ubuntu22.04" ]]; then
|
||||
# ASan in llvm 14 provided in ubuntu-22.04 is incompatible with
|
||||
# high-entropy ASLR configured in much newer kernels that GitHub
|
||||
# runners are using leading to random crashes:
|
||||
# https://github.com/actions/runner-images/issues/9491
|
||||
# can remove this once the issue is fixed.
|
||||
sysctl -w vm.mmap_rnd_bits=28
|
||||
fi
|
||||
env PATH="/usr/lib/ccache:$PATH" ASAN_OPTIONS=detect_leaks=0 python3 tests/main.py test
|
24
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/check_conf.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: Verify that lv_conf_internal.h matches repository state
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
verify-conf-internal:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Generate lv_conf_internal.h
|
||||
run: python lv_conf_internal_gen.py
|
||||
working-directory: scripts
|
||||
- name: Check that repository is clean
|
||||
run: git diff --exit-code >/dev/null 2>&1 || (echo "Please regenerate lv_conf_internal.h using scripts/lv_conf_internal_gen.py"; false)
|
37
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/check_style.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Verify code formatting
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
verify-formatting:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Checkout astyle
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: lvgl/astyle
|
||||
path: astyle
|
||||
- name: Install astyle
|
||||
run: |
|
||||
cd astyle/build/gcc/
|
||||
make
|
||||
sudo make install
|
||||
astyle --version
|
||||
- name: Format code
|
||||
run: python code-format.py
|
||||
working-directory: scripts
|
||||
- name: Check that repository is clean
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail
|
||||
if ! (git diff --exit-code --color=always | tee /tmp/lvgl_diff.patch); then
|
||||
echo "Please apply the preceding diff to your code or run scripts/code-format.py"
|
||||
exit 1
|
||||
fi
|
29
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/close_old_issues.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
if: github.repository == 'lvgl/lvgl'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.LVGL_BOT_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
stale-pr-message: |
|
||||
We need some feedback on this issue.
|
||||
|
||||
Now we mark this as "stale" because there was no activity here for 14 days.
|
||||
|
||||
Remove the "stale" label or comment else this will be closed in 7 days.
|
||||
close-issue-message: |
|
||||
As there was no activity here for a while we close this issue. But don't worry, the conversation is still here and you can get back to it at any time.
|
||||
|
||||
So feel free to comment if you have remarks or ideas on this topic.
|
||||
days-before-stale: 14
|
||||
days-before-close: 7
|
||||
exempt-issue-labels: 'pinned'
|
||||
exempt-pr-labels: 'pinned'
|
93
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/compile_docs.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
name: Build docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 'release/*'
|
||||
env:
|
||||
EM_VERSION: 2.0.4
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
if: github.repository == 'lvgl/lvgl'
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: docs-build-and-deploy
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Cache Python packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# Cache the Python package environment, excluding pip and setuptools installed by setup-python
|
||||
path: |
|
||||
~/.cache/pip
|
||||
${{ env.pythonLocation }}/bin/*
|
||||
${{ env.pythonLocation }}/include
|
||||
${{ env.pythonLocation }}/lib/python*/site-packages/*
|
||||
!${{ env.pythonLocation }}/bin/pip*
|
||||
!${{ env.pythonLocation }}/lib/python*/site-packages/pip*
|
||||
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
|
||||
key: ${{ env.pythonLocation }}-${{ hashFiles('docs/requirements.txt') }}
|
||||
- name: Install Doxygen and Latex dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install doxygen texlive-xetex texlive-binaries texlive-lang-english latexmk fonts-freefont-otf
|
||||
- name: Install requirements
|
||||
run: |
|
||||
pip install -r docs/requirements.txt
|
||||
- name: Setup Emscripten cache
|
||||
id: cache-system-libraries
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{env.EM_CACHE_FOLDER}}
|
||||
key: ${{env.EM_VERSION}}-${{ runner.os }}
|
||||
- uses: mymindstorm/setup-emsdk@v9
|
||||
with:
|
||||
version: ${{env.EM_VERSION}}
|
||||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
- name: Build examples (with cache)
|
||||
run: scripts/build_html_examples.sh
|
||||
- name: Build docs
|
||||
run: docs/build.py
|
||||
- name: Remove .doctrees
|
||||
run: rm -rf out_html/.doctrees
|
||||
- name: Retrieve version
|
||||
run: |
|
||||
echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)"
|
||||
id: version
|
||||
- name: Deploy to subfolder
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }}
|
||||
REPOSITORY_NAME: lvgl/docs
|
||||
BRANCH: gh-pages # The branch the action should deploy to.
|
||||
FOLDER: out_html # The folder the action should deploy.
|
||||
TARGET_FOLDER: ${{ steps.version.outputs.VERSION_NAME }}
|
||||
GIT_CONFIG_NAME: lvgl-bot
|
||||
GIT_CONFIG_EMAIL: lvgl-bot@users.noreply.github.com
|
||||
PRESERVE: true
|
||||
SINGLE_COMMIT: true
|
||||
- name: Deploy to master
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }}
|
||||
REPOSITORY_NAME: lvgl/docs
|
||||
BRANCH: gh-pages # The branch the action should deploy to.
|
||||
FOLDER: out_html # The folder the action should deploy.
|
||||
TARGET_FOLDER: master
|
||||
GIT_CONFIG_NAME: lvgl-bot
|
||||
GIT_CONFIG_EMAIL: lvgl-bot@users.noreply.github.com
|
||||
PRESERVE: true
|
||||
SINGLE_COMMIT: true
|
23
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/esp_upload_component.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Push LVGL release to Espressif Component Service
|
||||
|
||||
# If the commit is tagged, it will be uploaded. Other scenario silently fail.
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
upload_components:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Upload component to component registry
|
||||
uses: espressif/upload-components-ci-action@v1
|
||||
with:
|
||||
name: "lvgl"
|
||||
version: ${{ github.ref_name }}
|
||||
namespace: "lvgl"
|
||||
api_token: ${{ secrets.ESP_IDF_COMPONENT_API_TOKEN }}
|
16
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
|
||||
jobs:
|
||||
auto_close_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Automatically close issues that don't follow the issue template
|
||||
uses: lucasbento/auto-close-issues@v1.0.2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template." # optional property
|
||||
closed-issues-label: "not-template"
|
21
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/makefile.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: Check Makefile
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, release/v8.* ]
|
||||
pull_request:
|
||||
branches: [ master, release/v8.* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
name: Build using Makefile
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ammaraskar/gcc-problem-matcher@master
|
||||
- name: Install prerequisites
|
||||
run: scripts/install-prerequisites.sh
|
||||
- name: Build
|
||||
working-directory: tests/makefile
|
||||
run: make test_file
|
27
src/W800_SDK_v1.00.10/lvgl/lvgl_v8.4/.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
name: Create Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
body: |
|
||||
See the [CHANGELOG](https://github.com/lvgl/lvgl/blob/master/docs/CHANGELOG.md)
|
||||
draft: false
|
||||
prerelease: false
|
@ -1,4 +1,4 @@
|
||||
# Kconfig file for LVGL v8.0
|
||||
# Kconfig file for LVGL v8.4
|
||||
|
||||
menu "LVGL configuration"
|
||||
|
||||
@ -228,6 +228,16 @@ menu "LVGL configuration"
|
||||
Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"
|
||||
|
||||
config LV_USE_GPU_RA6M3_G2D
|
||||
bool "Enable RA6M3 G2D GPU."
|
||||
config LV_GPU_RA6M3_G2D_INCLUDE
|
||||
string "include path of target processor"
|
||||
depends on LV_USE_GPU_RA6M3_G2D
|
||||
default "hal_data.h"
|
||||
help
|
||||
Must be defined to include path of target processor
|
||||
e.g. "hal_data.h"
|
||||
|
||||
config LV_USE_GPU_SWM341_DMA2D
|
||||
bool "Enable SWM341 DMA2D GPU."
|
||||
config LV_GPU_SWM341_DMA2D_INCLUDE
|
||||
@ -911,7 +921,8 @@ menu "LVGL configuration"
|
||||
string "Set the working directory"
|
||||
depends on LV_USE_FS_STDIO
|
||||
config LV_FS_STDIO_CACHE_SIZE
|
||||
string ">0 to cache this number of bytes in lv_fs_read()"
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_STDIO
|
||||
|
||||
config LV_USE_FS_POSIX
|
||||
@ -953,6 +964,17 @@ menu "LVGL configuration"
|
||||
default 0
|
||||
depends on LV_USE_FS_FATFS
|
||||
|
||||
config LV_USE_FS_LITTLEFS
|
||||
bool "File system on top of LittleFS"
|
||||
config LV_FS_LITTLEFS_LETTER
|
||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
||||
default 0
|
||||
depends on LV_USE_FS_LITTLEFS
|
||||
config LV_FS_LITTLEFS_CACHE_SIZE
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_LITTLEFS
|
||||
|
||||
config LV_USE_PNG
|
||||
bool "PNG decoder library"
|
||||
|
||||
@ -989,6 +1011,13 @@ menu "LVGL configuration"
|
||||
endmenu
|
||||
endif
|
||||
|
||||
config LV_USE_TINY_TTF
|
||||
bool "Tiny TTF library"
|
||||
config LV_TINY_TTF_FILE_SUPPORT
|
||||
bool "Load TTF data from files"
|
||||
depends on LV_USE_TINY_TTF
|
||||
default n
|
||||
|
||||
config LV_USE_RLOTTIE
|
||||
bool "Lottie library"
|
||||
|
@ -2,8 +2,8 @@ TOP_DIR = ../..
|
||||
sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||
|
||||
ifndef PDIR
|
||||
GEN_LIBS = liblvglv8_3$(LIB_EXT)
|
||||
COMPONENTS_liblvglv8_3 = src/liblvglsrc$(LIB_EXT) \
|
||||
GEN_LIBS = liblvglv8_4$(LIB_EXT)
|
||||
COMPONENTS_liblvglv8_4 = src/liblvglsrc$(LIB_EXT) \
|
||||
demos/liblvgldemos$(LIB_EXT)
|
||||
endif
|
||||
|
@ -16,10 +16,8 @@ LVGL provides everything you need to create an embedded GUI with easy-to-use gra
|
||||
<a href="https://docs.lvgl.io/master/examples.html">Interactive examples</a>
|
||||
</h4>
|
||||
|
||||
|
||||
**English** | [中文](./README_zh.md) | [Português do Brasil](./README_pt_BR.md)
|
||||
|
||||
|
||||
---
|
||||
|
||||
#### Table of content
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -89,7 +89,7 @@ LV_FONT_DECLARE(lv_font_benchmark_montserrat_16_compr_az);
|
||||
LV_FONT_DECLARE(lv_font_benchmark_montserrat_28_compr_az);
|
||||
|
||||
static void monitor_cb(lv_disp_drv_t * drv, uint32_t time, uint32_t px);
|
||||
static void scene_next_task_cb(lv_timer_t * timer);
|
||||
static void next_scene_timer_cb(lv_timer_t * timer);
|
||||
static void rect_create(lv_style_t * style);
|
||||
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa);
|
||||
static void txt_create(lv_style_t * style);
|
||||
@ -226,7 +226,6 @@ static void shadow_small_ofs_cb(void)
|
||||
rect_create(&style_common);
|
||||
}
|
||||
|
||||
|
||||
static void shadow_large_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -250,7 +249,6 @@ static void shadow_large_ofs_cb(void)
|
||||
rect_create(&style_common);
|
||||
}
|
||||
|
||||
|
||||
static void img_rgb_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -293,7 +291,6 @@ static void img_alpha_cb(void)
|
||||
img_create(&style_common, &img_benchmark_cogwheel_alpha16, false, false, false);
|
||||
}
|
||||
|
||||
|
||||
static void img_rgb_recolor_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -382,7 +379,6 @@ static void img_rgb_zoom_aa_cb(void)
|
||||
lv_style_set_img_opa(&style_common, opa_mode ? LV_OPA_50 : LV_OPA_COVER);
|
||||
img_create(&style_common, &img_benchmark_cogwheel_rgb, false, true, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void img_argb_zoom_cb(void)
|
||||
@ -396,7 +392,6 @@ static void img_argb_zoom_cb(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void img_argb_zoom_aa_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -462,7 +457,6 @@ static void txt_large_compr_cb(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void line_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -490,7 +484,6 @@ static void arc_thick_cb(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void sub_rectangle_cb(void)
|
||||
{
|
||||
lv_style_reset(&style_common);
|
||||
@ -563,8 +556,6 @@ static void sub_text_cb(void)
|
||||
txt_create(&style_common);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@ -636,7 +627,7 @@ static lv_obj_t * scene_bg;
|
||||
static lv_obj_t * title;
|
||||
static lv_obj_t * subtitle;
|
||||
static uint32_t rnd_act;
|
||||
|
||||
static lv_timer_t * next_scene_timer;
|
||||
|
||||
static const uint32_t rnd_map[] = {
|
||||
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
||||
@ -702,15 +693,26 @@ static void benchmark_init(void)
|
||||
lv_obj_update_layout(scr);
|
||||
}
|
||||
|
||||
|
||||
void lv_demo_benchmark(void)
|
||||
{
|
||||
benchmark_init();
|
||||
|
||||
/*Manually start scenes*/
|
||||
scene_next_task_cb(NULL);
|
||||
next_scene_timer_cb(NULL);
|
||||
}
|
||||
|
||||
void lv_demo_benchmark_close(void)
|
||||
{
|
||||
if(next_scene_timer) lv_timer_del(next_scene_timer);
|
||||
next_scene_timer = NULL;
|
||||
|
||||
lv_anim_del(NULL, NULL);
|
||||
|
||||
lv_style_reset(&style_common);
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
|
||||
}
|
||||
|
||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||
{
|
||||
@ -725,8 +727,8 @@ void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||
scene_act = scene_no >> 1;
|
||||
|
||||
if(scenes[scene_act].create_cb) {
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int)(dimof(scenes) * 2) - 2,
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int32_t)(dimof(scenes) * 2) - 2,
|
||||
scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
lv_label_set_text(subtitle, "");
|
||||
|
||||
@ -738,7 +740,6 @@ void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb)
|
||||
{
|
||||
benchmark_finished_cb = finished_cb;
|
||||
@ -787,7 +788,6 @@ static void generate_report(void)
|
||||
weight_opa_sum += w;
|
||||
}
|
||||
|
||||
|
||||
fps_sum = fps_normal_sum + fps_opa_sum;
|
||||
weight_sum = weight_normal_sum + weight_opa_sum;
|
||||
|
||||
@ -804,7 +804,6 @@ static void generate_report(void)
|
||||
lv_obj_clean(lv_scr_act());
|
||||
scene_bg = NULL;
|
||||
|
||||
|
||||
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
title = lv_label_create(lv_scr_act());
|
||||
@ -840,7 +839,6 @@ static void generate_report(void)
|
||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL3, &style_cell_very_slow);
|
||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL4, &style_cell_title);
|
||||
|
||||
|
||||
uint16_t row = 0;
|
||||
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
||||
lv_table_set_cell_value(table, row, 0, "Slow but common cases");
|
||||
@ -927,7 +925,6 @@ static void generate_report(void)
|
||||
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
||||
lv_table_set_cell_value(table, row, 1, buf);
|
||||
|
||||
|
||||
if(scenes[i].fps_opa < 10) {
|
||||
// lv_table_set_cell_type(table, row, 0, 3);
|
||||
// lv_table_set_cell_type(table, row, 1, 3);
|
||||
@ -973,11 +970,13 @@ static void report_cb(lv_timer_t * timer)
|
||||
}
|
||||
}
|
||||
|
||||
static void scene_next_task_cb(lv_timer_t * timer)
|
||||
static void next_scene_timer_cb(lv_timer_t * timer)
|
||||
{
|
||||
LV_UNUSED(timer);
|
||||
lv_obj_clean(scene_bg);
|
||||
|
||||
next_scene_timer = NULL;
|
||||
|
||||
if(opa_mode) {
|
||||
if(scene_act >= 0) {
|
||||
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
||||
@ -996,8 +995,8 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
||||
}
|
||||
|
||||
if(scenes[scene_act].create_cb) {
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int32_t)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
if(opa_mode) {
|
||||
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name,
|
||||
scenes[scene_act].fps_normal);
|
||||
@ -1014,8 +1013,8 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
||||
|
||||
rnd_reset();
|
||||
scenes[scene_act].create_cb();
|
||||
lv_timer_t * t = lv_timer_create(scene_next_task_cb, SCENE_TIME, NULL);
|
||||
lv_timer_set_repeat_count(t, 1);
|
||||
next_scene_timer = lv_timer_create(next_scene_timer_cb, SCENE_TIME, NULL);
|
||||
lv_timer_set_repeat_count(next_scene_timer, 1);
|
||||
|
||||
}
|
||||
/*Ready*/
|
||||
@ -1037,7 +1036,6 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void rect_create(lv_style_t * style)
|
||||
{
|
||||
uint32_t i;
|
||||
@ -1055,7 +1053,6 @@ static void rect_create(lv_style_t * style)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa)
|
||||
{
|
||||
uint32_t i;
|
||||
@ -1074,7 +1071,6 @@ static void img_create(lv_style_t * style, const void * src, bool rotate, bool z
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void txt_create(lv_style_t * style)
|
||||
{
|
||||
uint32_t i;
|
||||
@ -1090,7 +1086,6 @@ static void txt_create(lv_style_t * style)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void line_create(lv_style_t * style)
|
||||
{
|
||||
static lv_point_t points[OBJ_NUM][LINE_POINT_NUM];
|
||||
@ -1105,7 +1100,6 @@ static void line_create(lv_style_t * style)
|
||||
points[i][j].y = rnd_next(LINE_POINT_DIFF_MIN, LINE_POINT_DIFF_MAX);
|
||||
}
|
||||
|
||||
|
||||
lv_obj_t * obj = lv_line_create(scene_bg);
|
||||
lv_obj_remove_style_all(obj);
|
||||
lv_obj_add_style(obj, style, 0);
|
||||
@ -1118,7 +1112,6 @@ static void line_create(lv_style_t * style)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void arc_anim_end_angle_cb(void * var, int32_t v)
|
||||
{
|
||||
lv_arc_set_end_angle(var, v);
|
||||
@ -1152,7 +1145,6 @@ static void arc_create(lv_style_t * style)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void fall_anim_y_cb(void * var, int32_t v)
|
||||
{
|
||||
lv_obj_set_y(var, v);
|
@ -24,12 +24,13 @@ extern "C" {
|
||||
**********************/
|
||||
typedef void finished_cb_t(void);
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_demo_benchmark(void);
|
||||
|
||||
void lv_demo_benchmark_close(void);
|
||||
|
||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no);
|
||||
|
||||
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb);
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -46,8 +46,11 @@ static lv_obj_t * t2;
|
||||
|
||||
void lv_demo_keypad_encoder(void)
|
||||
{
|
||||
g = lv_group_create();
|
||||
lv_group_set_default(g);
|
||||
g = lv_group_get_default();
|
||||
if(g == NULL) {
|
||||
g = lv_group_create();
|
||||
lv_group_set_default(g);
|
||||
}
|
||||
|
||||
lv_indev_t * cur_drv = NULL;
|
||||
for(;;) {
|
||||
@ -76,6 +79,12 @@ void lv_demo_keypad_encoder(void)
|
||||
msgbox_create();
|
||||
}
|
||||
|
||||
void lv_demo_keypad_encoder_close(void)
|
||||
{
|
||||
lv_obj_clean(lv_scr_act());
|
||||
lv_obj_clean(lv_layer_top());
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
@ -27,6 +27,7 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_demo_keypad_encoder(void);
|
||||
void lv_demo_keypad_encoder_close(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -47,7 +47,6 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|