Handle buttons & encoders in View, not Model
This commit is contained in:
parent
38d3d765ad
commit
d26339e265
|
@ -64,7 +64,7 @@ static TX_BYTE_POOL tx_app_byte_pool;
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
TX_THREAD app_thread;
|
TX_THREAD app_thread;
|
||||||
TX_THREAD ui_thread;
|
TX_THREAD ui_thread;
|
||||||
TX_QUEUE ui_queue;
|
TX_QUEUE gui_button_queue;
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
@ -159,12 +159,13 @@ VOID tx_application_define(VOID *first_unused_memory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ui_queue_start = mem;
|
void *ui_queue_start = mem;
|
||||||
ULONG ui_queue_msg_size = sizeof(UIMessage) / sizeof(ULONG);
|
ULONG ui_queue_msg_size = sizeof(ButtonMessage) / sizeof(ULONG);
|
||||||
if (ui_queue_msg_size % sizeof(ULONG) != 0) {
|
if (sizeof(ButtonMessage) % sizeof(ULONG) != 0) {
|
||||||
ui_queue_msg_size++;
|
ui_queue_msg_size++;
|
||||||
}
|
}
|
||||||
mem += UI_QUEUE_SIZE * ui_queue_msg_size;
|
mem += UI_QUEUE_SIZE * ui_queue_msg_size;
|
||||||
if (tx_queue_create(&ui_queue, "UI Queue", ui_queue_msg_size, ui_queue_start,
|
if (tx_queue_create(&gui_button_queue, "UI Queue", ui_queue_msg_size,
|
||||||
|
ui_queue_start,
|
||||||
UI_QUEUE_SIZE * ui_queue_msg_size) != TX_SUCCESS) {
|
UI_QUEUE_SIZE * ui_queue_msg_size) != TX_SUCCESS) {
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef __INC_STW_BUTTON_CONTROLLER_HPP
|
||||||
|
#define __INC_STW_BUTTON_CONTROLLER_HPP
|
||||||
|
|
||||||
|
#include "platform/driver/button/ButtonController.hpp"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
constexpr uint8_t KEY_BTN1 = 1;
|
||||||
|
constexpr uint8_t KEY_BTN2 = 2;
|
||||||
|
constexpr uint8_t KEY_BTN3 = 3;
|
||||||
|
constexpr uint8_t KEY_BTN4 = 4;
|
||||||
|
constexpr uint8_t KEY_BTN5 = 5;
|
||||||
|
constexpr uint8_t KEY_BTN6 = 6;
|
||||||
|
constexpr uint8_t KEY_ENC1_CW = 21;
|
||||||
|
constexpr uint8_t KEY_ENC1_CCW = 22;
|
||||||
|
constexpr uint8_t KEY_ENC2_CW = 23;
|
||||||
|
constexpr uint8_t KEY_ENC2_CCW = 24;
|
||||||
|
|
||||||
|
class STWButtonController : public touchgfx::ButtonController {
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
virtual bool sample(uint8_t &key);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __INC_STW_BUTTON_CONTROLLER_HPP
|
|
@ -42,7 +42,7 @@ extern "C" {
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EC */
|
/* USER CODE BEGIN EC */
|
||||||
extern volatile int ltdc_cb_triggered;
|
extern volatile int ltdc_cb_triggered;
|
||||||
extern TX_QUEUE ui_queue;
|
extern TX_QUEUE gui_button_queue;
|
||||||
/* USER CODE END EC */
|
/* USER CODE END EC */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
@ -62,16 +62,12 @@ void Error_Handler(void);
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define ENC1A_Pin GPIO_PIN_3
|
#define ENC1A_Pin GPIO_PIN_3
|
||||||
#define ENC1A_GPIO_Port GPIOE
|
#define ENC1A_GPIO_Port GPIOE
|
||||||
#define ENC1A_EXTI_IRQn EXTI3_IRQn
|
|
||||||
#define ENC1B_Pin GPIO_PIN_4
|
#define ENC1B_Pin GPIO_PIN_4
|
||||||
#define ENC1B_GPIO_Port GPIOE
|
#define ENC1B_GPIO_Port GPIOE
|
||||||
#define ENC1B_EXTI_IRQn EXTI4_IRQn
|
|
||||||
#define ENC2A_Pin GPIO_PIN_5
|
#define ENC2A_Pin GPIO_PIN_5
|
||||||
#define ENC2A_GPIO_Port GPIOE
|
#define ENC2A_GPIO_Port GPIOE
|
||||||
#define ENC2A_EXTI_IRQn EXTI9_5_IRQn
|
|
||||||
#define ENC2B_Pin GPIO_PIN_6
|
#define ENC2B_Pin GPIO_PIN_6
|
||||||
#define ENC2B_GPIO_Port GPIOE
|
#define ENC2B_GPIO_Port GPIOE
|
||||||
#define ENC2B_EXTI_IRQn EXTI9_5_IRQn
|
|
||||||
#define BTN1_Pin GPIO_PIN_0
|
#define BTN1_Pin GPIO_PIN_0
|
||||||
#define BTN1_GPIO_Port GPIOF
|
#define BTN1_GPIO_Port GPIOF
|
||||||
#define BTN2_Pin GPIO_PIN_1
|
#define BTN2_Pin GPIO_PIN_1
|
||||||
|
|
|
@ -12,12 +12,12 @@ extern "C" {
|
||||||
#define BUTTON_MIN_PRESS_TIME 50 // ms
|
#define BUTTON_MIN_PRESS_TIME 50 // ms
|
||||||
#define ENC_MAX_PHASE 50 // ms
|
#define ENC_MAX_PHASE 50 // ms
|
||||||
|
|
||||||
typedef enum { UMK_BTN_RELEASED, UMK_ENC_CW, UMK_ENC_CCW } UIMessageKind;
|
typedef enum { UMK_BTN_RELEASED, UMK_ENC_CW, UMK_ENC_CCW } ButtonMessageKind;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UIMessageKind kind;
|
ButtonMessageKind kind;
|
||||||
int number;
|
int number;
|
||||||
} UIMessage;
|
} ButtonMessage;
|
||||||
|
|
||||||
void ui_thread_entry(ULONG _);
|
void ui_thread_entry(ULONG _);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include "STWButtonController.hpp"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "tx_api.h"
|
||||||
|
#include "ui.h"
|
||||||
|
|
||||||
|
void STWButtonController::init() {}
|
||||||
|
|
||||||
|
bool STWButtonController::sample(uint8_t &key) {
|
||||||
|
ButtonMessage msg;
|
||||||
|
if (tx_queue_receive(&gui_button_queue, &msg, TX_NO_WAIT) == TX_SUCCESS) {
|
||||||
|
switch (msg.kind) {
|
||||||
|
case UMK_BTN_RELEASED:
|
||||||
|
key = KEY_BTN1 + msg.number;
|
||||||
|
break;
|
||||||
|
case UMK_ENC_CW: {
|
||||||
|
if (msg.number == 0) {
|
||||||
|
key = KEY_ENC1_CW;
|
||||||
|
} else {
|
||||||
|
key = KEY_ENC2_CW;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case UMK_ENC_CCW:
|
||||||
|
if (msg.number == 0) {
|
||||||
|
key = KEY_ENC1_CCW;
|
||||||
|
} else {
|
||||||
|
key = KEY_ENC2_CCW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HAL_GPIO_TogglePin(STATUS2_GPIO_Port, STATUS2_Pin);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -25,8 +25,8 @@ void ui_thread_entry(ULONG _) {
|
||||||
uint32_t now = HAL_GetTick();
|
uint32_t now = HAL_GetTick();
|
||||||
if (state == GPIO_PIN_RESET && now - button_change_times[i]) {
|
if (state == GPIO_PIN_RESET && now - button_change_times[i]) {
|
||||||
// Button release event!
|
// Button release event!
|
||||||
UIMessage msg = {.kind = UMK_BTN_RELEASED, .number = i};
|
ButtonMessage msg = {.kind = UMK_BTN_RELEASED, .number = i};
|
||||||
tx_queue_send(&ui_queue, &msg, TX_NO_WAIT);
|
tx_queue_send(&gui_button_queue, &msg, TX_NO_WAIT);
|
||||||
}
|
}
|
||||||
button_change_times[i] = now;
|
button_change_times[i] = now;
|
||||||
button_states[i] = state;
|
button_states[i] = state;
|
||||||
|
@ -52,7 +52,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||||
|
|
||||||
uint16_t pin_a, pin_b;
|
uint16_t pin_a, pin_b;
|
||||||
int idx_a, idx_b;
|
int idx_a, idx_b;
|
||||||
UIMessage msg;
|
ButtonMessage msg;
|
||||||
if (GPIO_Pin == ENC1A_Pin || GPIO_Pin == ENC1B_Pin) {
|
if (GPIO_Pin == ENC1A_Pin || GPIO_Pin == ENC1B_Pin) {
|
||||||
pin_a = ENC1A_Pin;
|
pin_a = ENC1A_Pin;
|
||||||
pin_b = ENC1B_Pin;
|
pin_b = ENC1B_Pin;
|
||||||
|
@ -92,6 +92,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||||
// This shouldn't happen. Ignore this event.
|
// This shouldn't happen. Ignore this event.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tx_queue_send(&ui_queue, &msg, TX_NO_WAIT);
|
tx_queue_send(&gui_button_queue, &msg, TX_NO_WAIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,6 +234,7 @@ Utilities/JPEG/jpeg_utils.c
|
||||||
|
|
||||||
|
|
||||||
CPP_SOURCES = \
|
CPP_SOURCES = \
|
||||||
|
Core/Src/STWButtonController.cpp \
|
||||||
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/CacheableContainer.cpp \
|
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/CacheableContainer.cpp \
|
||||||
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/Container.cpp \
|
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/Container.cpp \
|
||||||
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/ListLayout.cpp \
|
TouchGFX/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/ListLayout.cpp \
|
||||||
|
|
|
@ -21,6 +21,19 @@ public:
|
||||||
MissionSelectViewBase();
|
MissionSelectViewBase();
|
||||||
virtual ~MissionSelectViewBase();
|
virtual ~MissionSelectViewBase();
|
||||||
virtual void setupScreen();
|
virtual void setupScreen();
|
||||||
|
virtual void handleKeyEvent(uint8_t key);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Virtual Action Handlers
|
||||||
|
*/
|
||||||
|
virtual void incMission()
|
||||||
|
{
|
||||||
|
// Override and implement this function in MissionSelect
|
||||||
|
}
|
||||||
|
virtual void decMission()
|
||||||
|
{
|
||||||
|
// Override and implement this function in MissionSelect
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FrontendApplication& application() {
|
FrontendApplication& application() {
|
||||||
|
|
|
@ -69,3 +69,24 @@ void MissionSelectViewBase::setupScreen()
|
||||||
inspection.initialize();
|
inspection.initialize();
|
||||||
manual.initialize();
|
manual.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MissionSelectViewBase::handleKeyEvent(uint8_t key)
|
||||||
|
{
|
||||||
|
if(23 == key)
|
||||||
|
{
|
||||||
|
//SelectNextMission
|
||||||
|
//When hardware button 23 clicked call virtual function
|
||||||
|
//Call incMission
|
||||||
|
incMission();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(24 == key)
|
||||||
|
{
|
||||||
|
//SelectPrevMission
|
||||||
|
//When hardware button 24 clicked call virtual function
|
||||||
|
//Call decMission
|
||||||
|
decMission();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ public:
|
||||||
|
|
||||||
virtual ~MissionSelectPresenter(){};
|
virtual ~MissionSelectPresenter(){};
|
||||||
|
|
||||||
virtual void notifyMissionChanged(Mission mission) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MissionSelectPresenter();
|
MissionSelectPresenter();
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,13 @@ public:
|
||||||
|
|
||||||
void setSelectedMission(Mission mission);
|
void setSelectedMission(Mission mission);
|
||||||
|
|
||||||
|
virtual void incMission();
|
||||||
|
virtual void decMission();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
MissionSelectElement *selected;
|
MissionSelectElement *selected;
|
||||||
|
Mission selectedMission;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MISSIONSELECTVIEW_HPP
|
#endif // MISSIONSELECTVIEW_HPP
|
||||||
|
|
|
@ -12,13 +12,8 @@ public:
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
Mission getCurrentMission() const { return mission; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ModelListener *modelListener;
|
ModelListener *modelListener;
|
||||||
|
|
||||||
private:
|
|
||||||
Mission mission;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODEL_HPP
|
#endif // MODEL_HPP
|
||||||
|
|
|
@ -13,8 +13,6 @@ public:
|
||||||
|
|
||||||
void bind(Model *m) { model = m; }
|
void bind(Model *m) { model = m; }
|
||||||
|
|
||||||
virtual void notifyMissionChanged(Mission newMission){};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Model *model;
|
Model *model;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,9 +11,9 @@ void MissionSelectElement::initialize() {
|
||||||
void MissionSelectElement::setUp(uint32_t i, TEXTS label) {
|
void MissionSelectElement::setUp(uint32_t i, TEXTS label) {
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
val = 0b10000;
|
val = 0x22;
|
||||||
} else {
|
} else {
|
||||||
val = 0b11000;
|
val = 0x11;
|
||||||
}
|
}
|
||||||
bgColor = touchgfx::Color::getColorFromRGB(val, val, val);
|
bgColor = touchgfx::Color::getColorFromRGB(val, val, val);
|
||||||
bg.setColor(bgColor);
|
bg.setColor(bgColor);
|
||||||
|
|
|
@ -7,7 +7,3 @@ MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v)
|
||||||
void MissionSelectPresenter::activate() {}
|
void MissionSelectPresenter::activate() {}
|
||||||
|
|
||||||
void MissionSelectPresenter::deactivate() {}
|
void MissionSelectPresenter::deactivate() {}
|
||||||
|
|
||||||
void MissionSelectPresenter::notifyMissionChanged(Mission mission) {
|
|
||||||
view.setSelectedMission(mission);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
#include "stw_defines.h"
|
||||||
#include "texts/TextKeysAndLanguages.hpp"
|
#include "texts/TextKeysAndLanguages.hpp"
|
||||||
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
#include <gui/missionselect_screen/MissionSelectView.hpp>
|
||||||
|
|
||||||
MissionSelectView::MissionSelectView() : selected{nullptr} {}
|
MissionSelectView::MissionSelectView()
|
||||||
|
: selected{nullptr}, selectedMission{MISSION_NONE} {}
|
||||||
|
|
||||||
void MissionSelectView::setupScreen() {
|
void MissionSelectView::setupScreen() {
|
||||||
MissionSelectViewBase::setupScreen();
|
MissionSelectViewBase::setupScreen();
|
||||||
|
@ -10,14 +12,38 @@ void MissionSelectView::setupScreen() {
|
||||||
autox.setUp(2, T_AUTOX);
|
autox.setUp(2, T_AUTOX);
|
||||||
trackdrive.setUp(3, T_TRACKDRIVE);
|
trackdrive.setUp(3, T_TRACKDRIVE);
|
||||||
ebs.setUp(4, T_EBS);
|
ebs.setUp(4, T_EBS);
|
||||||
inspection.setUp(6, T_INSPECTION);
|
inspection.setUp(5, T_INSPECTION);
|
||||||
manual.setUp(7, T_MANUAL);
|
manual.setUp(6, T_MANUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionSelectView::tearDownScreen() {
|
void MissionSelectView::tearDownScreen() {
|
||||||
MissionSelectViewBase::tearDownScreen();
|
MissionSelectViewBase::tearDownScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MissionSelectView::incMission() {
|
||||||
|
int mission_int = static_cast<int>(selectedMission);
|
||||||
|
mission_int++;
|
||||||
|
// mission_int = 0 is MISSION_NONE, which we don't want to select.
|
||||||
|
// NUM_MISSIONS is equal to the last mission, so check for strictly
|
||||||
|
// greater.
|
||||||
|
if (mission_int > NUM_MISSIONS) {
|
||||||
|
mission_int = 1;
|
||||||
|
}
|
||||||
|
setSelectedMission(static_cast<Mission>(mission_int));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MissionSelectView::decMission() {
|
||||||
|
int mission_int = static_cast<int>(selectedMission);
|
||||||
|
mission_int--;
|
||||||
|
// mission_int = 0 is MISSION_NONE, which we don't want to select.
|
||||||
|
// NUM_MISSIONS is equal to the last mission, so check for strictly
|
||||||
|
// greater.
|
||||||
|
if (mission_int <= 0) {
|
||||||
|
mission_int = NUM_MISSIONS;
|
||||||
|
}
|
||||||
|
setSelectedMission(static_cast<Mission>(mission_int));
|
||||||
|
}
|
||||||
|
|
||||||
void MissionSelectView::setSelectedMission(Mission mission) {
|
void MissionSelectView::setSelectedMission(Mission mission) {
|
||||||
if (selected != nullptr) {
|
if (selected != nullptr) {
|
||||||
selected->setSelected(false);
|
selected->setSelected(false);
|
||||||
|
@ -49,4 +75,5 @@ void MissionSelectView::setSelectedMission(Mission mission) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
selected->setSelected(true);
|
selected->setSelected(true);
|
||||||
|
selectedMission = mission;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,38 +6,6 @@
|
||||||
#include <gui/model/Model.hpp>
|
#include <gui/model/Model.hpp>
|
||||||
#include <gui/model/ModelListener.hpp>
|
#include <gui/model/ModelListener.hpp>
|
||||||
|
|
||||||
Model::Model() : modelListener(0), mission{MISSION_NONE} {}
|
Model::Model() : modelListener(0) {}
|
||||||
|
|
||||||
void Model::tick() {
|
void Model::tick() {}
|
||||||
UIMessage msg;
|
|
||||||
while (tx_queue_receive(&ui_queue, &msg, TX_NO_WAIT) == TX_SUCCESS) {
|
|
||||||
switch (msg.kind) {
|
|
||||||
case UMK_BTN_RELEASED:
|
|
||||||
// TODO: What do we do with this?
|
|
||||||
break;
|
|
||||||
case UMK_ENC_CW: {
|
|
||||||
int mission_int = static_cast<int>(mission);
|
|
||||||
mission_int++;
|
|
||||||
// mission_int = 0 is MISSION_NONE, which we don't want to select.
|
|
||||||
// NUM_MISSIONS is equal to the last mission, so check for strictly
|
|
||||||
// greater.
|
|
||||||
if (mission_int > NUM_MISSIONS) {
|
|
||||||
mission_int = 1;
|
|
||||||
}
|
|
||||||
mission = static_cast<Mission>(mission_int);
|
|
||||||
modelListener->notifyMissionChanged(mission);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UMK_ENC_CCW:
|
|
||||||
int mission_int = static_cast<int>(mission);
|
|
||||||
mission_int--;
|
|
||||||
if (mission_int <= 0) {
|
|
||||||
mission_int = NUM_MISSIONS;
|
|
||||||
}
|
|
||||||
mission = static_cast<Mission>(mission_int);
|
|
||||||
modelListener->notifyMissionChanged(mission);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
HAL_GPIO_TogglePin(STATUS2_GPIO_Port, STATUS2_Pin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -110,7 +110,30 @@
|
||||||
"RelativeFilename": "logo_dv_small_white.png"
|
"RelativeFilename": "logo_dv_small_white.png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Interactions": []
|
"Interactions": [
|
||||||
|
{
|
||||||
|
"InteractionName": "SelectNextMission",
|
||||||
|
"Trigger": {
|
||||||
|
"Type": "TriggerPhysicalButtonClicked",
|
||||||
|
"ButtonKey": 23
|
||||||
|
},
|
||||||
|
"Action": {
|
||||||
|
"Type": "ActionCustom",
|
||||||
|
"FunctionName": "incMission"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"InteractionName": "SelectPrevMission",
|
||||||
|
"Trigger": {
|
||||||
|
"Type": "TriggerPhysicalButtonClicked",
|
||||||
|
"ButtonKey": 24
|
||||||
|
},
|
||||||
|
"Action": {
|
||||||
|
"Type": "ActionCustom",
|
||||||
|
"FunctionName": "decMission"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"CustomContainerDefinitions": [
|
"CustomContainerDefinitions": [
|
||||||
|
|
|
@ -1,40 +1,42 @@
|
||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN Header */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : TouchGFXHAL.cpp
|
* File Name : TouchGFXHAL.cpp
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This file was created by TouchGFX Generator 4.21.1. This file is only
|
* This file was created by TouchGFX Generator 4.21.1. 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.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 STMicroelectronics.
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
* in the root directory of this software component.
|
* in the root directory of this software component.
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END Header */
|
||||||
|
|
||||||
#include <TouchGFXHAL.hpp>
|
#include <TouchGFXHAL.hpp>
|
||||||
|
|
||||||
/* 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() {
|
||||||
{
|
// Calling parent implementation of initialize().
|
||||||
// Calling parent implementation of initialize().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,14 +44,13 @@ void TouchGFXHAL::initialize()
|
||||||
*
|
*
|
||||||
* @return The address of the frame buffer currently being displayed on the TFT.
|
* @return The address of the frame buffer currently being displayed on the TFT.
|
||||||
*/
|
*/
|
||||||
uint16_t* TouchGFXHAL::getTFTFrameBuffer() const
|
uint16_t *TouchGFXHAL::getTFTFrameBuffer() const {
|
||||||
{
|
// Calling parent implementation of getTFTFrameBuffer().
|
||||||
// Calling parent implementation of getTFTFrameBuffer().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
return TouchGFXGeneratedHAL::getTFTFrameBuffer();
|
return TouchGFXGeneratedHAL::getTFTFrameBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,106 +58,96 @@ uint16_t* TouchGFXHAL::getTFTFrameBuffer() const
|
||||||
*
|
*
|
||||||
* @param [in] address New frame buffer address.
|
* @param [in] address New frame buffer address.
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::setTFTFrameBuffer(uint16_t* address)
|
void TouchGFXHAL::setTFTFrameBuffer(uint16_t *address) {
|
||||||
{
|
// Calling parent implementation of setTFTFrameBuffer(uint16_t* address).
|
||||||
// Calling parent implementation of setTFTFrameBuffer(uint16_t* address).
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::setTFTFrameBuffer(address);
|
TouchGFXGeneratedHAL::setTFTFrameBuffer(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called whenever the framework has performed a partial draw.
|
* This function is called whenever the framework has performed a partial draw.
|
||||||
*
|
*
|
||||||
* @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.
|
||||||
*
|
*
|
||||||
* @see flushFrameBuffer().
|
* @see flushFrameBuffer().
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect)
|
void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect &rect) {
|
||||||
{
|
// Calling parent implementation of flushFrameBuffer(const touchgfx::Rect&
|
||||||
// Calling parent implementation of flushFrameBuffer(const touchgfx::Rect& rect).
|
// rect).
|
||||||
//
|
//
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// and implemented needed functionality here.
|
// and implemented needed functionality here.
|
||||||
// Please note, HAL::flushFrameBuffer(const touchgfx::Rect& rect) must
|
// Please note, HAL::flushFrameBuffer(const touchgfx::Rect& rect) must
|
||||||
// be called to notify the touchgfx framework that flush has been performed.
|
// be called to notify the touchgfx framework that flush has been performed.
|
||||||
// To calculate he start adress of rect,
|
// To calculate he start adress of rect,
|
||||||
// use advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect)
|
// use advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect)
|
||||||
// defined in TouchGFXGeneratedHAL.cpp
|
// defined in TouchGFXGeneratedHAL.cpp
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::flushFrameBuffer(rect);
|
TouchGFXGeneratedHAL::flushFrameBuffer(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchGFXHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes)
|
bool TouchGFXHAL::blockCopy(void *RESTRICT dest, const void *RESTRICT src,
|
||||||
{
|
uint32_t numBytes) {
|
||||||
return TouchGFXGeneratedHAL::blockCopy(dest, src, numBytes);
|
return TouchGFXGeneratedHAL::blockCopy(dest, src, numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the interrupts relevant for TouchGFX. This primarily entails setting
|
* Configures the interrupts relevant for TouchGFX. This primarily entails
|
||||||
* the interrupt priorities for the DMA and LCD interrupts.
|
* setting the interrupt priorities for the DMA and LCD interrupts.
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::configureInterrupts()
|
void TouchGFXHAL::configureInterrupts() {
|
||||||
{
|
// Calling parent implementation of configureInterrupts().
|
||||||
// Calling parent implementation of configureInterrupts().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::configureInterrupts();
|
TouchGFXGeneratedHAL::configureInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for enabling interrupts set in configureInterrupts()
|
* Used for enabling interrupts set in configureInterrupts()
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::enableInterrupts()
|
void TouchGFXHAL::enableInterrupts() {
|
||||||
{
|
// Calling parent implementation of enableInterrupts().
|
||||||
// Calling parent implementation of enableInterrupts().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::enableInterrupts();
|
TouchGFXGeneratedHAL::enableInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for disabling interrupts set in configureInterrupts()
|
* Used for disabling interrupts set in configureInterrupts()
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::disableInterrupts()
|
void TouchGFXHAL::disableInterrupts() {
|
||||||
{
|
// Calling parent implementation of disableInterrupts().
|
||||||
// Calling parent implementation of disableInterrupts().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::disableInterrupts();
|
TouchGFXGeneratedHAL::disableInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the LCD controller to fire interrupts at VSYNC. Called automatically
|
* Configure the LCD controller to fire interrupts at VSYNC. Called
|
||||||
* once TouchGFX initialization has completed.
|
* automatically once TouchGFX initialization has completed.
|
||||||
*/
|
*/
|
||||||
void TouchGFXHAL::enableLCDControllerInterrupt()
|
void TouchGFXHAL::enableLCDControllerInterrupt() {
|
||||||
{
|
// Calling parent implementation of enableLCDControllerInterrupt().
|
||||||
// Calling parent implementation of enableLCDControllerInterrupt().
|
//
|
||||||
//
|
// To overwrite the generated implementation, omit call to parent function
|
||||||
// To overwrite the generated implementation, omit call to parent function
|
// and implemented needed functionality here.
|
||||||
// and implemented needed functionality here.
|
|
||||||
|
|
||||||
TouchGFXGeneratedHAL::enableLCDControllerInterrupt();
|
TouchGFXGeneratedHAL::enableLCDControllerInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TouchGFXHAL::beginFrame()
|
bool TouchGFXHAL::beginFrame() { return TouchGFXGeneratedHAL::beginFrame(); }
|
||||||
{
|
|
||||||
return TouchGFXGeneratedHAL::beginFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TouchGFXHAL::endFrame()
|
void TouchGFXHAL::endFrame() { TouchGFXGeneratedHAL::endFrame(); }
|
||||||
{
|
|
||||||
TouchGFXGeneratedHAL::endFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE END TouchGFXHAL.cpp */
|
/* USER CODE END TouchGFXHAL.cpp */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue