Compare commits
18 Commits
51f6fa6014
...
2024
| Author | SHA1 | Date | |
|---|---|---|---|
| 59262443c9 | |||
| 25da5cde32 | |||
| 10aa474124 | |||
| 5fb5d271b1 | |||
| a4bea0d78b | |||
| a07d51f223 | |||
| 555a114ae5 | |||
| 6db74c2242 | |||
| a32d497074 | |||
| 0f5cfe56a9 | |||
| f5027348d7 | |||
| 7c44186d0a | |||
| 3208c8f86f | |||
| e60baabf85 | |||
| 19f51f13c4 | |||
| 6d92da3a10 | |||
| 9ef44b8ebb | |||
| 3f67d1571b |
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -1,8 +1,3 @@
|
|||||||
[submodule "Core/Lib/FT_CAN_AL"]
|
|
||||||
path = Core/Lib/can-halal
|
|
||||||
url = ssh://git@git.fasttube.de:313/FaSTTUBe/FT_CAN_AL.git
|
|
||||||
[submodule "Core/Lib/can-halal/"]
|
|
||||||
url = ssh://git@git.fasttube.de:313/FaSTTUBe/can-halal.git
|
|
||||||
[submodule "Core/Lib/can-halal"]
|
[submodule "Core/Lib/can-halal"]
|
||||||
path = Core/Lib/can-halal
|
path = Core/Lib/can-halal
|
||||||
url = ssh://git@git.fasttube.de:313/FaSTTUBe/can-halal.git
|
url = ssh://git@git.fasttube.de:313/FaSTTUBe/can-halal.git
|
||||||
|
|||||||
7
.stm32env
Normal file
7
.stm32env
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# environment variable file used by stm32-for-vscode and the STM32Make.make makefile
|
||||||
|
# Other environment variables can be added here. If wanting to use the generated makefile in CI/CD context please
|
||||||
|
# configure the following variables: GCC_PATH, OPENOCD
|
||||||
|
|
||||||
|
ARM_GCC_PATH = /Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin
|
||||||
|
OPENOCD = /opt/homebrew/bin/openocd
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
/* Defines ------------------------------------------------------------------*/
|
/* Defines ------------------------------------------------------------------*/
|
||||||
/* STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0 */
|
/* STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0 */
|
||||||
#define THREADX_ENABLED
|
#define THREADX_ENABLED
|
||||||
/* STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2 */
|
/* STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0 */
|
||||||
#define TOUCHGFX_APP
|
#define TOUCHGFX_APP
|
||||||
|
|
||||||
#endif /* __RTE_COMPONENTS_H__ */
|
#endif /* __RTE_COMPONENTS_H__ */
|
||||||
|
|||||||
@ -10,17 +10,15 @@ extern "C" {
|
|||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
CountedEnum(ParamType, size_t, PF_BBAL, PF_SLIPREF, PF_MUMAX, PF_ASRP, PF_ASRON,
|
CountedEnum(ParamType, size_t, PF_PLIM, PF_TLIM, PF_SLIM, PF_TVEC, PF_PG, PF_REKU);
|
||||||
PF_ASRI, PF_PLIM);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float bbal;
|
unsigned plim; //< Power limit
|
||||||
float slipref;
|
unsigned tlim; //< Torque limit
|
||||||
float mumax;
|
unsigned slim; //< Speed limit
|
||||||
unsigned asrp;
|
unsigned tvec; //< Torque vectoring
|
||||||
unsigned asri;
|
unsigned pg; //< Power ground
|
||||||
unsigned asron;
|
unsigned reku; //< Rekuperation
|
||||||
unsigned plim;
|
|
||||||
} Params;
|
} Params;
|
||||||
|
|
||||||
extern Params params;
|
extern Params params;
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_BUTTONS 6
|
#define NUM_BUTTONS 7
|
||||||
#define NUM_ENCS 2
|
#define NUM_ENCS 2
|
||||||
#define BUTTON_MIN_INTERVAL 50 // ms
|
#define BUTTON_MIN_INTERVAL 50 // ms
|
||||||
#define ENC_MAX_PHASE 50 // ms
|
#define ENC_MAX_PHASE 50 // ms
|
||||||
|
|||||||
@ -2,103 +2,100 @@
|
|||||||
#include "can-halal.h"
|
#include "can-halal.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the given value if it is above the minimum allowed value
|
||||||
|
*/
|
||||||
|
// TODO these functions take into account that the parameters are unsigned, it's definitely better to have them
|
||||||
|
// signed but would need to be tested with the autobox
|
||||||
|
#define DEC_IF_ABOVE(param_val, min_val, decr_amt) ((param_val) = (((int)(param_val) - (int)(decr_amt)) > (int)(min_val)) ? ((param_val) - (decr_amt)) : (min_val))
|
||||||
|
#define INC_IF_BELOW(param_val, max_val, incr_amt) ((param_val) = (((param_val) + (incr_amt)) < (max_val)) ? ((param_val) + (incr_amt)) : (max_val))
|
||||||
|
|
||||||
Params params = {0};
|
Params params = {0};
|
||||||
|
|
||||||
void params_init() {
|
void params_init()
|
||||||
params.bbal = 50;
|
{
|
||||||
|
// Default values
|
||||||
params.plim = 20;
|
params.plim = 20;
|
||||||
|
params.tlim = 1400;
|
||||||
|
params.slim = 70;
|
||||||
|
params.tvec = 50;
|
||||||
|
params.pg = 0;
|
||||||
|
params.reku = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void params_inc(ParamType param) {
|
void params_inc(ParamType param)
|
||||||
switch (param) {
|
{
|
||||||
case PF_BBAL:
|
switch (param)
|
||||||
params.bbal += 0.5f;
|
{
|
||||||
if (params.bbal > 100.0f) {
|
|
||||||
params.bbal = 100.0f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_SLIPREF:
|
|
||||||
params.slipref += 0.01f;
|
|
||||||
break;
|
|
||||||
case PF_MUMAX:
|
|
||||||
params.mumax += 0.1f;
|
|
||||||
break;
|
|
||||||
case PF_ASRP:
|
|
||||||
params.asrp++;
|
|
||||||
break;
|
|
||||||
case PF_ASRI:
|
|
||||||
params.asri++;
|
|
||||||
break;
|
|
||||||
case PF_ASRON:
|
|
||||||
params.asron = 1;
|
|
||||||
break;
|
|
||||||
case PF_PLIM:
|
case PF_PLIM:
|
||||||
params.plim = (params.plim < 80) ? params.plim + 1 : 80;
|
INC_IF_BELOW(params.plim, 80, 1);
|
||||||
|
break;
|
||||||
|
case PF_TLIM:
|
||||||
|
INC_IF_BELOW(params.tlim, 1500, 100);
|
||||||
|
break;
|
||||||
|
case PF_SLIM:
|
||||||
|
INC_IF_BELOW(params.slim, 100, 1);
|
||||||
|
break;
|
||||||
|
case PF_TVEC:
|
||||||
|
INC_IF_BELOW(params.tvec, 100, 1);
|
||||||
|
break;
|
||||||
|
case PF_PG:
|
||||||
|
INC_IF_BELOW(params.pg, 100, 1);
|
||||||
|
break;
|
||||||
|
case PF_REKU:
|
||||||
|
INC_IF_BELOW(params.reku, 100, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void params_dec(ParamType param) {
|
void params_dec(ParamType param)
|
||||||
switch (param) {
|
{
|
||||||
case PF_BBAL:
|
switch (param)
|
||||||
params.bbal -= 0.5f;
|
{
|
||||||
if (params.bbal < 0.0f) {
|
|
||||||
params.bbal = 0.0f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_SLIPREF:
|
|
||||||
if (params.slipref > 0) {
|
|
||||||
params.slipref -= 0.01f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_MUMAX:
|
|
||||||
if (params.mumax > 0) {
|
|
||||||
params.mumax -= 0.1f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_ASRP:
|
|
||||||
if (params.asrp > 0) {
|
|
||||||
params.asrp--;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_ASRI:
|
|
||||||
if (params.asri > 0) {
|
|
||||||
params.asri--;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PF_ASRON:
|
|
||||||
params.asron = 0;
|
|
||||||
break;
|
|
||||||
case PF_PLIM:
|
case PF_PLIM:
|
||||||
params.plim = (params.plim > 2) ? params.plim - 1 : 2;
|
DEC_IF_ABOVE(params.plim, 0, 1);
|
||||||
|
break;
|
||||||
|
case PF_TLIM:
|
||||||
|
DEC_IF_ABOVE(params.tlim, 0, 100);
|
||||||
|
break;
|
||||||
|
case PF_SLIM:
|
||||||
|
DEC_IF_ABOVE(params.slim, 0, 1);
|
||||||
|
break;
|
||||||
|
case PF_TVEC:
|
||||||
|
DEC_IF_ABOVE(params.tvec, 0, 1);
|
||||||
|
break;
|
||||||
|
case PF_PG:
|
||||||
|
DEC_IF_ABOVE(params.pg, 0, 1);
|
||||||
|
break;
|
||||||
|
case PF_REKU:
|
||||||
|
DEC_IF_ABOVE(params.reku, 0, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void params_broadcast(ParamType param) {
|
void params_broadcast(ParamType param)
|
||||||
|
{
|
||||||
int32_t value;
|
int32_t value;
|
||||||
switch (param) {
|
switch (param)
|
||||||
case PF_BBAL:
|
{
|
||||||
value = params.bbal * 10;
|
|
||||||
break;
|
|
||||||
case PF_SLIPREF:
|
|
||||||
value = params.slipref * 100;
|
|
||||||
break;
|
|
||||||
case PF_MUMAX:
|
|
||||||
value = params.mumax * 10;
|
|
||||||
break;
|
|
||||||
case PF_ASRP:
|
|
||||||
value = params.asrp;
|
|
||||||
break;
|
|
||||||
case PF_ASRI:
|
|
||||||
value = params.asri;
|
|
||||||
break;
|
|
||||||
case PF_ASRON:
|
|
||||||
value = params.asron;
|
|
||||||
break;
|
|
||||||
case PF_PLIM:
|
case PF_PLIM:
|
||||||
value = params.plim;
|
value = params.plim;
|
||||||
break;
|
break;
|
||||||
|
case PF_TLIM:
|
||||||
|
value = params.tlim;
|
||||||
|
break;
|
||||||
|
case PF_SLIM:
|
||||||
|
value = params.slim;
|
||||||
|
break;
|
||||||
|
case PF_TVEC:
|
||||||
|
value = params.tvec;
|
||||||
|
break;
|
||||||
|
case PF_PG:
|
||||||
|
value = params.pg;
|
||||||
|
break;
|
||||||
|
case PF_REKU:
|
||||||
|
value = params.reku;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,27 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "hx8357d.h"
|
||||||
|
#include "main.h"
|
||||||
#include "stm32h7a3xx.h"
|
#include "stm32h7a3xx.h"
|
||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
#include "stm32h7xx_hal_gpio.h"
|
#include "stm32h7xx_hal_gpio.h"
|
||||||
#include "tx_api.h"
|
#include "tx_api.h"
|
||||||
|
|
||||||
#include "hx8357d.h"
|
|
||||||
#include "main.h"
|
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
#include "leds.h"
|
||||||
|
|
||||||
|
#define DRS_BUTTON_IDX (6)
|
||||||
|
#define DRS_PRESS_WAIT_CYCLES (1000)
|
||||||
|
static int drs_press_buf_cycles = 0;
|
||||||
|
|
||||||
void ui_thread_entry(ULONG _) {
|
void ui_thread_entry(ULONG _) {
|
||||||
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
|
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
|
||||||
BTN3_GPIO_Port, BTN4_GPIO_Port,
|
BTN3_GPIO_Port, BTN4_GPIO_Port,
|
||||||
BTN5_GPIO_Port, BTN6_GPIO_Port};
|
BTN5_GPIO_Port, BTN6_GPIO_Port, SW_DRS_GPIO_Port};
|
||||||
uint16_t button_pins[NUM_BUTTONS] = {BTN1_Pin, BTN2_Pin, BTN3_Pin,
|
uint16_t button_pins[NUM_BUTTONS] = {BTN1_Pin, BTN2_Pin, BTN3_Pin,
|
||||||
BTN4_Pin, BTN5_Pin, BTN6_Pin};
|
BTN4_Pin, BTN5_Pin, BTN6_Pin, SW_DRS_Pin};
|
||||||
GPIO_PinState button_states[NUM_BUTTONS] = {GPIO_PIN_RESET};
|
GPIO_PinState button_states[NUM_BUTTONS] = {GPIO_PIN_RESET};
|
||||||
uint32_t button_press_times[NUM_BUTTONS] = {HAL_GetTick()};
|
uint32_t button_press_times[NUM_BUTTONS] = {HAL_GetTick()};
|
||||||
|
|
||||||
@ -43,7 +49,20 @@ void ui_thread_entry(ULONG _) {
|
|||||||
if (press_event == 1 && button_states[1]) {
|
if (press_event == 1 && button_states[1]) {
|
||||||
tx_event_flags_set(&gui_update_events, GUI_UPDATE_NEXT_SCREEN, TX_OR);
|
tx_event_flags_set(&gui_update_events, GUI_UPDATE_NEXT_SCREEN, TX_OR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button_states[DRS_BUTTON_IDX] == GPIO_PIN_SET) {
|
||||||
|
// Set leftmost led to blue to indicate DRS activation
|
||||||
|
drs_press_buf_cycles = DRS_PRESS_WAIT_CYCLES;
|
||||||
|
led_set(0, 0, 0, 255);
|
||||||
|
} if (drs_press_buf_cycles < 0) {
|
||||||
|
// Assume no longer active, turn off
|
||||||
|
led_set(0, 0, 0, 0);
|
||||||
|
} else if (drs_press_buf_cycles >= 0) {
|
||||||
|
drs_press_buf_cycles--;
|
||||||
|
}
|
||||||
|
|
||||||
vehicle_broadcast_buttons(button_states);
|
vehicle_broadcast_buttons(button_states);
|
||||||
|
|
||||||
// Release so other threads can get scheduled
|
// Release so other threads can get scheduled
|
||||||
tx_thread_sleep(1);
|
tx_thread_sleep(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include "ui.h"
|
|
||||||
#include "vehicle_state.h"
|
|
||||||
|
|
||||||
#include "can-halal.h"
|
#include "can-halal.h"
|
||||||
|
#include "main.h"
|
||||||
#include "stm32h7xx.h"
|
#include "stm32h7xx.h"
|
||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
#include "stm32h7xx_hal_fdcan.h"
|
#include "stm32h7xx_hal_fdcan.h"
|
||||||
#include "stm32h7xx_hal_gpio.h"
|
#include "stm32h7xx_hal_gpio.h"
|
||||||
#include "tx_api.h"
|
#include "tx_api.h"
|
||||||
|
#include "ui.h"
|
||||||
|
#include "vehicle_state.h"
|
||||||
|
|
||||||
#define CAN_ID_AMS_SLAVE_PANIC 0x9
|
#define CAN_ID_AMS_SLAVE_PANIC 0x9
|
||||||
#define CAN_ID_AMS_STATUS 0xA
|
#define CAN_ID_AMS_STATUS 0xA
|
||||||
@ -98,7 +96,8 @@ void vehicle_broadcast_param(ParamType param, int32_t value) {
|
|||||||
|
|
||||||
void vehicle_broadcast_buttons(GPIO_PinState *button_states) {
|
void vehicle_broadcast_buttons(GPIO_PinState *button_states) {
|
||||||
uint8_t data = (button_states[0] << 2) | (button_states[1] << 0) |
|
uint8_t data = (button_states[0] << 2) | (button_states[1] << 0) |
|
||||||
(button_states[2] << 1) | (button_states[3] << 3);
|
(button_states[2] << 1) | (button_states[3] << 3) |
|
||||||
|
(button_states[6] << 4);
|
||||||
ftcan_transmit(CAN_ID_STW_BUTTONS, &data, 1);
|
ftcan_transmit(CAN_ID_STW_BUTTONS, &data, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,12 +227,14 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
|
|||||||
break;
|
break;
|
||||||
case CAN_ID_ABX_PARAM_CONFIRMED:
|
case CAN_ID_ABX_PARAM_CONFIRMED:
|
||||||
vehicle_state.last_param_confirmed = data[0];
|
vehicle_state.last_param_confirmed = data[0];
|
||||||
tx_event_flags_set(&gui_update_events, GUI_UPDATE_PARAM_CONFIRMED, TX_OR);
|
tx_event_flags_set(&gui_update_events, GUI_UPDATE_PARAM_CONFIRMED,
|
||||||
|
TX_OR);
|
||||||
break;
|
break;
|
||||||
case CAN_ID_SHUNT_CURRENT: {
|
case CAN_ID_SHUNT_CURRENT: {
|
||||||
// The first two bytes of shunt result messages are metadata
|
// The first two bytes of shunt result messages are metadata
|
||||||
const uint8_t *result_ptr = &data[2];
|
const uint8_t *result_ptr = &data[2];
|
||||||
vehicle_state.ts_current = ftcan_unmarshal_signed(&result_ptr, 4) * 1e-3;
|
vehicle_state.ts_current =
|
||||||
|
ftcan_unmarshal_signed(&result_ptr, 4) * 1e-3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CAN_ID_SHUNT_VOLTAGE1: {
|
case CAN_ID_SHUNT_VOLTAGE1: {
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Tue Jun 11 19:23:32 CEST 2024]
|
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Sun Jul 21 18:35:39 CEST 2024]
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
|||||||
@ -29,6 +29,7 @@ cDefinitions:
|
|||||||
cxxDefinitions:
|
cxxDefinitions:
|
||||||
- USE_HAL_DRIVER
|
- USE_HAL_DRIVER
|
||||||
- STM32H7A3xx
|
- STM32H7A3xx
|
||||||
|
- COMPILER_GIT_BUILD_HASH="a07d51f"
|
||||||
|
|
||||||
asDefinitions: []
|
asDefinitions: []
|
||||||
|
|
||||||
@ -170,3 +171,4 @@ customMakefileRules:
|
|||||||
makeFlags:
|
makeFlags:
|
||||||
# - -O # use this option when the output of make is mixed up only works for make version 4.0 and upwards
|
# - -O # use this option when the output of make is mixed up only works for make version 4.0 and upwards
|
||||||
# - --silent # use this option to silence the output of the build
|
# - --silent # use this option to silence the output of the build
|
||||||
|
# - -j1
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : app_touchgfx.c
|
* File Name : app_touchgfx.c
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file was created by TouchGFX Generator 4.23.2. This file is only
|
* This file was created by TouchGFX Generator 4.24.0. This file is only
|
||||||
* generated once! Delete this file from your project and re-generate code
|
* generated once! Delete this file from your project and re-generate code
|
||||||
* using STM32CubeMX or change this file manually to update it.
|
* using STM32CubeMX or change this file manually to update it.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : app_touchgfx.h
|
* File Name : app_touchgfx.h
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file was created by TouchGFX Generator 4.23.2. This file is only
|
* This file was created by TouchGFX Generator 4.24.0. This file is only
|
||||||
* generated once! Delete this file from your project and re-generate code
|
* generated once! Delete this file from your project and re-generate code
|
||||||
* using STM32CubeMX or change this file manually to update it.
|
* using STM32CubeMX or change this file manually to update it.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|||||||
@ -26,5 +26,5 @@
|
|||||||
"AdditionalFeatures": [
|
"AdditionalFeatures": [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Version": "4.23.2"
|
"Version": "4.24.0"
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
TouchGFX/assets/fonts/splinesans.ttf
Normal file
BIN
TouchGFX/assets/fonts/splinesans.ttf
Normal file
Binary file not shown.
BIN
TouchGFX/assets/fonts/splinesansb.ttf
Normal file
BIN
TouchGFX/assets/fonts/splinesansb.ttf
Normal file
Binary file not shown.
@ -17,7 +17,7 @@ CountedEnum(DataFieldType, size_t, DF_TSState, DF_ASState, DF_ActiveMission,
|
|||||||
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal, DF_TempMotL,
|
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal, DF_TempMotL,
|
||||||
DF_TempMotR, DF_TempInvL, DF_TempInvR, DF_TempBrakeFL,
|
DF_TempMotR, DF_TempInvL, DF_TempInvR, DF_TempBrakeFL,
|
||||||
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR, DF_LapBest,
|
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR, DF_LapBest,
|
||||||
DF_LapLast, DF_LVBatVoltage);
|
DF_LapLast, DF_LVBatVoltage, DF_GitBuildHash);
|
||||||
|
|
||||||
enum class NamedFieldKind { Float, Bool, Text, Int };
|
enum class NamedFieldKind { Float, Bool, Text, Int };
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,14 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#define _STRINGIZE(x) #x
|
||||||
|
#define STRINGIZE(x) _STRINGIZE(x)
|
||||||
|
|
||||||
|
#ifndef COMPILER_GIT_BUILD_HASH
|
||||||
|
#define COMPILER_GIT_BUILD_HASH "git id not found"
|
||||||
|
#endif
|
||||||
|
static const char* git_hash = STRINGIZE(COMPILER_GIT_BUILD_HASH);
|
||||||
|
|
||||||
#define VEH_FIELD(FIELD) []() { return (void *)&vehicle_state.FIELD; }
|
#define VEH_FIELD(FIELD) []() { return (void *)&vehicle_state.FIELD; }
|
||||||
#define VEH_BIT_FIELD(FIELD) \
|
#define VEH_BIT_FIELD(FIELD) \
|
||||||
[]() { \
|
[]() { \
|
||||||
@ -17,9 +25,11 @@
|
|||||||
return (void *)&x; \
|
return (void *)&x; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_tsstate_text() {
|
void *get_tsstate_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
switch (vehicle_state.ts_state) {
|
switch (vehicle_state.ts_state)
|
||||||
|
{
|
||||||
case TS_INACTIVE:
|
case TS_INACTIVE:
|
||||||
text = "INACT";
|
text = "INACT";
|
||||||
break;
|
break;
|
||||||
@ -47,9 +57,11 @@ void *get_tsstate_text() {
|
|||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_asstate_text() {
|
void *get_asstate_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
switch (vehicle_state.as_state) {
|
switch (vehicle_state.as_state)
|
||||||
|
{
|
||||||
case AS_OFF:
|
case AS_OFF:
|
||||||
text = "OFF";
|
text = "OFF";
|
||||||
break;
|
break;
|
||||||
@ -74,9 +86,11 @@ void *get_asstate_text() {
|
|||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_mission_text() {
|
void *get_mission_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
switch (vehicle_state.active_mission) {
|
switch (vehicle_state.active_mission)
|
||||||
|
{
|
||||||
case MISSION_NONE:
|
case MISSION_NONE:
|
||||||
text = "NONE";
|
text = "NONE";
|
||||||
break;
|
break;
|
||||||
@ -107,9 +121,11 @@ void *get_mission_text() {
|
|||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_r2dprog_text() {
|
void *get_r2dprog_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
switch (vehicle_state.r2d_progress) {
|
switch (vehicle_state.r2d_progress)
|
||||||
|
{
|
||||||
case R2D_NONE:
|
case R2D_NONE:
|
||||||
text = "NONE";
|
text = "NONE";
|
||||||
break;
|
break;
|
||||||
@ -143,61 +159,106 @@ void *get_r2dprog_text() {
|
|||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_inichk_text() {
|
void *get_inichk_text()
|
||||||
|
{
|
||||||
return (void *)inichkstate_str(vehicle_state.ini_chk_state);
|
return (void *)inichkstate_str(vehicle_state.ini_chk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_sdc_text() {
|
void *get_sdc_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
if (vehicle_state.errors.sdc_bfl) {
|
if (vehicle_state.errors.sdc_bfl)
|
||||||
|
{
|
||||||
text = "BFL";
|
text = "BFL";
|
||||||
} else if (vehicle_state.errors.sdc_brl) {
|
}
|
||||||
|
else if (vehicle_state.errors.sdc_brl)
|
||||||
|
{
|
||||||
text = "BRL";
|
text = "BRL";
|
||||||
} else if (vehicle_state.errors.sdc_acc) {
|
}
|
||||||
|
else if (vehicle_state.errors.sdc_acc)
|
||||||
|
{
|
||||||
text = "ACC";
|
text = "ACC";
|
||||||
} else if (vehicle_state.errors.sdc_hvb) {
|
}
|
||||||
|
else if (vehicle_state.errors.sdc_hvb)
|
||||||
|
{
|
||||||
text = "HVB";
|
text = "HVB";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
text = "CLOSED";
|
text = "CLOSED";
|
||||||
}
|
}
|
||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_err_text() {
|
void *get_err_text()
|
||||||
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
if (vehicle_state.errors.err_sdc) {
|
if (vehicle_state.errors.err_sdc)
|
||||||
|
{
|
||||||
text = "SDC";
|
text = "SDC";
|
||||||
} else if (vehicle_state.errors.err_ams) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_ams)
|
||||||
|
{
|
||||||
text = "AMS";
|
text = "AMS";
|
||||||
} else if (vehicle_state.errors.err_pdu) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_pdu)
|
||||||
|
{
|
||||||
text = "PDU";
|
text = "PDU";
|
||||||
} else if (vehicle_state.errors.err_ini_chk) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_ini_chk)
|
||||||
|
{
|
||||||
text = "IniChk";
|
text = "IniChk";
|
||||||
} else if (vehicle_state.errors.err_con_mon) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_con_mon)
|
||||||
|
{
|
||||||
text = "ConMon";
|
text = "ConMon";
|
||||||
} else if (vehicle_state.errors.err_scs) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_scs)
|
||||||
|
{
|
||||||
text = "SCS";
|
text = "SCS";
|
||||||
} else if (vehicle_state.errors.err_sbspd) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_sbspd)
|
||||||
|
{
|
||||||
text = "sBSPD";
|
text = "sBSPD";
|
||||||
} else if (vehicle_state.errors.err_appsp) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_appsp)
|
||||||
|
{
|
||||||
text = "APPSp";
|
text = "APPSp";
|
||||||
} else if (vehicle_state.errors.err_as) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_as)
|
||||||
|
{
|
||||||
text = "AS";
|
text = "AS";
|
||||||
} else if (vehicle_state.errors.err_ros) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_ros)
|
||||||
|
{
|
||||||
text = "ROS";
|
text = "ROS";
|
||||||
} else if (vehicle_state.errors.err_res) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_res)
|
||||||
|
{
|
||||||
text = "RES";
|
text = "RES";
|
||||||
} else if (vehicle_state.errors.err_invl) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_invl)
|
||||||
|
{
|
||||||
text = "INVL";
|
text = "INVL";
|
||||||
} else if (vehicle_state.errors.err_invr) {
|
}
|
||||||
|
else if (vehicle_state.errors.err_invr)
|
||||||
|
{
|
||||||
text = "INVR";
|
text = "INVR";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
text = "NONE";
|
text = "NONE";
|
||||||
}
|
}
|
||||||
return (void *)text;
|
return (void *)text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *get_zero() {
|
void *get_compiler_build_hash()
|
||||||
|
{
|
||||||
|
return (void *)git_hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_zero()
|
||||||
|
{
|
||||||
static float zero = 0.0f;
|
static float zero = 0.0f;
|
||||||
return &zero;
|
return &zero;
|
||||||
}
|
}
|
||||||
@ -265,7 +326,7 @@ NamedFieldDescription dataFieldDescs[] = {
|
|||||||
VEH_FIELD(lap_last)},
|
VEH_FIELD(lap_last)},
|
||||||
[DF_LVBatVoltage] = {NamedFieldKind::Float, "LVVBAT", 2, 2,
|
[DF_LVBatVoltage] = {NamedFieldKind::Float, "LVVBAT", 2, 2,
|
||||||
VEH_FIELD(lv_bat_voltage)},
|
VEH_FIELD(lv_bat_voltage)},
|
||||||
};
|
[DF_GitBuildHash] = {NamedFieldKind::Text, "BLDHASH", 1, 0, get_compiler_build_hash}};
|
||||||
|
|
||||||
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
||||||
DataFieldType_COUNT,
|
DataFieldType_COUNT,
|
||||||
@ -274,14 +335,12 @@ static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
|||||||
#define PARAM_FIELD(FIELD) []() { return (void *)¶ms.FIELD; }
|
#define PARAM_FIELD(FIELD) []() { return (void *)¶ms.FIELD; }
|
||||||
|
|
||||||
NamedFieldDescription paramFieldDescs[] = {
|
NamedFieldDescription paramFieldDescs[] = {
|
||||||
[PF_BBAL] = {NamedFieldKind::Float, "BBAL", 2, 1, PARAM_FIELD(bbal)},
|
|
||||||
[PF_SLIPREF] = {NamedFieldKind::Float, "SLIPREF", 2, 2,
|
|
||||||
PARAM_FIELD(slipref)},
|
|
||||||
[PF_MUMAX] = {NamedFieldKind::Float, "MUMAX", 2, 1, PARAM_FIELD(mumax)},
|
|
||||||
[PF_ASRP] = {NamedFieldKind::Int, "ASR-P", 2, 0, PARAM_FIELD(asrp)},
|
|
||||||
[PF_ASRON] = {NamedFieldKind::Int, "ASR-ON", 2, 0, PARAM_FIELD(asron)},
|
|
||||||
[PF_ASRI] = {NamedFieldKind::Int, "ASR-I", 2, 0, PARAM_FIELD(asri)},
|
|
||||||
[PF_PLIM] = {NamedFieldKind::Int, "PLIM", 2, 0, PARAM_FIELD(plim)},
|
[PF_PLIM] = {NamedFieldKind::Int, "PLIM", 2, 0, PARAM_FIELD(plim)},
|
||||||
|
[PF_TLIM] = {NamedFieldKind::Int, "TLIM", 4, 1, PARAM_FIELD(tlim)},
|
||||||
|
[PF_SLIM] = {NamedFieldKind::Int, "SLIM", 2, 2, PARAM_FIELD(slim)},
|
||||||
|
[PF_TVEC] = {NamedFieldKind::Int, "TVEC", 2, 1, PARAM_FIELD(tvec)},
|
||||||
|
[PF_PG] = {NamedFieldKind::Int, "PG", 2, 0, PARAM_FIELD(pg)},
|
||||||
|
[PF_REKU] = {NamedFieldKind::Int, "REKU", 2, 0, PARAM_FIELD(reku)},
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) ==
|
static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) ==
|
||||||
@ -293,31 +352,38 @@ size_t dataFieldAlphaIndexByField[DataFieldType_COUNT];
|
|||||||
ParamType paramByAlphaIndex[ParamType_COUNT];
|
ParamType paramByAlphaIndex[ParamType_COUNT];
|
||||||
size_t paramAlphaIndexByParam[ParamType_COUNT];
|
size_t paramAlphaIndexByParam[ParamType_COUNT];
|
||||||
|
|
||||||
template <class T> struct NFAlphabeticComp {
|
template <class T>
|
||||||
|
struct NFAlphabeticComp
|
||||||
|
{
|
||||||
NFAlphabeticComp(const NamedFieldDescription *fieldDescs)
|
NFAlphabeticComp(const NamedFieldDescription *fieldDescs)
|
||||||
: fieldDescs{fieldDescs} {}
|
: fieldDescs{fieldDescs} {}
|
||||||
|
|
||||||
const NamedFieldDescription *fieldDescs;
|
const NamedFieldDescription *fieldDescs;
|
||||||
|
|
||||||
bool operator()(const T &a, const T &b) const {
|
bool operator()(const T &a, const T &b) const
|
||||||
|
{
|
||||||
return strcmp(fieldDescs[a].title, fieldDescs[b].title) < 0;
|
return strcmp(fieldDescs[a].title, fieldDescs[b].title) < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void namedFieldSort(const NamedFieldDescription *fieldDescs, T *fieldByAlpha,
|
void namedFieldSort(const NamedFieldDescription *fieldDescs, T *fieldByAlpha,
|
||||||
size_t *alphaIndexByField, size_t numFields) {
|
size_t *alphaIndexByField, size_t numFields)
|
||||||
for (size_t i = 0; i < numFields; i++) {
|
{
|
||||||
|
for (size_t i = 0; i < numFields; i++)
|
||||||
|
{
|
||||||
fieldByAlpha[i] = static_cast<T>(i);
|
fieldByAlpha[i] = static_cast<T>(i);
|
||||||
}
|
}
|
||||||
std::sort(fieldByAlpha, fieldByAlpha + numFields,
|
std::sort(fieldByAlpha, fieldByAlpha + numFields,
|
||||||
NFAlphabeticComp<T>(fieldDescs));
|
NFAlphabeticComp<T>(fieldDescs));
|
||||||
for (size_t i = 0; i < numFields; i++) {
|
for (size_t i = 0; i < numFields; i++)
|
||||||
|
{
|
||||||
alphaIndexByField[fieldByAlpha[i]] = i;
|
alphaIndexByField[fieldByAlpha[i]] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void namedFieldSort() {
|
void namedFieldSort()
|
||||||
|
{
|
||||||
namedFieldSort(dataFieldDescs, dataFieldByAlphaIndex,
|
namedFieldSort(dataFieldDescs, dataFieldByAlphaIndex,
|
||||||
dataFieldAlphaIndexByField, DataFieldType_COUNT);
|
dataFieldAlphaIndexByField, DataFieldType_COUNT);
|
||||||
namedFieldSort(paramFieldDescs, paramByAlphaIndex, paramAlphaIndexByParam,
|
namedFieldSort(paramFieldDescs, paramByAlphaIndex, paramAlphaIndexByParam,
|
||||||
@ -328,7 +394,9 @@ template <class T>
|
|||||||
NamedField<T>::NamedField(const NamedFieldDescription *fieldDescs)
|
NamedField<T>::NamedField(const NamedFieldDescription *fieldDescs)
|
||||||
: fieldDescs{fieldDescs} {}
|
: fieldDescs{fieldDescs} {}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::setType(T type) {
|
template <class T>
|
||||||
|
void NamedField<T>::setType(T type)
|
||||||
|
{
|
||||||
this->type = type;
|
this->type = type;
|
||||||
desc = &fieldDescs[type];
|
desc = &fieldDescs[type];
|
||||||
|
|
||||||
@ -340,11 +408,15 @@ template <class T> void NamedField<T>::setType(T type) {
|
|||||||
updateValue();
|
updateValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> const T &NamedField<T>::getType() { return type; }
|
template <class T>
|
||||||
|
const T &NamedField<T>::getType() { return type; }
|
||||||
|
|
||||||
template <class T> void NamedField<T>::updateValue() {
|
template <class T>
|
||||||
|
void NamedField<T>::updateValue()
|
||||||
|
{
|
||||||
void *val = desc->getValue();
|
void *val = desc->getValue();
|
||||||
switch (desc->kind) {
|
switch (desc->kind)
|
||||||
|
{
|
||||||
case NamedFieldKind::Float:
|
case NamedFieldKind::Float:
|
||||||
setFloatValue(*static_cast<float *>(val));
|
setFloatValue(*static_cast<float *>(val));
|
||||||
break;
|
break;
|
||||||
@ -360,32 +432,45 @@ template <class T> void NamedField<T>::updateValue() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::setFloatValue(float floatValue) {
|
template <class T>
|
||||||
|
void NamedField<T>::setFloatValue(float floatValue)
|
||||||
|
{
|
||||||
fieldValue.f = floatValue;
|
fieldValue.f = floatValue;
|
||||||
updateValueBuffer();
|
updateValueBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::setBoolValue(int boolValue) {
|
template <class T>
|
||||||
|
void NamedField<T>::setBoolValue(int boolValue)
|
||||||
|
{
|
||||||
fieldValue.b = boolValue;
|
fieldValue.b = boolValue;
|
||||||
updateValueBuffer();
|
updateValueBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::setIntValue(int intValue) {
|
template <class T>
|
||||||
|
void NamedField<T>::setIntValue(int intValue)
|
||||||
|
{
|
||||||
fieldValue.i = intValue;
|
fieldValue.i = intValue;
|
||||||
updateValueBuffer();
|
updateValueBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::setStrValue(const char *strValue) {
|
template <class T>
|
||||||
|
void NamedField<T>::setStrValue(const char *strValue)
|
||||||
|
{
|
||||||
touchgfx::Unicode::strncpy(valueBuffer, strValue,
|
touchgfx::Unicode::strncpy(valueBuffer, strValue,
|
||||||
sizeof(valueBuffer) / sizeof(*valueBuffer));
|
sizeof(valueBuffer) / sizeof(*valueBuffer));
|
||||||
updateValueBuffer();
|
updateValueBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void NamedField<T>::updateValueBuffer() {
|
template <class T>
|
||||||
switch (desc->kind) {
|
void NamedField<T>::updateValueBuffer()
|
||||||
case NamedFieldKind::Float: {
|
{
|
||||||
|
switch (desc->kind)
|
||||||
|
{
|
||||||
|
case NamedFieldKind::Float:
|
||||||
|
{
|
||||||
size_t width = desc->int_digits;
|
size_t width = desc->int_digits;
|
||||||
if (desc->decimal_digits != 0) {
|
if (desc->decimal_digits != 0)
|
||||||
|
{
|
||||||
width += desc->decimal_digits + 1; // 1 digit for the decimal point
|
width += desc->decimal_digits + 1; // 1 digit for the decimal point
|
||||||
}
|
}
|
||||||
float params[3] = {(float)width, (float)desc->decimal_digits, fieldValue.f};
|
float params[3] = {(float)width, (float)desc->decimal_digits, fieldValue.f};
|
||||||
@ -394,7 +479,8 @@ template <class T> void NamedField<T>::updateValueBuffer() {
|
|||||||
params);
|
params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NamedFieldKind::Bool: {
|
case NamedFieldKind::Bool:
|
||||||
|
{
|
||||||
const char *str = fieldValue.b ? "YES" : "NO";
|
const char *str = fieldValue.b ? "YES" : "NO";
|
||||||
touchgfx::Unicode::strncpy(valueBuffer, str,
|
touchgfx::Unicode::strncpy(valueBuffer, str,
|
||||||
sizeof(valueBuffer) / sizeof(*valueBuffer));
|
sizeof(valueBuffer) / sizeof(*valueBuffer));
|
||||||
|
|||||||
@ -1005,7 +1005,6 @@
|
|||||||
{
|
{
|
||||||
"Type": "CustomContainerInstance",
|
"Type": "CustomContainerInstance",
|
||||||
"Name": "statusTS_R2D",
|
"Name": "statusTS_R2D",
|
||||||
"X": 1,
|
|
||||||
"Width": 65,
|
"Width": 65,
|
||||||
"Height": 33,
|
"Height": 33,
|
||||||
"CustomContainerDefinitionName": "DriverViewStatusItem"
|
"CustomContainerDefinitionName": "DriverViewStatusItem"
|
||||||
@ -1053,7 +1052,7 @@
|
|||||||
{
|
{
|
||||||
"Type": "CustomContainerInstance",
|
"Type": "CustomContainerInstance",
|
||||||
"Name": "statusLV",
|
"Name": "statusLV",
|
||||||
"X": 389,
|
"X": 390,
|
||||||
"Width": 65,
|
"Width": 65,
|
||||||
"Height": 33,
|
"Height": 33,
|
||||||
"CustomContainerDefinitionName": "DriverViewStatusItem"
|
"CustomContainerDefinitionName": "DriverViewStatusItem"
|
||||||
|
|||||||
@ -24,6 +24,9 @@
|
|||||||
|
|
||||||
/* USER CODE BEGIN TouchGFXHAL.cpp */
|
/* USER CODE BEGIN TouchGFXHAL.cpp */
|
||||||
|
|
||||||
|
#include "STWButtonController.hpp"
|
||||||
|
STWButtonController stwBC;
|
||||||
|
|
||||||
using namespace touchgfx;
|
using namespace touchgfx;
|
||||||
|
|
||||||
void TouchGFXHAL::initialize()
|
void TouchGFXHAL::initialize()
|
||||||
@ -35,6 +38,7 @@ void TouchGFXHAL::initialize()
|
|||||||
// Please note, HAL::initialize() must be called to initialize the framework.
|
// Please note, HAL::initialize() must be called to initialize the framework.
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::initialize();
|
TouchGFXGeneratedHAL::initialize();
|
||||||
|
setButtonController(&stwBC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : OSWrappers.cpp
|
* File Name : OSWrappers.cpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@ -16,7 +16,6 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <touchgfx/hal/HAL.hpp>
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
#include <touchgfx/hal/OSWrappers.hpp>
|
#include <touchgfx/hal/OSWrappers.hpp>
|
||||||
|
|
||||||
@ -25,6 +24,8 @@
|
|||||||
#include "tx_api.h"
|
#include "tx_api.h"
|
||||||
#include "tx_byte_pool.h"
|
#include "tx_byte_pool.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
// tx_thread.h is not C++ compatible, declare used symbols here as externals
|
// tx_thread.h is not C++ compatible, declare used symbols here as externals
|
||||||
extern "C" volatile UINT _tx_thread_preempt_disable;
|
extern "C" volatile UINT _tx_thread_preempt_disable;
|
||||||
extern "C" VOID _tx_thread_system_preempt_check(VOID);
|
extern "C" VOID _tx_thread_system_preempt_check(VOID);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : STM32DMA.cpp
|
* File Name : STM32DMA.cpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@ -16,27 +16,686 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
#include "stm32h7xx_hal_dma2d.h"
|
||||||
#include <STM32DMA.hpp>
|
#include <STM32DMA.hpp>
|
||||||
#include <assert.h>
|
#include <cassert>
|
||||||
|
#include <touchgfx/hal/HAL.hpp>
|
||||||
|
#include <touchgfx/hal/Paint.hpp>
|
||||||
|
|
||||||
|
/* Makes touchgfx specific types and variables visible to this file */
|
||||||
|
using namespace touchgfx;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const uint16_t format;
|
||||||
|
const uint16_t size;
|
||||||
|
const uint32_t* const data;
|
||||||
|
} clutData_t;
|
||||||
|
|
||||||
|
extern "C" void DMA2D_IRQHandler()
|
||||||
|
{
|
||||||
|
/* Transfer Complete Interrupt management ************************************/
|
||||||
|
if ((READ_REG(DMA2D->ISR) & DMA2D_FLAG_TC) != RESET)
|
||||||
|
{
|
||||||
|
/* Verify Transfer Complete Interrupt */
|
||||||
|
if ((READ_REG(DMA2D->CR) & DMA2D_IT_TC) != RESET)
|
||||||
|
{
|
||||||
|
/* Disable the transfer complete interrupt */
|
||||||
|
DMA2D->CR &= ~(DMA2D_IT_TC);
|
||||||
|
|
||||||
|
/* Clear the transfer complete flag */
|
||||||
|
DMA2D->IFCR = (DMA2D_FLAG_TC);
|
||||||
|
|
||||||
|
/* Signal DMA queue of execution complete */
|
||||||
|
touchgfx::HAL::getInstance()->signalDMAInterrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
STM32DMA::STM32DMA()
|
STM32DMA::STM32DMA()
|
||||||
: DMA_Interface(q), q(&b, 1)
|
: DMA_Interface(dma_queue), dma_queue(queue_storage, sizeof(queue_storage) / sizeof(queue_storage[0]))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
touchgfx::BlitOperations STM32DMA::getBlitCaps()
|
STM32DMA::~STM32DMA()
|
||||||
{
|
{
|
||||||
return static_cast<touchgfx::BlitOperations>(0);
|
/* Disable DMA2D global Interrupt */
|
||||||
|
NVIC_DisableIRQ(DMA2D_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STM32DMA::setupDataCopy(const touchgfx::BlitOp& blitOp)
|
void STM32DMA::initialize()
|
||||||
{
|
{
|
||||||
assert(0 && "DMA operation not supported");
|
/* Ensure DMA2D Clock is enabled */
|
||||||
|
__HAL_RCC_DMA2D_CLK_ENABLE();
|
||||||
|
__HAL_RCC_DMA2D_FORCE_RESET();
|
||||||
|
__HAL_RCC_DMA2D_RELEASE_RESET();
|
||||||
|
|
||||||
|
/* Enable DMA2D global Interrupt */
|
||||||
|
HAL_NVIC_SetPriority(DMA2D_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(DMA2D_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STM32DMA::setupDataFill(const touchgfx::BlitOp& blitOp)
|
inline uint32_t STM32DMA::getChromARTInputFormat(Bitmap::BitmapFormat format)
|
||||||
{
|
{
|
||||||
assert(0 && "DMA operation not supported");
|
// Default color mode set to ARGB8888
|
||||||
|
uint32_t dma2dColorMode = DMA2D_INPUT_ARGB8888;
|
||||||
|
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case Bitmap::ARGB8888: /* DMA2D input mode set to 32bit ARGB */
|
||||||
|
dma2dColorMode = DMA2D_INPUT_ARGB8888;
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB888: /* DMA2D input mode set to 24bit RGB */
|
||||||
|
dma2dColorMode = DMA2D_INPUT_RGB888;
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB565: /* DMA2D input mode set to 16bit RGB */
|
||||||
|
dma2dColorMode = DMA2D_INPUT_RGB565;
|
||||||
|
break;
|
||||||
|
case Bitmap::ARGB2222: /* Fall through */
|
||||||
|
case Bitmap::ABGR2222: /* Fall through */
|
||||||
|
case Bitmap::RGBA2222: /* Fall through */
|
||||||
|
case Bitmap::BGRA2222: /* Fall through */
|
||||||
|
case Bitmap::L8: /* DMA2D input mode set to 8bit Color Look up table*/
|
||||||
|
dma2dColorMode = DMA2D_INPUT_L8;
|
||||||
|
break;
|
||||||
|
case Bitmap::BW: /* Fall through */
|
||||||
|
case Bitmap::BW_RLE: /* Fall through */
|
||||||
|
case Bitmap::GRAY4: /* Fall through */
|
||||||
|
case Bitmap::GRAY2: /* Fall through */
|
||||||
|
default: /* Unsupported input format for DMA2D */
|
||||||
|
assert(0 && "Unsupported Format!");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dma2dColorMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t STM32DMA::getChromARTOutputFormat(Bitmap::BitmapFormat format)
|
||||||
|
{
|
||||||
|
// Default color mode set to ARGB8888
|
||||||
|
uint32_t dma2dColorMode = DMA2D_OUTPUT_ARGB8888;
|
||||||
|
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case Bitmap::ARGB8888: /* DMA2D output mode set to 32bit ARGB */
|
||||||
|
dma2dColorMode = DMA2D_OUTPUT_ARGB8888;
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB888: /* Fall through */
|
||||||
|
case Bitmap::ARGB2222: /* Fall through */
|
||||||
|
case Bitmap::ABGR2222: /* Fall through */
|
||||||
|
case Bitmap::RGBA2222: /* Fall through */
|
||||||
|
case Bitmap::BGRA2222: /* DMA2D output mode set to 24bit RGB */
|
||||||
|
dma2dColorMode = DMA2D_OUTPUT_RGB888;
|
||||||
|
break;
|
||||||
|
case Bitmap::RGB565: /* DMA2D output mode set to 16bit RGB */
|
||||||
|
dma2dColorMode = DMA2D_OUTPUT_RGB565;
|
||||||
|
break;
|
||||||
|
case Bitmap::L8: /* Fall through */
|
||||||
|
case Bitmap::BW: /* Fall through */
|
||||||
|
case Bitmap::BW_RLE: /* Fall through */
|
||||||
|
case Bitmap::GRAY4: /* Fall through */
|
||||||
|
case Bitmap::GRAY2: /* Fall through */
|
||||||
|
default: /* Unsupported output format for DMA2D */
|
||||||
|
assert(0 && "Unsupported Format!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dma2dColorMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlitOperations STM32DMA::getBlitCaps()
|
||||||
|
{
|
||||||
|
return static_cast<BlitOperations>(BLIT_OP_FILL
|
||||||
|
| BLIT_OP_FILL_WITH_ALPHA
|
||||||
|
| BLIT_OP_COPY
|
||||||
|
| BLIT_OP_COPY_L8
|
||||||
|
| BLIT_OP_COPY_WITH_ALPHA
|
||||||
|
| BLIT_OP_COPY_ARGB8888
|
||||||
|
| BLIT_OP_COPY_ARGB8888_WITH_ALPHA
|
||||||
|
| BLIT_OP_COPY_A4
|
||||||
|
| BLIT_OP_COPY_A8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void STM32DMA::setupDataCopy(const BlitOp& blitOp) handles blit operation of
|
||||||
|
* BLIT_OP_COPY
|
||||||
|
* BLIT_OP_COPY_L8
|
||||||
|
* BLIT_OP_COPY_WITH_ALPHA
|
||||||
|
* BLIT_OP_COPY_ARGB8888
|
||||||
|
* BLIT_OP_COPY_ARGB8888_WITH_ALPHA
|
||||||
|
* BLIT_OP_COPY_A4
|
||||||
|
* BLIT_OP_COPY_A8
|
||||||
|
*/
|
||||||
|
void STM32DMA::setupDataCopy(const BlitOp& blitOp)
|
||||||
|
{
|
||||||
|
uint32_t dma2dForegroundColorMode = getChromARTInputFormat(static_cast<Bitmap::BitmapFormat>(blitOp.srcFormat));
|
||||||
|
uint32_t dma2dBackgroundColorMode = getChromARTInputFormat(static_cast<Bitmap::BitmapFormat>(blitOp.dstFormat));
|
||||||
|
uint32_t dma2dOutputColorMode = getChromARTOutputFormat(static_cast<Bitmap::BitmapFormat>(blitOp.dstFormat));
|
||||||
|
|
||||||
|
/* DMA2D OOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OOR, blitOp.dstLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
/* DMA2D BGOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->BGOR, blitOp.dstLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
/* DMA2D FGOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->FGOR, blitOp.srcLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, dma2dOutputColorMode);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (blitOp.nLoops | (blitOp.nSteps << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(blitOp.pSrc));
|
||||||
|
|
||||||
|
switch (blitOp.operation)
|
||||||
|
{
|
||||||
|
case BLIT_OP_COPY_A4:
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_A4 | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* set DMA2D foreground color */
|
||||||
|
WRITE_REG(DMA2D->FGCOLR, blitOp.color);
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dBackgroundColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
break;
|
||||||
|
case BLIT_OP_COPY_A8:
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_A8 | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* set DMA2D foreground color */
|
||||||
|
WRITE_REG(DMA2D->FGCOLR, blitOp.color);
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dBackgroundColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
break;
|
||||||
|
case BLIT_OP_COPY_WITH_ALPHA:
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, dma2dForegroundColorMode | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dBackgroundColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
break;
|
||||||
|
case BLIT_OP_COPY_L8:
|
||||||
|
{
|
||||||
|
bool blend = true;
|
||||||
|
const clutData_t* const palette = reinterpret_cast<const clutData_t*>(blitOp.pClut);
|
||||||
|
|
||||||
|
/* Write foreground CLUT memory address */
|
||||||
|
WRITE_REG(DMA2D->FGCMAR, reinterpret_cast<uint32_t>(&palette->data));
|
||||||
|
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, dma2dForegroundColorMode | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dBackgroundColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Configure CLUT */
|
||||||
|
switch ((Bitmap::ClutFormat)palette->format)
|
||||||
|
{
|
||||||
|
case Bitmap::CLUT_FORMAT_L8_ARGB8888:
|
||||||
|
/* Write foreground CLUT size and CLUT color mode */
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM), (((palette->size - 1) << DMA2D_FGPFCCR_CS_Pos) | (DMA2D_CCM_ARGB8888 << DMA2D_FGPFCCR_CCM_Pos)));
|
||||||
|
break;
|
||||||
|
case Bitmap::CLUT_FORMAT_L8_RGB888:
|
||||||
|
if (blitOp.alpha == 255)
|
||||||
|
{
|
||||||
|
blend = false;
|
||||||
|
}
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM), (((palette->size - 1) << DMA2D_FGPFCCR_CS_Pos) | (DMA2D_CCM_RGB888 << DMA2D_FGPFCCR_CCM_Pos)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Bitmap::CLUT_FORMAT_L8_RGB565:
|
||||||
|
default:
|
||||||
|
assert(0 && "Unsupported format");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable the CLUT loading for the foreground */
|
||||||
|
SET_BIT(DMA2D->FGPFCCR, DMA2D_FGPFCCR_START);
|
||||||
|
|
||||||
|
while ((READ_REG(DMA2D->FGPFCCR) & DMA2D_FGPFCCR_START) != 0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
DMA2D->IFCR = (DMA2D_FLAG_CTC);
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
if (blend)
|
||||||
|
{
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_PFC | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BLIT_OP_COPY_ARGB8888:
|
||||||
|
case BLIT_OP_COPY_ARGB8888_WITH_ALPHA:
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, dma2dForegroundColorMode | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dBackgroundColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
break;
|
||||||
|
default: /* BLIT_OP_COPY */
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, dma2dForegroundColorMode | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (blitOp.alpha << 24));
|
||||||
|
|
||||||
|
/* Perform pixel-format-conversion (PFC) If Bitmap format is not same format as framebuffer format */
|
||||||
|
if (blitOp.srcFormat != blitOp.dstFormat)
|
||||||
|
{
|
||||||
|
/* Start DMA2D : PFC Mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_PFC | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Start DMA2D : M2M Mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M | DMA2D_IT_TC | DMA2D_CR_START | DMA2D_IT_CE | DMA2D_IT_TE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* void STM32DMA::setupDataFill(const BlitOp& blitOp) handles blit operation of
|
||||||
|
* BLIT_OP_FILL
|
||||||
|
* BLIT_OP_FILL_WITH_ALPHA
|
||||||
|
*/
|
||||||
|
void STM32DMA::setupDataFill(const BlitOp& blitOp)
|
||||||
|
{
|
||||||
|
uint32_t dma2dOutputColorMode = getChromARTOutputFormat(static_cast<Bitmap::BitmapFormat>(blitOp.dstFormat));
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, dma2dOutputColorMode);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (blitOp.nLoops | (blitOp.nSteps << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* DMA2D OOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OOR, blitOp.dstLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
if (blitOp.operation == BLIT_OP_FILL_WITH_ALPHA)
|
||||||
|
{
|
||||||
|
/* DMA2D BGOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->BGOR, blitOp.dstLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
/* DMA2D FGOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->FGOR, blitOp.dstLoopStride - blitOp.nSteps);
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, dma2dOutputColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Write DMA2D FGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_A8 | (DMA2D_REPLACE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | ((blitOp.alpha << 24) & DMA2D_FGPFCCR_ALPHA));
|
||||||
|
|
||||||
|
/* DMA2D FGCOLR register configuration */
|
||||||
|
WRITE_REG(DMA2D->FGCOLR, blitOp.color);
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(blitOp.pDst));
|
||||||
|
|
||||||
|
/* Enable the Peripheral and Enable the transfer complete interrupt */
|
||||||
|
WRITE_REG(DMA2D->CR, (DMA2D_IT_TC | DMA2D_CR_START | DMA2D_M2M_BLEND | DMA2D_IT_CE | DMA2D_IT_TE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Write DMA2D FGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, dma2dOutputColorMode | (DMA2D_NO_MODIF_ALPHA << DMA2D_FGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* DMA2D FGOR register configuration */
|
||||||
|
WRITE_REG(DMA2D->FGOR, 0);
|
||||||
|
|
||||||
|
/* Set color */
|
||||||
|
WRITE_REG(DMA2D->OCOLR, ((blitOp.color >> 8) & 0xF800) | ((blitOp.color >> 5) & 0x07E0) | ((blitOp.color >> 3) & 0x001F));
|
||||||
|
|
||||||
|
/* Enable the Peripheral and Enable the transfer complete interrupt */
|
||||||
|
WRITE_REG(DMA2D->CR, (DMA2D_IT_TC | DMA2D_CR_START | DMA2D_R2M | DMA2D_IT_CE | DMA2D_IT_TE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace touchgfx
|
||||||
|
{
|
||||||
|
namespace paint
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const clutData_t* L8CLUT = 0;
|
||||||
|
uint32_t L8ClutLoaded = 0;
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void setL8Palette(const uint8_t* const data)
|
||||||
|
{
|
||||||
|
L8CLUT = reinterpret_cast<const clutData_t*>(data - offsetof(clutData_t, data));
|
||||||
|
L8ClutLoaded = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void tearDown();
|
||||||
|
*
|
||||||
|
* @brief Waits until previous DMA drawing operation has finished
|
||||||
|
*/
|
||||||
|
void tearDown()
|
||||||
|
{
|
||||||
|
/* Wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear transfer flags */
|
||||||
|
WRITE_REG(DMA2D->IFCR, DMA2D_FLAG_TC | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Flushes a line of pixels in the data cache if used.
|
||||||
|
*
|
||||||
|
* @brief Flushes decoded RGB pixels when rendering compressed images
|
||||||
|
*/
|
||||||
|
void flushLine(uint32_t* addr, int sizebytes)
|
||||||
|
{
|
||||||
|
// This funciton is used when decompressing RGB images to flush
|
||||||
|
// the currently decoded pixels in the cache to allow the DMA2D
|
||||||
|
// to blend the pixels correcly.
|
||||||
|
if (SCB->CCR & SCB_CCR_DC_Msk)
|
||||||
|
{
|
||||||
|
SCB_CleanDCache_by_Addr(addr, sizebytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace rgb565
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @fn void lineFromColor();
|
||||||
|
*
|
||||||
|
* @brief Renders Canvas Widget chunks using DMA.
|
||||||
|
* This functions will not generate an interrupt, and will not affect the DMA queue.
|
||||||
|
*/
|
||||||
|
void lineFromColor(uint16_t* const ptr, const unsigned count, const uint32_t color, const uint8_t alpha, const uint32_t color565)
|
||||||
|
{
|
||||||
|
/* Wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear transfer flags */
|
||||||
|
WRITE_REG(DMA2D->IFCR, DMA2D_FLAG_TC | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, DMA2D_OUTPUT_RGB565);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (1 | (count << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
if (alpha < 0xFF)
|
||||||
|
{
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, DMA2D_OUTPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Write DMA2D FGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_A8 | (DMA2D_REPLACE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
/* DMA2D FGCOLR register configuration */
|
||||||
|
WRITE_REG(DMA2D->FGCOLR, color);
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, (uint32_t)ptr);
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, (uint32_t)ptr);
|
||||||
|
|
||||||
|
/* Enable the Peripheral and Enable the transfer complete interrupt */
|
||||||
|
WRITE_REG(DMA2D->CR, (DMA2D_CR_START | DMA2D_M2M_BLEND));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Write DMA2D FGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_OUTPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_FGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Set color */
|
||||||
|
WRITE_REG(DMA2D->OCOLR, color565);
|
||||||
|
|
||||||
|
/* Enable the Peripheral and Enable the transfer complete interrupt */
|
||||||
|
WRITE_REG(DMA2D->CR, (DMA2D_CR_START | DMA2D_R2M));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lineFromRGB565(uint16_t* const ptr, const uint16_t* const data, const unsigned count, const uint8_t alpha)
|
||||||
|
{
|
||||||
|
/* Wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear transfer flags */
|
||||||
|
WRITE_REG(DMA2D->IFCR, DMA2D_FLAG_TC | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, DMA2D_OUTPUT_RGB565);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (1 | (count << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(data));
|
||||||
|
|
||||||
|
if (alpha < 0xFF)
|
||||||
|
{
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_COMBINE_ALPHA << DMA2D_FGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
/* Start DMA2D : M2M Mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lineFromARGB8888(uint16_t* const ptr, const uint32_t* const data, const unsigned count, const uint8_t alpha)
|
||||||
|
{
|
||||||
|
/* Wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear transfer flags */
|
||||||
|
WRITE_REG(DMA2D->IFCR, DMA2D_FLAG_TC | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, DMA2D_OUTPUT_RGB565);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (1 | (count << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(data));
|
||||||
|
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_ARGB8888 | (DMA2D_COMBINE_ALPHA << DMA2D_BGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lineFromL8RGB888(uint16_t* const ptr, const uint8_t* const data, const unsigned count, const uint8_t alpha)
|
||||||
|
{
|
||||||
|
/* wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, DMA2D_OUTPUT_RGB565);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (1 | (count << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(data));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Load CLUT if not already loaded */
|
||||||
|
if (L8ClutLoaded == 0)
|
||||||
|
{
|
||||||
|
/* Write foreground CLUT memory address */
|
||||||
|
WRITE_REG(DMA2D->FGCMAR, reinterpret_cast<uint32_t>(&L8CLUT->data));
|
||||||
|
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_L8 | (DMA2D_COMBINE_ALPHA << DMA2D_BGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM), (((L8CLUT->size - 1) << DMA2D_FGPFCCR_CS_Pos) | (DMA2D_CCM_RGB888 << DMA2D_FGPFCCR_CCM_Pos)));
|
||||||
|
|
||||||
|
/* Enable the CLUT loading for the foreground */
|
||||||
|
SET_BIT(DMA2D->FGPFCCR, DMA2D_FGPFCCR_START);
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Mark CLUT loaded */
|
||||||
|
L8ClutLoaded = 1;
|
||||||
|
|
||||||
|
/* Wait for load to finish */
|
||||||
|
while ((READ_REG(DMA2D->FGPFCCR) & DMA2D_FGPFCCR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear CLUT Transfer Complete flag */
|
||||||
|
DMA2D->IFCR = (DMA2D_FLAG_CTC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set correct alpha for these pixels */
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, DMA2D_BGPFCCR_ALPHA_Msk, alpha << DMA2D_FGPFCCR_ALPHA_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start pixel transfer in correct mode */
|
||||||
|
if (alpha < 0xFF)
|
||||||
|
{
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set DMA2D mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_PFC | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lineFromL8ARGB8888(uint16_t* const ptr, const uint8_t* const data, const unsigned count, const uint8_t alpha)
|
||||||
|
{
|
||||||
|
/* wait for DMA2D to finish last run */
|
||||||
|
while ((READ_REG(DMA2D->CR) & DMA2D_CR_START) != 0U);
|
||||||
|
|
||||||
|
/* DMA2D OPFCCR register configuration */
|
||||||
|
WRITE_REG(DMA2D->OPFCCR, DMA2D_OUTPUT_RGB565);
|
||||||
|
|
||||||
|
/* Configure DMA2D data size */
|
||||||
|
WRITE_REG(DMA2D->NLR, (1 | (count << DMA2D_NLR_PL_Pos)));
|
||||||
|
|
||||||
|
/* Configure DMA2D destination address */
|
||||||
|
WRITE_REG(DMA2D->OMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Configure DMA2D source address */
|
||||||
|
WRITE_REG(DMA2D->FGMAR, reinterpret_cast<uint32_t>(data));
|
||||||
|
|
||||||
|
/* Configure DMA2D Stream source2 address */
|
||||||
|
WRITE_REG(DMA2D->BGMAR, reinterpret_cast<uint32_t>(ptr));
|
||||||
|
|
||||||
|
/* Load CLUT if not already loaded */
|
||||||
|
if (L8ClutLoaded == 0)
|
||||||
|
{
|
||||||
|
/* Write foreground CLUT memory address */
|
||||||
|
WRITE_REG(DMA2D->FGCMAR, reinterpret_cast<uint32_t>(&L8CLUT->data));
|
||||||
|
|
||||||
|
/* Set DMA2D color mode and alpha mode */
|
||||||
|
WRITE_REG(DMA2D->FGPFCCR, DMA2D_INPUT_L8 | (DMA2D_COMBINE_ALPHA << DMA2D_BGPFCCR_AM_Pos) | (alpha << DMA2D_FGPFCCR_ALPHA_Pos));
|
||||||
|
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM), (((L8CLUT->size - 1) << DMA2D_FGPFCCR_CS_Pos) | (DMA2D_CCM_ARGB8888 << DMA2D_FGPFCCR_CCM_Pos)));
|
||||||
|
|
||||||
|
/* Enable the CLUT loading for the foreground */
|
||||||
|
SET_BIT(DMA2D->FGPFCCR, DMA2D_FGPFCCR_START);
|
||||||
|
|
||||||
|
/* Write DMA2D BGPFCCR register */
|
||||||
|
WRITE_REG(DMA2D->BGPFCCR, DMA2D_INPUT_RGB565 | (DMA2D_NO_MODIF_ALPHA << DMA2D_BGPFCCR_AM_Pos));
|
||||||
|
|
||||||
|
/* Mark CLUT loaded */
|
||||||
|
L8ClutLoaded = 1;
|
||||||
|
|
||||||
|
/* Wait for load to finish */
|
||||||
|
while ((READ_REG(DMA2D->FGPFCCR) & DMA2D_FGPFCCR_START) != 0U);
|
||||||
|
|
||||||
|
/* Clear CLUT Transfer Complete flag */
|
||||||
|
DMA2D->IFCR = (DMA2D_FLAG_CTC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set correct alpha for these pixels */
|
||||||
|
MODIFY_REG(DMA2D->FGPFCCR, DMA2D_BGPFCCR_ALPHA_Msk, alpha << DMA2D_FGPFCCR_ALPHA_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start pixel transfer in blending mode */
|
||||||
|
WRITE_REG(DMA2D->CR, DMA2D_M2M_BLEND | DMA2D_CR_START);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace rgb565
|
||||||
|
} // namespace paint
|
||||||
|
} // namespace touchgfx
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : STM32DMA.hpp
|
* File Name : STM32DMA.hpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#ifndef STM32DMA_HPP
|
#ifndef STM32DMA_HPP
|
||||||
#define STM32DMA_HPP
|
#define STM32DMA_HPP
|
||||||
|
|
||||||
#include <touchgfx/hal/BlitOp.hpp>
|
#include <touchgfx/Bitmap.hpp>
|
||||||
#include <touchgfx/hal/DMA.hpp>
|
#include <touchgfx/hal/DMA.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,68 +26,139 @@
|
|||||||
*
|
*
|
||||||
* @brief This class specializes DMA_Interface for the STM32 processors.
|
* @brief This class specializes DMA_Interface for the STM32 processors.
|
||||||
*
|
*
|
||||||
* @see touchgfx::DMA_Interface
|
* @sa touchgfx::DMA_Interface
|
||||||
*/
|
*/
|
||||||
class STM32DMA : public touchgfx::DMA_Interface
|
class STM32DMA : public touchgfx::DMA_Interface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @typedef touchgfx::DMA_Interface Base
|
||||||
|
*
|
||||||
|
* @brief Defines an alias representing the base.
|
||||||
|
*
|
||||||
|
Defines an alias representing the base.
|
||||||
|
*/
|
||||||
|
typedef touchgfx::DMA_Interface Base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @fn STM32DMA::STM32DMA();
|
* @fn STM32DMA::STM32DMA();
|
||||||
*
|
*
|
||||||
* @brief Default constructor.
|
* @brief Default constructor.
|
||||||
|
*
|
||||||
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
STM32DMA();
|
STM32DMA();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn STM32DMA::~STM32DMA();
|
||||||
|
*
|
||||||
|
* @brief Destructor.
|
||||||
|
*
|
||||||
|
* Destructor.
|
||||||
|
*/
|
||||||
|
virtual ~STM32DMA();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn DMAType touchgfx::STM32DMA::getDMAType()
|
||||||
|
*
|
||||||
|
* @brief Function for obtaining the DMA type of the concrete DMA_Interface implementation.
|
||||||
|
*
|
||||||
|
* Function for obtaining the DMA type of the concrete DMA_Interface implementation.
|
||||||
|
* As default, will return DMA_TYPE_CHROMART type value.
|
||||||
|
*
|
||||||
|
* @return a DMAType value of the concrete DMA_Interface implementation.
|
||||||
|
*/
|
||||||
|
virtual touchgfx::DMAType getDMAType(void)
|
||||||
|
{
|
||||||
|
return touchgfx::DMA_TYPE_CHROMART;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn touchgfx::BlitOperations STM32DMA::getBlitCaps();
|
* @fn touchgfx::BlitOperations STM32DMA::getBlitCaps();
|
||||||
*
|
*
|
||||||
* @brief No blit operations supported by this DMA implementation.
|
* @brief Gets the blit capabilities.
|
||||||
*
|
*
|
||||||
* @return Zero (no blit ops supported).
|
* Gets the blit capabilities.
|
||||||
|
*
|
||||||
|
* This DMA supports a range of blit caps: BLIT_OP_COPY, BLIT_OP_COPY_ARGB8888,
|
||||||
|
* BLIT_OP_COPY_ARGB8888_WITH_ALPHA, BLIT_OP_COPY_A4, BLIT_OP_COPY_A8.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return Currently supported blitcaps.
|
||||||
*/
|
*/
|
||||||
virtual touchgfx::BlitOperations getBlitCaps();
|
virtual touchgfx::BlitOperations getBlitCaps();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void STM32DMA::initialize();
|
||||||
|
*
|
||||||
|
* @brief Perform hardware specific initialization.
|
||||||
|
*
|
||||||
|
* Perform hardware specific initialization.
|
||||||
|
*/
|
||||||
|
virtual void initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void STM32DMA::signalDMAInterrupt()
|
||||||
|
*
|
||||||
|
* @brief Raises a DMA interrupt signal.
|
||||||
|
*
|
||||||
|
* Raises a DMA interrupt signal.
|
||||||
|
*/
|
||||||
|
virtual void signalDMAInterrupt()
|
||||||
|
{
|
||||||
|
executeCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @fn virtual void STM32DMA::setupDataCopy(const touchgfx::BlitOp& blitOp);
|
* @fn virtual void STM32DMA::setupDataCopy(const touchgfx::BlitOp& blitOp);
|
||||||
*
|
*
|
||||||
* @brief Asserts if used.
|
* @brief Configures the DMA for copying data to the frame buffer.
|
||||||
*
|
*
|
||||||
* @param blitOp The blit operation to be performed by this DMA instance.
|
* Configures the DMA for copying data to the frame buffer.
|
||||||
|
*
|
||||||
|
* @param blitOp Details on the copy to perform.
|
||||||
*/
|
*/
|
||||||
virtual void setupDataCopy(const touchgfx::BlitOp& blitOp);
|
virtual void setupDataCopy(const touchgfx::BlitOp& blitOp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn virtual void STM32DMA::setupDataFill(const touchgfx::BlitOp& blitOp);
|
* @fn virtual void STM32DMA::setupDataFill(const touchgfx::BlitOp& blitOp);
|
||||||
*
|
*
|
||||||
* @brief Asserts if used.
|
* @brief Configures the DMA for "filling" the frame-buffer with a single color.
|
||||||
*
|
*
|
||||||
* @param blitOp The blit operation to be performed by this DMA instance.
|
* Configures the DMA for "filling" the frame-buffer with a single color.
|
||||||
|
*
|
||||||
|
* @param blitOp Details on the "fill" to perform.
|
||||||
*/
|
*/
|
||||||
virtual void setupDataFill(const touchgfx::BlitOp& blitOp);
|
virtual void setupDataFill(const touchgfx::BlitOp& blitOp);
|
||||||
|
|
||||||
/**
|
|
||||||
* @fn virtual void STM32DMA::signalDMAInterrupt();
|
|
||||||
*
|
|
||||||
* @brief Does nothing.
|
|
||||||
*/
|
|
||||||
virtual void signalDMAInterrupt()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @fn virtual void STM32DMA::flush();
|
|
||||||
*
|
|
||||||
* @brief Block until all DMA transfers are complete. Since this particular DMA does not do
|
|
||||||
* anything, return immediately.
|
|
||||||
*/
|
|
||||||
virtual void flush()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
touchgfx::LockFreeDMA_Queue q;
|
touchgfx::LockFreeDMA_Queue dma_queue;
|
||||||
touchgfx::BlitOp b;
|
touchgfx::BlitOp queue_storage[96];
|
||||||
};
|
|
||||||
#endif // TOUCHGFX_NODMA_HPP
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void STM32DMA::getChromARTInputFormat()
|
||||||
|
*
|
||||||
|
* @brief Convert Bitmap format to ChromART Input format.
|
||||||
|
*
|
||||||
|
* @param format Bitmap format.
|
||||||
|
*
|
||||||
|
* @return ChromART Input format.
|
||||||
|
*/
|
||||||
|
|
||||||
|
inline uint32_t getChromARTInputFormat(touchgfx::Bitmap::BitmapFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn void STM32DMA::getChromARTOutputFormat()
|
||||||
|
*
|
||||||
|
* @brief Convert Bitmap format to ChromART Output format.
|
||||||
|
*
|
||||||
|
* @param format Bitmap format.
|
||||||
|
*
|
||||||
|
* @return ChromART Output format.
|
||||||
|
*/
|
||||||
|
inline uint32_t getChromARTOutputFormat(touchgfx::Bitmap::BitmapFormat format);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STM32DMA_HPP
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : TouchGFXConfiguration.cpp
|
* File Name : TouchGFXConfiguration.cpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : TouchGFXGeneratedHAL.cpp
|
* File Name : TouchGFXGeneratedHAL.cpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@ -19,41 +19,53 @@
|
|||||||
#include <TouchGFXGeneratedHAL.hpp>
|
#include <TouchGFXGeneratedHAL.hpp>
|
||||||
#include <touchgfx/hal/OSWrappers.hpp>
|
#include <touchgfx/hal/OSWrappers.hpp>
|
||||||
#include <gui/common/FrontendHeap.hpp>
|
#include <gui/common/FrontendHeap.hpp>
|
||||||
#include <touchgfx/hal/PaintImpl.hpp>
|
#include <touchgfx/hal/GPIO.hpp>
|
||||||
#include <touchgfx/hal/PaintRGB565Impl.hpp>
|
|
||||||
|
|
||||||
#include "stm32h7xx.h"
|
#include "stm32h7xx.h"
|
||||||
|
#include "stm32h7xx_hal_ltdc.h"
|
||||||
|
|
||||||
using namespace touchgfx;
|
using namespace touchgfx;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Use the section "TouchGFX_Framebuffer" in the linker script to specify the placement of the buffer
|
static uint16_t lcd_int_active_line;
|
||||||
LOCATION_PRAGMA_NOLOAD("TouchGFX_Framebuffer")
|
static uint16_t lcd_int_porch_line;
|
||||||
uint32_t frameBuf[(320 * 480 * 2 + 3) / 4] LOCATION_ATTRIBUTE_NOLOAD("TouchGFX_Framebuffer");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::initialize()
|
void TouchGFXGeneratedHAL::initialize()
|
||||||
{
|
{
|
||||||
HAL::initialize();
|
HAL::initialize();
|
||||||
registerEventListener(*(Application::getInstance()));
|
registerEventListener(*(Application::getInstance()));
|
||||||
setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);
|
setFrameBufferStartAddresses((void*)0x24040000, (void*)0x240A0000, (void*)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::configureInterrupts()
|
void TouchGFXGeneratedHAL::configureInterrupts()
|
||||||
{
|
{
|
||||||
|
NVIC_SetPriority(DMA2D_IRQn, 9);
|
||||||
|
NVIC_SetPriority(LTDC_IRQn, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::enableInterrupts()
|
void TouchGFXGeneratedHAL::enableInterrupts()
|
||||||
{
|
{
|
||||||
|
NVIC_EnableIRQ(DMA2D_IRQn);
|
||||||
|
NVIC_EnableIRQ(LTDC_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::disableInterrupts()
|
void TouchGFXGeneratedHAL::disableInterrupts()
|
||||||
{
|
{
|
||||||
|
NVIC_DisableIRQ(DMA2D_IRQn);
|
||||||
|
NVIC_DisableIRQ(LTDC_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::enableLCDControllerInterrupt()
|
void TouchGFXGeneratedHAL::enableLCDControllerInterrupt()
|
||||||
{
|
{
|
||||||
|
lcd_int_active_line = (LTDC->BPCR & 0x7FF) - 1;
|
||||||
|
lcd_int_porch_line = (LTDC->AWCR & 0x7FF) - 1;
|
||||||
|
|
||||||
|
/* Sets the Line Interrupt position */
|
||||||
|
LTDC->LIPCR = lcd_int_active_line;
|
||||||
|
/* Line Interrupt Enable */
|
||||||
|
LTDC->IER |= LTDC_IER_LIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchGFXGeneratedHAL::beginFrame()
|
bool TouchGFXGeneratedHAL::beginFrame()
|
||||||
@ -66,21 +78,17 @@ void TouchGFXGeneratedHAL::endFrame()
|
|||||||
HAL::endFrame();
|
HAL::endFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t* TouchGFXGeneratedHAL::advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const
|
|
||||||
{
|
|
||||||
// Advance vertically Advance horizontally
|
|
||||||
fbPtr += rect.y * lcd().framebufferStride() + rect.x * 2;
|
|
||||||
return fbPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t* TouchGFXGeneratedHAL::getTFTFrameBuffer() const
|
uint16_t* TouchGFXGeneratedHAL::getTFTFrameBuffer() const
|
||||||
{
|
{
|
||||||
return (uint16_t*)frameBuf;
|
return (uint16_t*)LTDC_Layer1->CFBAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr)
|
void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr)
|
||||||
{
|
{
|
||||||
//setTFTFrameBuffer() not used for selected display interface
|
LTDC_Layer1->CFBAR = (uint32_t)adr;
|
||||||
|
|
||||||
|
/* Reload immediate */
|
||||||
|
LTDC->SRCR = (uint32_t)LTDC_SRCR_IMR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
|
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
|
||||||
@ -95,10 +103,11 @@ bool TouchGFXGeneratedHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT s
|
|||||||
|
|
||||||
void TouchGFXGeneratedHAL::InvalidateCache()
|
void TouchGFXGeneratedHAL::InvalidateCache()
|
||||||
{
|
{
|
||||||
// If the framebuffer is placed in Write Through cached memory (e.g. SRAM) then
|
// Because DMA2D access main memory directly, the DCache must be invalidated
|
||||||
// the DCache must be flushed prior to DMA2D accessing it. That's done
|
// becuase it could hold a wrong image of the framebuffer. That's done
|
||||||
// using the function SCB_CleanInvalidateDCache(). Remember to enable "CPU Cache" in the
|
// using the function SCB_CleanInvalidateDCache(). Remember to enable
|
||||||
// "System Core" settings for "Cortex M7" in CubeMX in order for this function call to work.
|
// "CPU Cache" in the "System Core" settings for "Cortex M7" in CubeMX
|
||||||
|
// in order for this function call to work.
|
||||||
if (SCB->CCR & SCB_CCR_DC_Msk)
|
if (SCB->CCR & SCB_CCR_DC_Msk)
|
||||||
{
|
{
|
||||||
SCB_CleanInvalidateDCache();
|
SCB_CleanInvalidateDCache();
|
||||||
@ -107,14 +116,48 @@ void TouchGFXGeneratedHAL::InvalidateCache()
|
|||||||
|
|
||||||
void TouchGFXGeneratedHAL::FlushCache()
|
void TouchGFXGeneratedHAL::FlushCache()
|
||||||
{
|
{
|
||||||
// If the framebuffer is placed in Write Through cached memory (e.g. SRAM) then
|
// If the framebuffer is placed in Write-Back cached memory (e.g. SRAM) then
|
||||||
// the DCache must be flushed prior to DMA2D accessing it. That's done
|
// the DCache must be flushed prior to DMA2D accessing it. That's done
|
||||||
// using the function SCB_CleanInvalidateDCache(). Remember to enable "CPU Cache" in the
|
// using the function SCB_CleanInvalidateDCache(). Remember to enable
|
||||||
// "System Core" settings for "Cortex M7" in CubeMX in order for this function call to work.
|
// "CPU Cache" in the "System Core" settings for "Cortex M7" in CubeMX in
|
||||||
|
// order for this function call to work.
|
||||||
if (SCB->CCR & SCB_CCR_DC_Msk)
|
if (SCB->CCR & SCB_CCR_DC_Msk)
|
||||||
{
|
{
|
||||||
SCB_CleanInvalidateDCache();
|
SCB_CleanInvalidateDCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef* hltdc)
|
||||||
|
{
|
||||||
|
if (!HAL::getInstance())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LTDC->LIPCR == lcd_int_active_line)
|
||||||
|
{
|
||||||
|
//entering active area
|
||||||
|
HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_porch_line);
|
||||||
|
HAL::getInstance()->vSync();
|
||||||
|
OSWrappers::signalVSync();
|
||||||
|
|
||||||
|
// Swap frame buffers immediately instead of waiting for the task to be scheduled in.
|
||||||
|
// Note: task will also swap when it wakes up, but that operation is guarded and will not have
|
||||||
|
// any effect if already swapped.
|
||||||
|
HAL::getInstance()->swapFrameBuffers();
|
||||||
|
GPIO::set(GPIO::VSYNC_FREQ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//exiting active area
|
||||||
|
HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_active_line);
|
||||||
|
|
||||||
|
// Signal to the framework that display update has finished.
|
||||||
|
HAL::getInstance()->frontPorchEntered();
|
||||||
|
GPIO::clear(GPIO::VSYNC_FREQ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : TouchGFXGeneratedHAL.hpp
|
* File Name : TouchGFXGeneratedHAL.hpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file is generated by TouchGFX Generator 4.23.2. Please, do not edit!
|
* This file is generated by TouchGFX Generator 4.24.0. Please, do not edit!
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
@ -60,27 +60,27 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @fn virtual void TouchGFXGeneratedHAL::configureInterrupts();
|
* @fn virtual void TouchGFXGeneratedHAL::configureInterrupts();
|
||||||
*
|
*
|
||||||
* @brief Sets the DMA and LCD interrupt priorities.
|
* @brief Sets the DMA, LCD, and GPU2D (if enabled) interrupt priorities.
|
||||||
*
|
*
|
||||||
* Sets the DMA and LCD interrupt priorities.
|
* Sets the DMA, LCD, and GPU2D (if enabled) interrupt priorities.
|
||||||
*/
|
*/
|
||||||
virtual void configureInterrupts();
|
virtual void configureInterrupts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn virtual void TouchGFXGeneratedHAL::enableInterrupts();
|
* @fn virtual void TouchGFXGeneratedHAL::enableInterrupts();
|
||||||
*
|
*
|
||||||
* @brief Enables the DMA and LCD interrupts.
|
* @brief Enables the DMA, LCD, and GPU2D (if enabled) interrupts.
|
||||||
*
|
*
|
||||||
* Enables the DMA and LCD interrupts.
|
* Enables the DMA, LCD, and GPU2D (if enabled) interrupts.
|
||||||
*/
|
*/
|
||||||
virtual void enableInterrupts();
|
virtual void enableInterrupts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn virtual void TouchGFXGeneratedHAL::disableInterrupts();
|
* @fn virtual void TouchGFXGeneratedHAL::disableInterrupts();
|
||||||
*
|
*
|
||||||
* @brief Disables the DMA and LCD interrupts.
|
* @brief Disables the DMA, LDC, and GPU2D (if enabled) interrupts.
|
||||||
*
|
*
|
||||||
* Disables the DMA and LCD interrupts.
|
* Disables the DMA, LDC, and GPU2D (if enabled) interrupts.
|
||||||
*/
|
*/
|
||||||
virtual void disableInterrupts();
|
virtual void disableInterrupts();
|
||||||
|
|
||||||
@ -114,8 +114,6 @@ public:
|
|||||||
* @brief This function is called whenever the framework has performed a partial draw.
|
* @brief This function is called whenever the framework has performed a partial draw.
|
||||||
*
|
*
|
||||||
* This function is called whenever the framework has performed a partial draw.
|
* This function is called whenever the framework has performed a partial draw.
|
||||||
* On the STM32F7, make sure to clean and invalidate the data cache. This is to
|
|
||||||
* ensure that LTDC sees correct data when transferring to the display.
|
|
||||||
*
|
*
|
||||||
* @param rect The area of the screen that has been drawn, expressed in absolute coordinates.
|
* @param rect The area of the screen that has been drawn, expressed in absolute coordinates.
|
||||||
*
|
*
|
||||||
@ -156,24 +154,6 @@ public:
|
|||||||
* Called when a rendering pass is completed.
|
* Called when a rendering pass is completed.
|
||||||
*/
|
*/
|
||||||
virtual void endFrame();
|
virtual void endFrame();
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @fn inline uint8_t* TouchGFXGeneratedHAL::advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const;
|
|
||||||
*
|
|
||||||
* @brief This function calculates the offset in the framebuffer address according to "rect" coordinates.
|
|
||||||
*
|
|
||||||
* This function is typically for users who need to transfer framebuffer data to
|
|
||||||
* a display from within flushFrameBuffer(Rect& rect). While HAL::lockFrameBuffer()
|
|
||||||
* returns a pointer to the current drawing framebuffer, users must manually calculate
|
|
||||||
* the offset from that pointer to the Rect to transfer. This function will advance the offset
|
|
||||||
* in the framebuffer equal to the rect's upper left corner (x, y).
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param fbPtr Pointer to the start of the framebuffer, coordinates (0, 0)
|
|
||||||
* @param rect The area of the screen expressed in absolute coordinates, which has to be transformed to address.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
inline uint8_t* advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -154,12 +154,12 @@ Mcu.Pin71=VP_TIM1_VS_ClockSourceINT
|
|||||||
Mcu.Pin72=VP_TIM2_VS_ClockSourceINT
|
Mcu.Pin72=VP_TIM2_VS_ClockSourceINT
|
||||||
Mcu.Pin73=VP_TIM17_VS_ClockSourceINT
|
Mcu.Pin73=VP_TIM17_VS_ClockSourceINT
|
||||||
Mcu.Pin74=VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0
|
Mcu.Pin74=VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0
|
||||||
Mcu.Pin75=VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2
|
Mcu.Pin75=VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.24.0
|
||||||
Mcu.Pin8=PF3
|
Mcu.Pin8=PF3
|
||||||
Mcu.Pin9=PF4
|
Mcu.Pin9=PF4
|
||||||
Mcu.PinsNb=76
|
Mcu.PinsNb=76
|
||||||
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0
|
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0
|
||||||
Mcu.ThirdParty1=STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2
|
Mcu.ThirdParty1=STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0
|
||||||
Mcu.ThirdPartyNb=2
|
Mcu.ThirdPartyNb=2
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32H7A3ZITx
|
Mcu.UserName=STM32H7A3ZITx
|
||||||
@ -453,7 +453,7 @@ ProjectManager.ToolChainLocation=
|
|||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,13-MX_TIM17_Init-TIM17-false-HAL-true,14-MX_DMA2D_Init-DMA2D-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,13-MX_TIM17_Init-TIM17-false-HAL-true,14-MX_DMA2D_Init-DMA2D-false-HAL-true,16-MX_TouchGFX_Init-STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2-false-HAL-false,17-MX_TouchGFX_Process-STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||||
RCC.ADCFreq_Value=2000000
|
RCC.ADCFreq_Value=2000000
|
||||||
RCC.AHB12Freq_Value=160000000
|
RCC.AHB12Freq_Value=160000000
|
||||||
RCC.AHB4Freq_Value=160000000
|
RCC.AHB4Freq_Value=160000000
|
||||||
@ -575,13 +575,19 @@ STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0.TX_APP_GENERATE_INIT_CODE=false
|
|||||||
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0.ThreadXCcRTOSJjThreadXJjCore=true
|
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0.ThreadXCcRTOSJjThreadXJjCore=true
|
||||||
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_IsAnAzureRtosMw=true
|
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_IsAnAzureRtosMw=true
|
||||||
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_SwParameter=ThreadXCcRTOSJjThreadXJjCore\:true;
|
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_SwParameter=ThreadXCcRTOSJjThreadXJjCore\:true;
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.ApplicationCcGraphicsJjApplication=TouchGFXOoGenerator
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.ApplicationCcGraphicsJjApplication=TouchGFXOoGenerator
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.GraphicsJjApplication_Checked=true
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.GraphicsJjApplication_Checked=true
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.IPParameters=ApplicationCcGraphicsJjApplication,tgfx_custom_width,tgfx_custom_height
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.IPParameters=tgfx_display_interface,tgfx_vsync,tgfx_hardware_accelerator,tgfx_custom_height,tgfx_buffering_strategy,tgfx_location,tgfx_address1,tgfx_address2,ApplicationCcGraphicsJjApplication
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_custom_height=480
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_address1=0x24040000
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_custom_width=320
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_address2=0x240A0000
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2_IsPackSelfContextualization=true
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_buffering_strategy=Double
|
||||||
STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2_SwParameter=ApplicationCcGraphicsJjApplication\:TouchGFXOoGenerator;
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_custom_height=480
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_display_interface=disp_ltdc
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_hardware_accelerator=dma_2d
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_location=By Address
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0.tgfx_vsync=vsync_ltdc
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0_IsPackSelfContextualization=true
|
||||||
|
STMicroelectronics.X-CUBE-TOUCHGFX.4.24.0_SwParameter=ApplicationCcGraphicsJjApplication\:TouchGFXOoGenerator;
|
||||||
TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM1.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
TIM1.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||||
TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||||
@ -608,8 +614,8 @@ VP_OCTOSPI1_VS_quad.Mode=quad_mode
|
|||||||
VP_OCTOSPI1_VS_quad.Signal=OCTOSPI1_VS_quad
|
VP_OCTOSPI1_VS_quad.Signal=OCTOSPI1_VS_quad
|
||||||
VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0.Mode=RTOSJjThreadX
|
VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0.Mode=RTOSJjThreadX
|
||||||
VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0.Signal=STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0
|
VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0.Signal=STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0
|
||||||
VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2.Mode=GraphicsJjApplication
|
VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.24.0.Mode=GraphicsJjApplication
|
||||||
VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2.Signal=STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2
|
VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.24.0.Signal=STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.24.0
|
||||||
VP_SYS_VS_tim6.Mode=TIM6
|
VP_SYS_VS_tim6.Mode=TIM6
|
||||||
VP_SYS_VS_tim6.Signal=SYS_VS_tim6
|
VP_SYS_VS_tim6.Signal=SYS_VS_tim6
|
||||||
VP_TIM17_VS_ClockSourceINT.Mode=Enable_Timer
|
VP_TIM17_VS_ClockSourceINT.Mode=Enable_Timer
|
||||||
|
|||||||
Reference in New Issue
Block a user