[wip] working on display layout
This commit is contained in:
1
firmware/.vscode/launch.json
vendored
1
firmware/.vscode/launch.json
vendored
@@ -16,6 +16,7 @@
|
||||
"interface": "swd",
|
||||
"runToMain": true,
|
||||
"svdFile": "STM32F303xE.svd",
|
||||
"preLaunchTask": "${defaultBuildTask}",
|
||||
"rttConfig": {
|
||||
"enabled": true,
|
||||
"address": "auto",
|
||||
|
||||
4
firmware/.vscode/settings.json
vendored
4
firmware/.vscode/settings.json
vendored
@@ -11,6 +11,8 @@
|
||||
"ctrl_button.h": "c",
|
||||
"ctrl_bottom_button.h": "c",
|
||||
"printf.h": "c",
|
||||
"disp_layout_template.h": "c"
|
||||
"disp_layout_template.h": "c",
|
||||
"disp_layout_types.h": "c",
|
||||
"ctrl_app_types.h": "c"
|
||||
}
|
||||
}
|
||||
@@ -65,10 +65,30 @@ void Error_Handler(void);
|
||||
#define USART_RX_GPIO_Port GPIOA
|
||||
#define LD2_Pin GPIO_PIN_5
|
||||
#define LD2_GPIO_Port GPIOA
|
||||
#define BTN1_Pin GPIO_PIN_1
|
||||
#define BTN1_GPIO_Port GPIOB
|
||||
#define BTN2_Pin GPIO_PIN_2
|
||||
#define BTN2_GPIO_Port GPIOB
|
||||
#define BTN3_Pin GPIO_PIN_11
|
||||
#define BTN3_GPIO_Port GPIOB
|
||||
#define BTN4_Pin GPIO_PIN_12
|
||||
#define BTN4_GPIO_Port GPIOB
|
||||
#define BTN5_Pin GPIO_PIN_11
|
||||
#define BTN5_GPIO_Port GPIOA
|
||||
#define TMS_Pin GPIO_PIN_13
|
||||
#define TMS_GPIO_Port GPIOA
|
||||
#define TCK_Pin GPIO_PIN_14
|
||||
#define TCK_GPIO_Port GPIOA
|
||||
#define ST7565_CS_Pin GPIO_PIN_15
|
||||
#define ST7565_CS_GPIO_Port GPIOA
|
||||
#define ST7565_SCK_Pin GPIO_PIN_10
|
||||
#define ST7565_SCK_GPIO_Port GPIOC
|
||||
#define ST7565_RST_Pin GPIO_PIN_11
|
||||
#define ST7565_RST_GPIO_Port GPIOC
|
||||
#define ST7565_MOSI_Pin GPIO_PIN_12
|
||||
#define ST7565_MOSI_GPIO_Port GPIOC
|
||||
#define ST7565_A0_Pin GPIO_PIN_2
|
||||
#define ST7565_A0_GPIO_Port GPIOD
|
||||
#define SWO_Pin GPIO_PIN_3
|
||||
#define SWO_GPIO_Port GPIOB
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
@@ -34,11 +34,14 @@ extern "C" {
|
||||
|
||||
extern SPI_HandleTypeDef hspi2;
|
||||
|
||||
extern SPI_HandleTypeDef hspi3;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_SPI2_Init(void);
|
||||
void MX_SPI3_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
|
||||
@@ -49,9 +49,16 @@ void MX_GPIO_Init(void)
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, LD2_Pin|ST7565_CS_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(ST7565_RST_GPIO_Port, ST7565_RST_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(ST7565_A0_GPIO_Port, ST7565_A0_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = B1_Pin;
|
||||
@@ -59,12 +66,38 @@ void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = LD2_Pin;
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = LD2_Pin|ST7565_CS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = BTN1_Pin|BTN2_Pin|BTN3_Pin|BTN4_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = BTN5_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(BTN5_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = ST7565_RST_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(ST7565_RST_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = ST7565_A0_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(ST7565_A0_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "ctrl_app.h"
|
||||
#include "display_gfx.h"
|
||||
#include "disp_layout.h"
|
||||
#include "st7565.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -45,7 +48,9 @@
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
st7565_handle_t hst7565;
|
||||
GFX_display_t disp;
|
||||
APP_data_t app_data;
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@@ -90,14 +95,36 @@ int main(void)
|
||||
MX_USART2_UART_Init();
|
||||
MX_SPI2_Init();
|
||||
MX_I2C1_Init();
|
||||
MX_SPI3_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
APP_init(&app_data);
|
||||
|
||||
hst7565.hspi = &hspi3;
|
||||
hst7565.cs_port = ST7565_CS_GPIO_Port;
|
||||
hst7565.cs_pin = ST7565_CS_Pin;
|
||||
hst7565.a0_port = ST7565_A0_GPIO_Port;
|
||||
hst7565.a0_pin = ST7565_A0_Pin;
|
||||
hst7565.rst_port = ST7565_RST_GPIO_Port;
|
||||
hst7565.rst_pin = ST7565_RST_Pin;
|
||||
ST7565_Init(&hst7565, &disp);
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
DISP_clearScreen(&disp);
|
||||
ST7565_DisplayAll(&hst7565);
|
||||
|
||||
uint32_t last_tick = HAL_GetTick();
|
||||
while (1)
|
||||
{
|
||||
CTRL_buttonsHandler();
|
||||
if (HAL_GetTick() - last_tick > 100)
|
||||
{
|
||||
last_tick = HAL_GetTick();
|
||||
ST7565_DisplayAll(&hst7565);
|
||||
LAY_drawDisplayLayout(&disp, &app_data);
|
||||
}
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
@@ -132,8 +159,7 @@ void SystemClock_Config(void)
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||
@@ -143,7 +169,7 @@ void SystemClock_Config(void)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_I2C1;
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2 | RCC_PERIPHCLK_I2C1;
|
||||
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
|
||||
PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_HSI;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
/* USER CODE END 0 */
|
||||
|
||||
SPI_HandleTypeDef hspi2;
|
||||
SPI_HandleTypeDef hspi3;
|
||||
|
||||
/* SPI2 init function */
|
||||
void MX_SPI2_Init(void)
|
||||
@@ -59,6 +60,40 @@ void MX_SPI2_Init(void)
|
||||
|
||||
/* USER CODE END SPI2_Init 2 */
|
||||
|
||||
}
|
||||
/* SPI3 init function */
|
||||
void MX_SPI3_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN SPI3_Init 0 */
|
||||
|
||||
/* USER CODE END SPI3_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN SPI3_Init 1 */
|
||||
|
||||
/* USER CODE END SPI3_Init 1 */
|
||||
hspi3.Instance = SPI3;
|
||||
hspi3.Init.Mode = SPI_MODE_MASTER;
|
||||
hspi3.Init.Direction = SPI_DIRECTION_1LINE;
|
||||
hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||
hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||
hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
hspi3.Init.NSS = SPI_NSS_SOFT;
|
||||
hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
|
||||
hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||
hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||
hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||
hspi3.Init.CRCPolynomial = 7;
|
||||
hspi3.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
|
||||
hspi3.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
|
||||
if (HAL_SPI_Init(&hspi3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN SPI3_Init 2 */
|
||||
|
||||
/* USER CODE END SPI3_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
||||
@@ -90,6 +125,30 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
||||
|
||||
/* USER CODE END SPI2_MspInit 1 */
|
||||
}
|
||||
else if(spiHandle->Instance==SPI3)
|
||||
{
|
||||
/* USER CODE BEGIN SPI3_MspInit 0 */
|
||||
|
||||
/* USER CODE END SPI3_MspInit 0 */
|
||||
/* SPI3 clock enable */
|
||||
__HAL_RCC_SPI3_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
/**SPI3 GPIO Configuration
|
||||
PC10 ------> SPI3_SCK
|
||||
PC12 ------> SPI3_MOSI
|
||||
*/
|
||||
GPIO_InitStruct.Pin = ST7565_SCK_Pin|ST7565_MOSI_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SPI3_MspInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
|
||||
@@ -114,6 +173,24 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
|
||||
|
||||
/* USER CODE END SPI2_MspDeInit 1 */
|
||||
}
|
||||
else if(spiHandle->Instance==SPI3)
|
||||
{
|
||||
/* USER CODE BEGIN SPI3_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SPI3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SPI3_CLK_DISABLE();
|
||||
|
||||
/**SPI3 GPIO Configuration
|
||||
PC10 ------> SPI3_SCK
|
||||
PC12 ------> SPI3_MOSI
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, ST7565_SCK_Pin|ST7565_MOSI_Pin);
|
||||
|
||||
/* USER CODE BEGIN SPI3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Sat Mar 25 21:51:05 CET 2023]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Sat Apr 01 12:37:38 CEST 2023]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
@@ -85,7 +85,6 @@ C_SOURCES += ../shared_libs/bitmaps/bitmap_disp_buttons.c
|
||||
C_SOURCES += ../shared_libs/bitmaps/bitmap_font_5x7.c
|
||||
# display_layout
|
||||
C_SOURCES += ../shared_libs/disp_layout/disp_layout.c
|
||||
C_SOURCES += ../shared_libs/disp_layout/disp_layout_defs.c
|
||||
# controllers
|
||||
C_SOURCES += ../shared_libs/controllers/ctrl_bottom_button.c
|
||||
C_SOURCES += ../shared_libs/controllers/ctrl_channel_button.c
|
||||
@@ -181,8 +180,6 @@ C_INCLUDES += -I../shared_libs/controllers
|
||||
C_INCLUDES += -I../shared_libs/utils/printf
|
||||
C_INCLUDES += -I../shared_libs/utils/rtt
|
||||
|
||||
# config
|
||||
C_INCLUDES += -I../shared_libs
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
@@ -11,29 +11,40 @@ Mcu.IP0=I2C1
|
||||
Mcu.IP1=NVIC
|
||||
Mcu.IP2=RCC
|
||||
Mcu.IP3=SPI2
|
||||
Mcu.IP4=SYS
|
||||
Mcu.IP5=USART2
|
||||
Mcu.IPNb=6
|
||||
Mcu.IP4=SPI3
|
||||
Mcu.IP5=SYS
|
||||
Mcu.IP6=USART2
|
||||
Mcu.IPNb=7
|
||||
Mcu.Name=STM32F303R(D-E)Tx
|
||||
Mcu.Package=LQFP64
|
||||
Mcu.Pin0=PC13
|
||||
Mcu.Pin1=PC14-OSC32_IN
|
||||
Mcu.Pin10=PB15
|
||||
Mcu.Pin11=PA13
|
||||
Mcu.Pin12=PA14
|
||||
Mcu.Pin13=PB3
|
||||
Mcu.Pin14=PB6
|
||||
Mcu.Pin15=PB7
|
||||
Mcu.Pin16=VP_SYS_VS_Systick
|
||||
Mcu.Pin10=PB11
|
||||
Mcu.Pin11=PB12
|
||||
Mcu.Pin12=PB13
|
||||
Mcu.Pin13=PB14
|
||||
Mcu.Pin14=PB15
|
||||
Mcu.Pin15=PA11
|
||||
Mcu.Pin16=PA13
|
||||
Mcu.Pin17=PA14
|
||||
Mcu.Pin18=PA15
|
||||
Mcu.Pin19=PC10
|
||||
Mcu.Pin2=PC15-OSC32_OUT
|
||||
Mcu.Pin20=PC11
|
||||
Mcu.Pin21=PC12
|
||||
Mcu.Pin22=PD2
|
||||
Mcu.Pin23=PB3
|
||||
Mcu.Pin24=PB6
|
||||
Mcu.Pin25=PB7
|
||||
Mcu.Pin26=VP_SYS_VS_Systick
|
||||
Mcu.Pin3=PF0-OSC_IN
|
||||
Mcu.Pin4=PF1-OSC_OUT
|
||||
Mcu.Pin5=PA2
|
||||
Mcu.Pin6=PA3
|
||||
Mcu.Pin7=PA5
|
||||
Mcu.Pin8=PB13
|
||||
Mcu.Pin9=PB14
|
||||
Mcu.PinsNb=17
|
||||
Mcu.Pin8=PB1
|
||||
Mcu.Pin9=PB2
|
||||
Mcu.PinsNb=27
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F303RETx
|
||||
@@ -50,6 +61,10 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true\:true\:false
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||
PA11.GPIOParameters=GPIO_Label
|
||||
PA11.GPIO_Label=BTN5
|
||||
PA11.Locked=true
|
||||
PA11.Signal=GPIO_Input
|
||||
PA13.GPIOParameters=GPIO_Label
|
||||
PA13.GPIO_Label=TMS
|
||||
PA13.Locked=true
|
||||
@@ -60,6 +75,10 @@ PA14.GPIO_Label=TCK
|
||||
PA14.Locked=true
|
||||
PA14.Mode=Serial_Wire
|
||||
PA14.Signal=SYS_JTCK-SWCLK
|
||||
PA15.GPIOParameters=GPIO_Label
|
||||
PA15.GPIO_Label=ST7565_CS
|
||||
PA15.Locked=true
|
||||
PA15.Signal=GPIO_Output
|
||||
PA2.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PA2.GPIO_Label=USART_TX
|
||||
PA2.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
@@ -83,12 +102,28 @@ PA5.GPIO_PuPd=GPIO_NOPULL
|
||||
PA5.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
||||
PA5.Locked=true
|
||||
PA5.Signal=GPIO_Output
|
||||
PB1.GPIOParameters=GPIO_Label
|
||||
PB1.GPIO_Label=BTN1
|
||||
PB1.Locked=true
|
||||
PB1.Signal=GPIO_Input
|
||||
PB11.GPIOParameters=GPIO_Label
|
||||
PB11.GPIO_Label=BTN3
|
||||
PB11.Locked=true
|
||||
PB11.Signal=GPIO_Input
|
||||
PB12.GPIOParameters=GPIO_Label
|
||||
PB12.GPIO_Label=BTN4
|
||||
PB12.Locked=true
|
||||
PB12.Signal=GPIO_Input
|
||||
PB13.Mode=Full_Duplex_Master
|
||||
PB13.Signal=SPI2_SCK
|
||||
PB14.Mode=Full_Duplex_Master
|
||||
PB14.Signal=SPI2_MISO
|
||||
PB15.Mode=Full_Duplex_Master
|
||||
PB15.Signal=SPI2_MOSI
|
||||
PB2.GPIOParameters=GPIO_Label
|
||||
PB2.GPIO_Label=BTN2
|
||||
PB2.Locked=true
|
||||
PB2.Signal=GPIO_Input
|
||||
PB3.GPIOParameters=GPIO_Label
|
||||
PB3.GPIO_Label=SWO
|
||||
PB3.Locked=true
|
||||
@@ -98,6 +133,19 @@ PB6.Mode=I2C
|
||||
PB6.Signal=I2C1_SCL
|
||||
PB7.Mode=I2C
|
||||
PB7.Signal=I2C1_SDA
|
||||
PC10.GPIOParameters=GPIO_Label
|
||||
PC10.GPIO_Label=ST7565_SCK
|
||||
PC10.Locked=true
|
||||
PC10.Mode=Simplex_Bidirectional_Master
|
||||
PC10.Signal=SPI3_SCK
|
||||
PC11.GPIOParameters=GPIO_Label
|
||||
PC11.GPIO_Label=ST7565_RST
|
||||
PC11.Locked=true
|
||||
PC11.Signal=GPIO_Output
|
||||
PC12.GPIOParameters=GPIO_Label
|
||||
PC12.GPIO_Label=ST7565_MOSI
|
||||
PC12.Mode=Simplex_Bidirectional_Master
|
||||
PC12.Signal=SPI3_MOSI
|
||||
PC13.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PC13.GPIO_Label=B1 [Blue PushButton]
|
||||
PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
@@ -109,6 +157,10 @@ PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||
PC15-OSC32_OUT.Locked=true
|
||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||
PD2.GPIOParameters=GPIO_Label
|
||||
PD2.GPIO_Label=ST7565_A0
|
||||
PD2.Locked=true
|
||||
PD2.Signal=GPIO_Output
|
||||
PF0-OSC_IN.Locked=true
|
||||
PF0-OSC_IN.Mode=HSE-External-Clock-Source
|
||||
PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||
@@ -142,7 +194,7 @@ ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_SPI2_Init-SPI2-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_SPI2_Init-SPI2-false-HAL-true,5-MX_I2C1_Init-I2C1-false-HAL-true,6-MX_SPI3_Init-SPI3-false-HAL-true
|
||||
RCC.ADC12outputFreq_Value=72000000
|
||||
RCC.ADC34outputFreq_Value=72000000
|
||||
RCC.AHBFreq_Value=72000000
|
||||
@@ -201,6 +253,13 @@ SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,NSSPMode
|
||||
SPI2.Mode=SPI_MODE_MASTER
|
||||
SPI2.NSSPMode=SPI_NSS_PULSE_ENABLE
|
||||
SPI2.VirtualType=VM_MASTER
|
||||
SPI3.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_64
|
||||
SPI3.CalculateBaudRate=562.5 KBits/s
|
||||
SPI3.DataSize=SPI_DATASIZE_8BIT
|
||||
SPI3.Direction=SPI_DIRECTION_1LINE
|
||||
SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler,DataSize
|
||||
SPI3.Mode=SPI_MODE_MASTER
|
||||
SPI3.VirtualType=VM_MASTER
|
||||
USART2.IPParameters=VirtualMode-Asynchronous
|
||||
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
|
||||
@@ -198,10 +198,17 @@ const uint8_t btn_x10_inverse[] = {
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFF,0xFF,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,
|
||||
0xFB,0xF9,
|
||||
};
|
||||
const uint8_t btn_empty[] = {
|
||||
// res: 25x11 - 50 bytes
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
GFX_bitmap_t bitmap_btnBottom[DISP_BTN_MAX] = {
|
||||
const GFX_bitmap_t bitmap_btnBottom[BITMAP_BTN_MAX] = {
|
||||
{25, 11, btn_fre},
|
||||
{25, 11, btn_fre_inverse},
|
||||
{25, 11, btn_amp},
|
||||
@@ -226,6 +233,7 @@ GFX_bitmap_t bitmap_btnBottom[DISP_BTN_MAX] = {
|
||||
{25, 11, btn_x1_inverse},
|
||||
{25, 11, btn_x10},
|
||||
{25, 11, btn_x10_inverse},
|
||||
{25, 11, btn_empty},
|
||||
|
||||
{0, 0, NULL},
|
||||
};
|
||||
|
||||
@@ -4,32 +4,33 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DISP_BTN_FREQ,
|
||||
DISP_BTN_FREQ_INVERSE,
|
||||
DISP_BTN_AMPL,
|
||||
DISP_BTN_AMPL_INVERSE,
|
||||
DISP_BTN_OFFS,
|
||||
DISP_BTN_OFFS_INVERSE,
|
||||
DISP_BTN_PHAS,
|
||||
DISP_BTN_PHAS_INVERSE,
|
||||
DISP_BTN_WAVE,
|
||||
DISP_BTN_WAVE_INVERSE,
|
||||
DISP_BTN_BACK,
|
||||
DISP_BTN_BACK_INVERSE,
|
||||
DISP_BTN_LEFT,
|
||||
DISP_BTN_LEFT_INVERSE,
|
||||
DISP_BTN_RIGHT,
|
||||
DISP_BTN_RIGHT_INVERSE,
|
||||
DISP_BTN_X0_01,
|
||||
DISP_BTN_X0_01_INVERSE,
|
||||
DISP_BTN_X0_1,
|
||||
DISP_BTN_X0_1_INVERSE,
|
||||
DISP_BTN_X1,
|
||||
DISP_BTN_X1_INVERSE,
|
||||
DISP_BTN_X10,
|
||||
DISP_BTN_X10_INVERSE,
|
||||
DISP_BTN_NONE,
|
||||
DISP_BTN_MAX,
|
||||
BITMAP_BTN_FREQ,
|
||||
BITMAP_BTN_FREQ_INVERSE,
|
||||
BITMAP_BTN_AMPL,
|
||||
BITMAP_BTN_AMPL_INVERSE,
|
||||
BITMAP_BTN_OFFS,
|
||||
BITMAP_BTN_OFFS_INVERSE,
|
||||
BITMAP_BTN_PHAS,
|
||||
BITMAP_BTN_PHAS_INVERSE,
|
||||
BITMAP_BTN_WAVE,
|
||||
BITMAP_BTN_WAVE_INVERSE,
|
||||
BITMAP_BTN_BACK,
|
||||
BITMAP_BTN_BACK_INVERSE,
|
||||
BITMAP_BTN_LEFT,
|
||||
BITMAP_BTN_LEFT_INVERSE,
|
||||
BITMAP_BTN_RIGHT,
|
||||
BITMAP_BTN_RIGHT_INVERSE,
|
||||
BITMAP_BTN_X0_01,
|
||||
BITMAP_BTN_X0_01_INVERSE,
|
||||
BITMAP_BTN_X0_1,
|
||||
BITMAP_BTN_X0_1_INVERSE,
|
||||
BITMAP_BTN_X1,
|
||||
BITMAP_BTN_X1_INVERSE,
|
||||
BITMAP_BTN_X10,
|
||||
BITMAP_BTN_X10_INVERSE,
|
||||
BITMAP_BTN_EMPTY,
|
||||
BITMAP_BTN_NONE,
|
||||
BITMAP_BTN_MAX,
|
||||
} BITMAP_buttonName_t;
|
||||
|
||||
extern GFX_bitmap_t bitmap_btnBottom[DISP_BTN_MAX];
|
||||
extern const GFX_bitmap_t bitmap_btnBottom[BITMAP_BTN_MAX];
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define BTN1_GPIO_Port GPIOA
|
||||
#define BTN2_GPIO_Port GPIOA
|
||||
#define BTN3_GPIO_Port GPIOA
|
||||
#define BTN4_GPIO_Port GPIOA
|
||||
#define BTN5_GPIO_Port GPIOA
|
||||
|
||||
#define BTN1_Pin 0
|
||||
#define BTN2_Pin 0
|
||||
#define BTN3_Pin 0
|
||||
#define BTN4_Pin 0
|
||||
#define BTN5_Pin 0
|
||||
@@ -1,11 +1,31 @@
|
||||
#include "main.h"
|
||||
#include "hw_button.h"
|
||||
#include "ctrl_bottom_button.h"
|
||||
#include "ctrl_channel_button.h"
|
||||
|
||||
#include "ctrl_app.h"
|
||||
|
||||
#define FUN_GEN_FOCUS_MAX 6U
|
||||
#define PWM_GEN_FOCUS_MAX 4U
|
||||
|
||||
typedef void (*btn_action_t)(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
btn_action_t command;
|
||||
BITMAP_buttonName_t bitmap_name;
|
||||
} CMD_button_t;
|
||||
|
||||
static GEN_fg_t func_gen[3];
|
||||
static GEN_pwm_t pwm_gen[3];
|
||||
|
||||
const static GENERATOR_t generators[CHANNEL_MAX] = {
|
||||
static const CMD_button_t btn_command[BTN_STATE_MAX][DISP_BTN_MAX];
|
||||
static const LAY_dispBtn_t btn_hw_to_disp[BTN_BOT_MAX] = {DISP_BTN_1, DISP_BTN_2, DISP_BTN_3, DISP_BTN_4, DISP_BTN_5};
|
||||
|
||||
static HW_BotBtnName_t last_key;
|
||||
static APP_data_t *_app_data;
|
||||
|
||||
static const GENERATOR_t generators[CHANNEL_MAX] = {
|
||||
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[0]},
|
||||
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[1]},
|
||||
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[2]},
|
||||
@@ -16,4 +36,362 @@ const static GENERATOR_t generators[CHANNEL_MAX] = {
|
||||
|
||||
void APP_init(APP_data_t *app_data)
|
||||
{
|
||||
_app_data = app_data;
|
||||
_app_data->freq_focus_digit = 0;
|
||||
_app_data->ampl_focus_digit = 0;
|
||||
_app_data->offs_focus_digit = 0;
|
||||
_app_data->phas_focus_digit = 0;
|
||||
_app_data->duty_focus_digit = 0;
|
||||
|
||||
_app_data->curr_gen_type = GEN_FG_TYPE;
|
||||
_app_data->generator = generators[CHANNEL1].gen;
|
||||
|
||||
_app_data->curr_state_lay = LAY_MAIN;
|
||||
_app_data->curr_state_btn = BTN_MAIN_FG;
|
||||
|
||||
_app_data->isChannelChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isButtonBlink = 1;
|
||||
|
||||
CTRL_buttonsInit();
|
||||
}
|
||||
|
||||
void CTRL_buttonsInit(void)
|
||||
{
|
||||
|
||||
CTRL_bottomButtonInit();
|
||||
// CTRL_channelButtonInit();
|
||||
}
|
||||
|
||||
void CTRL_buttonsHandler(void)
|
||||
{
|
||||
CTRL_bottomButtonsHandler();
|
||||
CTRL_channelButtonsHandler();
|
||||
}
|
||||
|
||||
void CTRL_pushedDispBtnEvent(ButtonKey_t *key)
|
||||
{
|
||||
last_key = btn_hw_to_disp[key->instance];
|
||||
btn_command[_app_data->curr_state_btn][last_key].command();
|
||||
}
|
||||
|
||||
void CTRL_pushedChanBtnEvent(ButtonKey_t *key)
|
||||
{
|
||||
UNUSED(key);
|
||||
}
|
||||
|
||||
inline BITMAP_buttonName_t CTRL_getBitmapName(LAY_dispBtn_t disp_btn)
|
||||
{
|
||||
return btn_command[_app_data->curr_state_btn][disp_btn].bitmap_name;
|
||||
}
|
||||
|
||||
static void _doNoting(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static void _backToMain(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_MAIN;
|
||||
|
||||
switch (_app_data->curr_gen_type)
|
||||
{
|
||||
case GEN_FG_TYPE:
|
||||
_app_data->curr_state_btn = BTN_MAIN_FG;
|
||||
break;
|
||||
|
||||
case GEN_PWM_TYPE:
|
||||
_app_data->curr_state_btn = BTN_MAIN_PWM;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _blockFocusAtMaxAndMin(void)
|
||||
{
|
||||
switch (_app_data->curr_state_btn)
|
||||
{
|
||||
case BTN_FREQ_MIN:
|
||||
if (_app_data->freq_focus_digit > 0)
|
||||
{
|
||||
_app_data->curr_state_btn = BTN_FREQ;
|
||||
_app_data->isButtonChange = 1;
|
||||
}
|
||||
break;
|
||||
case BTN_FREQ_MAX:
|
||||
if (_app_data->freq_focus_digit < FUN_GEN_FOCUS_MAX)
|
||||
{
|
||||
_app_data->curr_state_btn = BTN_FREQ;
|
||||
_app_data->isButtonChange = 1;
|
||||
}
|
||||
break;
|
||||
case BTN_FREQ:
|
||||
if (_app_data->freq_focus_digit == 0)
|
||||
{
|
||||
_app_data->curr_state_btn = BTN_FREQ_MIN;
|
||||
_app_data->isButtonChange = 1;
|
||||
}
|
||||
else if (_app_data->freq_focus_digit == FUN_GEN_FOCUS_MAX)
|
||||
{
|
||||
_app_data->curr_state_btn = BTN_FREQ_MAX;
|
||||
_app_data->isButtonChange = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _enterToFreqLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_FREQ;
|
||||
_app_data->curr_state_btn = BTN_FREQ;
|
||||
_blockFocusAtMaxAndMin();
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _enterToAmplLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_AMPL;
|
||||
_app_data->curr_state_btn = BTN_AMPL;
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _enterToOffslLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_OFFS;
|
||||
_app_data->curr_state_btn = BTN_OFFS;
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _enterToPhasLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_PHAS;
|
||||
_app_data->curr_state_btn = BTN_PHAS;
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _enterToDutyLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_DUTY;
|
||||
_app_data->curr_state_btn = BTN_DUTY;
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _enterToWavelLayout(void)
|
||||
{
|
||||
_app_data->curr_state_lay = LAY_WAVE;
|
||||
_app_data->curr_state_btn = BTN_WAVE;
|
||||
|
||||
_app_data->isButtonChange = 1;
|
||||
_app_data->isGraphChange = 1;
|
||||
_app_data->isValueChange = 1;
|
||||
}
|
||||
|
||||
static void _moveToLeftFocusFreqNumber(void)
|
||||
{
|
||||
_app_data->freq_focus_digit += 1;
|
||||
_app_data->isValueChange = 1;
|
||||
|
||||
_blockFocusAtMaxAndMin();
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
|
||||
static void _moveToRighttFocusFreqNumber(void)
|
||||
{
|
||||
_app_data->freq_focus_digit -= 1;
|
||||
_app_data->isValueChange = 1;
|
||||
|
||||
_blockFocusAtMaxAndMin();
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
|
||||
static void _setTo0_01xFocusNumber(void)
|
||||
{
|
||||
switch (_app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_AMPL:
|
||||
_app_data->ampl_focus_digit = 1;
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_app_data->offs_focus_digit = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
static void _setTo0_1xFocusNumber(void)
|
||||
{
|
||||
switch (_app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_AMPL:
|
||||
_app_data->ampl_focus_digit = 10;
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_app_data->offs_focus_digit = 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
static void _setTo1xFocusNumber(void)
|
||||
{
|
||||
switch (_app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_AMPL:
|
||||
_app_data->ampl_focus_digit = 10;
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_app_data->offs_focus_digit = 10;
|
||||
break;
|
||||
case LAY_PHAS:
|
||||
_app_data->offs_focus_digit = 1;
|
||||
break;
|
||||
case LAY_DUTY:
|
||||
_app_data->offs_focus_digit = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
static void _setTo10xFocusNumber(void)
|
||||
{
|
||||
switch (_app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_AMPL:
|
||||
_app_data->ampl_focus_digit = 100;
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_app_data->offs_focus_digit = 100;
|
||||
break;
|
||||
case LAY_PHAS:
|
||||
_app_data->offs_focus_digit = 10;
|
||||
break;
|
||||
case LAY_DUTY:
|
||||
_app_data->offs_focus_digit = 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_app_data->timer_blink[last_key] = 2;
|
||||
_app_data->isButtonBlink |= (1 << last_key);
|
||||
}
|
||||
|
||||
static const CMD_button_t btn_command[BTN_STATE_MAX][DISP_BTN_MAX] = {
|
||||
{
|
||||
// BTN_MAIN_FG
|
||||
{_enterToFreqLayout, BITMAP_BTN_FREQ},
|
||||
{_enterToAmplLayout, BITMAP_BTN_AMPL},
|
||||
{_enterToOffslLayout, BITMAP_BTN_OFFS},
|
||||
{_enterToPhasLayout, BITMAP_BTN_PHAS},
|
||||
{_enterToWavelLayout, BITMAP_BTN_WAVE},
|
||||
},
|
||||
{
|
||||
// BTN_MAIN_PWM
|
||||
{_enterToFreqLayout, BITMAP_BTN_FREQ},
|
||||
{_enterToAmplLayout, BITMAP_BTN_AMPL},
|
||||
{_enterToOffslLayout, BITMAP_BTN_OFFS},
|
||||
{_enterToPhasLayout, BITMAP_BTN_PHAS},
|
||||
{_enterToDutyLayout, BITMAP_BTN_NONE},
|
||||
},
|
||||
{
|
||||
// BTN_FREQ
|
||||
{_moveToLeftFocusFreqNumber, BITMAP_BTN_LEFT},
|
||||
{_moveToRighttFocusFreqNumber, BITMAP_BTN_RIGHT},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_FREQ_MIN
|
||||
{_moveToLeftFocusFreqNumber, BITMAP_BTN_LEFT},
|
||||
{_doNoting, BITMAP_BTN_EMPTY},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_FREQ_MAX
|
||||
{_doNoting, BITMAP_BTN_EMPTY},
|
||||
{_moveToRighttFocusFreqNumber, BITMAP_BTN_RIGHT},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_AMPL
|
||||
{_setTo1xFocusNumber, BITMAP_BTN_X1},
|
||||
{_setTo0_1xFocusNumber, BITMAP_BTN_X0_1},
|
||||
{_setTo0_01xFocusNumber, BITMAP_BTN_X0_01},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_OFFS
|
||||
{_setTo1xFocusNumber, BITMAP_BTN_X1},
|
||||
{_setTo0_1xFocusNumber, BITMAP_BTN_X0_1},
|
||||
{_setTo0_01xFocusNumber, BITMAP_BTN_X0_01},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_PHAS
|
||||
{_setTo10xFocusNumber, BITMAP_BTN_X10},
|
||||
{_setTo1xFocusNumber, BITMAP_BTN_X1},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_DUTY
|
||||
{_setTo10xFocusNumber, BITMAP_BTN_X10},
|
||||
{_setTo1xFocusNumber, BITMAP_BTN_X1},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
{
|
||||
// BTN_WAVE
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_doNoting, BITMAP_BTN_NONE},
|
||||
{_backToMain, BITMAP_BTN_BACK},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "disp_layout_types.h"
|
||||
#include "hw_button.h"
|
||||
#include "bitmap_disp_buttons.h"
|
||||
#include "ctrl_app_types.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -23,30 +24,12 @@ typedef struct
|
||||
uint8_t connected;
|
||||
} GEN_fg_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEN_FG_TYPE,
|
||||
GEN_PWM_TYPE,
|
||||
GEN_TYPE_MAX
|
||||
} GEN_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GEN_type_t gen_type;
|
||||
void *gen;
|
||||
void *const gen;
|
||||
} GENERATOR_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHANNEL1,
|
||||
CHANNEL2,
|
||||
CHANNEL3,
|
||||
CHANNEL4,
|
||||
CHANNEL5,
|
||||
CHANNEL6,
|
||||
CHANNEL_MAX
|
||||
} GEN_channel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t freq_focus_digit;
|
||||
@@ -55,16 +38,25 @@ typedef struct
|
||||
uint8_t phas_focus_digit;
|
||||
uint8_t duty_focus_digit;
|
||||
|
||||
GEN_type_t gen_type;
|
||||
GEN_type_t curr_gen_type;
|
||||
void *generator;
|
||||
|
||||
GEN_channel_t curr_channel;
|
||||
LAY_state_t curr_layout;
|
||||
STATE_layout_t curr_state_lay;
|
||||
STATE_button_t curr_state_btn;
|
||||
|
||||
uint8_t isChannelChange;
|
||||
uint8_t isGraphChange;
|
||||
uint8_t isValueChange;
|
||||
uint8_t isButtonChange;
|
||||
uint8_t isButtonBlink;
|
||||
uint8_t timer_blink[LAY_BTN_MAX];
|
||||
uint8_t timer_blink[DISP_BTN_MAX];
|
||||
|
||||
} APP_data_t;
|
||||
|
||||
void APP_init(APP_data_t *app_data);
|
||||
void CTRL_buttonsInit(void);
|
||||
void CTRL_buttonsHandler(void);
|
||||
void CTRL_pushedDispBtnEvent(ButtonKey_t *key);
|
||||
void CTRL_pushedChanBtnEvent(ButtonKey_t *key);
|
||||
BITMAP_buttonName_t CTRL_getBitmapName(LAY_dispBtn_t disp_btn);
|
||||
|
||||
56
firmware/shared_libs/controllers/ctrl_app_types.h
Normal file
56
firmware/shared_libs/controllers/ctrl_app_types.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GEN_FG_TYPE,
|
||||
GEN_PWM_TYPE,
|
||||
GEN_TYPE_MAX
|
||||
} GEN_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHANNEL1,
|
||||
CHANNEL2,
|
||||
CHANNEL3,
|
||||
CHANNEL4,
|
||||
CHANNEL5,
|
||||
CHANNEL6,
|
||||
CHANNEL_MAX
|
||||
} GEN_channel_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LAY_MAIN,
|
||||
LAY_FREQ,
|
||||
LAY_AMPL,
|
||||
LAY_OFFS,
|
||||
LAY_PHAS,
|
||||
LAY_DUTY,
|
||||
LAY_WAVE,
|
||||
LAY_STATE_MAX
|
||||
} STATE_layout_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BTN_MAIN_FG,
|
||||
BTN_MAIN_PWM,
|
||||
BTN_FREQ,
|
||||
BTN_FREQ_MIN,
|
||||
BTN_FREQ_MAX,
|
||||
BTN_AMPL,
|
||||
BTN_OFFS,
|
||||
BTN_PHAS,
|
||||
BTN_DUTY,
|
||||
BTN_WAVE,
|
||||
BTN_STATE_MAX
|
||||
} STATE_button_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DISP_BTN_1,
|
||||
DISP_BTN_2,
|
||||
DISP_BTN_3,
|
||||
DISP_BTN_4,
|
||||
DISP_BTN_5,
|
||||
DISP_BTN_MAX,
|
||||
} LAY_dispBtn_t;
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "main.h"
|
||||
#include "config.h"
|
||||
#include "hw_button.h"
|
||||
#include "ctrl_button.h"
|
||||
// #include "ctrl_app.h"
|
||||
#include "ctrl_bottom_button.h"
|
||||
|
||||
static ButtonKey_t bottom_buttons[BTN_BOT_MAX];
|
||||
@@ -54,3 +53,8 @@ void CTRL_bottomButtonsHandler(void)
|
||||
buttonHandler(&bottom_buttons[btn_key]);
|
||||
}
|
||||
}
|
||||
|
||||
__weak void CTRL_pushedDispBtnEvent(ButtonKey_t *key)
|
||||
{
|
||||
UNUSED(key);
|
||||
}
|
||||
@@ -12,3 +12,4 @@ typedef enum
|
||||
|
||||
void CTRL_bottomButtonInit(void);
|
||||
void CTRL_bottomButtonsHandler(void);
|
||||
void CTRL_pushedDispBtnEvent(ButtonKey_t *key);
|
||||
|
||||
@@ -1,47 +1,49 @@
|
||||
#include "main.h"
|
||||
#include "config.h"
|
||||
#include "hw_button.h"
|
||||
#include "ctrl_button.h"
|
||||
#include "ctrl_channel_button.h"
|
||||
|
||||
#define DUMMY_GPIO_Port GPIOA
|
||||
#define DUMMY_GPIO_Pin GPIO_PIN_0
|
||||
|
||||
static ButtonKey_t channel_buttons[BTN_CH_MAX];
|
||||
|
||||
void CTRL_channelButtonInit(void)
|
||||
{
|
||||
channel_buttons[BTN_CH_1].instance = BTN_CH_1;
|
||||
channel_buttons[BTN_CH_1].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_1].gpio_port = BTN1_GPIO_Port;
|
||||
channel_buttons[BTN_CH_1].gpio_pin = BTN1_Pin;
|
||||
channel_buttons[BTN_CH_1].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_1].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_1].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_2].instance = BTN_CH_2;
|
||||
channel_buttons[BTN_CH_2].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_2].gpio_port = BTN2_GPIO_Port;
|
||||
channel_buttons[BTN_CH_2].gpio_pin = BTN2_Pin;
|
||||
channel_buttons[BTN_CH_2].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_2].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_2].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_3].instance = BTN_CH_3;
|
||||
channel_buttons[BTN_CH_3].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_3].gpio_port = BTN3_GPIO_Port;
|
||||
channel_buttons[BTN_CH_3].gpio_pin = BTN3_Pin;
|
||||
channel_buttons[BTN_CH_3].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_3].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_3].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_4].instance = BTN_CH_4;
|
||||
channel_buttons[BTN_CH_4].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_4].gpio_port = BTN4_GPIO_Port;
|
||||
channel_buttons[BTN_CH_4].gpio_pin = BTN4_Pin;
|
||||
channel_buttons[BTN_CH_4].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_4].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_4].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_5].instance = BTN_CH_5;
|
||||
channel_buttons[BTN_CH_5].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_5].gpio_port = BTN5_GPIO_Port;
|
||||
channel_buttons[BTN_CH_5].gpio_pin = BTN5_Pin;
|
||||
channel_buttons[BTN_CH_5].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_5].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_5].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
channel_buttons[BTN_CH_6].instance = BTN_CH_6;
|
||||
channel_buttons[BTN_CH_6].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||
channel_buttons[BTN_CH_6].gpio_port = BTN5_GPIO_Port;
|
||||
channel_buttons[BTN_CH_6].gpio_pin = BTN5_Pin;
|
||||
channel_buttons[BTN_CH_6].gpio_port = DUMMY_GPIO_Port;
|
||||
channel_buttons[BTN_CH_6].gpio_pin = DUMMY_GPIO_Pin;
|
||||
channel_buttons[BTN_CH_6].pushed_state = GPIO_PIN_SET;
|
||||
|
||||
for (HW_chanBtnName_t btn_key = BTN_CH_1; btn_key < BTN_CH_MAX; btn_key++)
|
||||
|
||||
@@ -1,23 +1,31 @@
|
||||
#include "main.h"
|
||||
#include "printf.h"
|
||||
#include "bitmap_fonts.h"
|
||||
#include "disp_layout_defs.h"
|
||||
#include "bitmap_disp_buttons.h"
|
||||
|
||||
#include "disp_layout.h"
|
||||
|
||||
static void _drawFreqValue(GFX_display_t *disp, uint32_t freq)
|
||||
const uint8_t btn_pos_x[DISP_BTN_MAX] = {0, 26, 52, 78, 104};
|
||||
const uint8_t marker_freq_pos_X[7] = {76, 84, 90, 96, 105, 111, 118};
|
||||
|
||||
// clang-format off
|
||||
const GFX_bitmap_t marker = {05, 03, (uint8_t[]){0xF9,0xFB,0xFF,0xFB,0xF9,}};
|
||||
|
||||
// clang-format on
|
||||
|
||||
static void _drawFreqValue(GFX_display_t *disp, uint32_t freq, uint8_t pos_y)
|
||||
{
|
||||
// uint32_t freq = 9999999;
|
||||
uint8_t data[8];
|
||||
snprintf((char *)data, 8, "%07u", freq);
|
||||
DISP_writeString(disp, &font5x7Info, data, 76, 13, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t[]){data[0], 0}, 76, pos_y, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t[]){data[0], 0}, 76, pos_y, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t[]){data[1], data[2], data[3], 0}, 84, pos_y, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t[]){data[4], data[5], data[6], 0}, 105, pos_y, BM_NORMAL);
|
||||
}
|
||||
|
||||
static void _drawAmplValue(GFX_display_t *disp, uint16_t ampl)
|
||||
{
|
||||
// float ampl = getAmplValue();
|
||||
uint8_t data[8];
|
||||
// snprintf((char *)data, 8, "%05.2f V", ampl);
|
||||
snprintf((char *)data, 8, "%02d.%02d V", ampl / 100, ampl % 100);
|
||||
DISP_writeString(disp, &font5x7Info, data, 76, 23, BM_NORMAL);
|
||||
}
|
||||
@@ -51,14 +59,14 @@ static void _blinkButtons(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
// input: display buttons, invert
|
||||
BITMAP_buttonName_t bitmap_idx;
|
||||
for (LAY_dispBtnIdx_t btn_idx = LAY_BTN_1; btn_idx < LAY_BTN_MAX; btn_idx++)
|
||||
for (LAY_dispBtn_t btn_idx = DISP_BTN_1; btn_idx < DISP_BTN_MAX; btn_idx++)
|
||||
{
|
||||
if (!(app_data->isButtonBlink & (1 << btn_idx)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bitmap_idx = btn_names[app_data->curr_layout][btn_idx];
|
||||
bitmap_idx = CTRL_getBitmapName(btn_idx);
|
||||
if (app_data->timer_blink[btn_idx] > 0)
|
||||
{
|
||||
DISP_drawBitmap(disp, &bitmap_btnBottom[bitmap_idx + 1], btn_pos_x[btn_idx], 53, BM_NORMAL);
|
||||
@@ -78,38 +86,72 @@ static void _drawButtons(GFX_display_t *disp, APP_data_t *app_data)
|
||||
BITMAP_buttonName_t bitmap_idx;
|
||||
DISP_clearRegion(disp, 0, 53, disp->width, 11);
|
||||
|
||||
for (LAY_dispBtnIdx_t btn_idx = LAY_BTN_1; btn_idx < LAY_BTN_MAX; btn_idx++)
|
||||
for (LAY_dispBtn_t btn_idx = DISP_BTN_1; btn_idx < DISP_BTN_MAX; btn_idx++)
|
||||
{
|
||||
bitmap_idx = btn_names[app_data->curr_layout][btn_idx];
|
||||
bitmap_idx = CTRL_getBitmapName(btn_idx);
|
||||
DISP_drawBitmap(disp, &bitmap_btnBottom[bitmap_idx], btn_pos_x[btn_idx], 53, BM_NORMAL);
|
||||
}
|
||||
|
||||
app_data->isButtonChange = 0;
|
||||
}
|
||||
|
||||
static void _drawMeterHelper(GFX_display_t *disp, char *min, char *max, uint8_t pos)
|
||||
{
|
||||
DISP_drawPixel(disp, 64, 40, GFX_WHITE);
|
||||
DISP_drawPixel(disp, 125, 40, GFX_WHITE);
|
||||
DISP_drawHorizontalLine(disp, 64, 41, 62, GFX_WHITE);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)min, 62, 43, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)max, 117, 43, BM_NORMAL);
|
||||
// marker 0% - 62, 100% - 123
|
||||
DISP_drawBitmap(disp, &marker, 62 + pos, 35, BM_NORMAL);
|
||||
}
|
||||
|
||||
static void _drawFreqValueHelper(GFX_display_t *disp, uint32_t freq, uint8_t focus_digit)
|
||||
{
|
||||
DISP_clearRegion(disp, 64, 13, 66, 40);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"F:", 64, 20, BM_NORMAL);
|
||||
_drawFreqValue(disp, freq, 20);
|
||||
DISP_drawBitmap(disp, &marker, marker_freq_pos_X[6 - focus_digit], 15, BM_NORMAL);
|
||||
}
|
||||
|
||||
static uint8_t _calcMarkePos(uint32_t value, uint32_t max)
|
||||
{
|
||||
return ((62 * value) + (max / 2)) / max;
|
||||
}
|
||||
|
||||
static void _drawFuncGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
GEN_fg_t *fun_gen = (GEN_fg_t *)app_data->generator;
|
||||
switch (app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_FREQ:
|
||||
_drawFreqValueHelper(disp, fun_gen->frequency, app_data->freq_focus_digit);
|
||||
_drawMeterHelper(disp, "1", "1M", _calcMarkePos(900000, 1000000));
|
||||
break;
|
||||
case LAY_AMPL:
|
||||
_drawAmplValue(disp, fun_gen->amplitude);
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_drawOffsValue(disp, fun_gen->offset);
|
||||
break;
|
||||
case LAY_PHAS:
|
||||
_drawPhasValue(disp, fun_gen->phase);
|
||||
break;
|
||||
case LAY_MAIN:
|
||||
DISP_clearRegion(disp, 62, 13, 66, 40);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"F:", 64, 13, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"A:", 64, 23, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"O:", 64, 33, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"P:", 64, 43, BM_NORMAL);
|
||||
|
||||
GEN_fg_t *fun_gen = (GEN_fg_t *)app_data->generator;
|
||||
switch (app_data->curr_layout)
|
||||
{
|
||||
case LAY_FG_FREQ:
|
||||
_drawFreqValue(disp, fun_gen->frequency);
|
||||
break;
|
||||
case LAY_FG_AMPL:
|
||||
_drawFreqValue(disp, fun_gen->frequency, 13);
|
||||
_drawAmplValue(disp, fun_gen->amplitude);
|
||||
break;
|
||||
case LAY_FG_OFFS:
|
||||
_drawOffsValue(disp, fun_gen->offset);
|
||||
break;
|
||||
case LAY_FG_PHAS:
|
||||
_drawPhasValue(disp, fun_gen->phase);
|
||||
break;
|
||||
|
||||
default:
|
||||
// focus
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +165,7 @@ static void _drawPwmGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"P:", 64, 43, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"D:", 64, 43, BM_NORMAL);
|
||||
|
||||
_drawFreqValue(disp, pwm_gen->frequency);
|
||||
_drawFreqValue(disp, pwm_gen->frequency, 13);
|
||||
_drawAmplValue(disp, pwm_gen->amplitude / 100);
|
||||
_drawOffsValue(disp, pwm_gen->offset / 100);
|
||||
_drawPhasValue(disp, pwm_gen->phase);
|
||||
@@ -133,7 +175,7 @@ static void _drawPwmGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
static void _drawValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
// input: frequency(value), amplitiude(value), offset(value), phase(value), duty(value), invert(info), position(value)
|
||||
switch (app_data->gen_type)
|
||||
switch (app_data->curr_gen_type)
|
||||
{
|
||||
case GEN_FG_TYPE:
|
||||
_drawFuncGenValues(disp, app_data);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "main.h"
|
||||
#include "disp_layout_defs.h"
|
||||
|
||||
const BITMAP_buttonName_t btn_names[LAY_STATE_MAX][LAY_BTN_MAX] = {
|
||||
{DISP_BTN_FREQ, DISP_BTN_AMPL, DISP_BTN_OFFS, DISP_BTN_PHAS, DISP_BTN_WAVE}, // Func Gen Main
|
||||
{DISP_BTN_LEFT, DISP_BTN_RIGHT, DISP_BTN_NONE, DISP_BTN_NONE, DISP_BTN_BACK}, // Func Gen Freq
|
||||
{DISP_BTN_X1, DISP_BTN_X0_1, DISP_BTN_X0_01, DISP_BTN_NONE, DISP_BTN_BACK}, // Func Gen Ampl
|
||||
{DISP_BTN_X1, DISP_BTN_X0_1, DISP_BTN_X0_01, DISP_BTN_NONE, DISP_BTN_BACK}, // Func Gen Offs
|
||||
{DISP_BTN_X10, DISP_BTN_X1, DISP_BTN_NONE, DISP_BTN_NONE, DISP_BTN_BACK}, // Func Gen Phas
|
||||
{DISP_BTN_NONE, DISP_BTN_NONE, DISP_BTN_NONE, DISP_BTN_NONE, DISP_BTN_BACK}, // Func Gen Wave
|
||||
};
|
||||
|
||||
const uint8_t btn_pos_x[LAY_BTN_MAX] = {0, 26, 52, 78, 104};
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "bitmap_disp_buttons.h"
|
||||
#include "disp_layout_types.h"
|
||||
|
||||
extern const BITMAP_buttonName_t btn_names[LAY_STATE_MAX][LAY_BTN_MAX];
|
||||
extern const uint8_t btn_pos_x[LAY_BTN_MAX];
|
||||
@@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LAY_BTN_1,
|
||||
LAY_BTN_2,
|
||||
LAY_BTN_3,
|
||||
LAY_BTN_4,
|
||||
LAY_BTN_5,
|
||||
LAY_BTN_MAX,
|
||||
} LAY_dispBtnIdx_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LAY_FG_MAIN,
|
||||
LAY_FG_FREQ,
|
||||
LAY_FG_AMPL,
|
||||
LAY_FG_OFFS,
|
||||
LAY_FG_PHAS,
|
||||
LAY_FG_WAVE,
|
||||
LAY_STATE_MAX,
|
||||
} LAY_state_t;
|
||||
@@ -347,7 +347,7 @@ static inline uint8_t _getBitmapByte(const uint8_t *bitmap, uint16_t index, GFX_
|
||||
* @param pos_y Top left corner y coordinate
|
||||
* @param color Color of pixel BM_NORMAL or BM_INVERSE for bitmap. BM_WHITE or BM_BLACK for fill region.
|
||||
*/
|
||||
void DISP_drawBitmap(GFX_display_t *disp, GFX_bitmap_t *bitmap, int8_t pos_x, int8_t pos_y, GFX_BitmapColor_t color)
|
||||
void DISP_drawBitmap(GFX_display_t *disp, const GFX_bitmap_t *bitmap, int8_t pos_x, int8_t pos_y, GFX_BitmapColor_t color)
|
||||
{
|
||||
if (bitmap->width + pos_x < 0 || bitmap->height + pos_y < 0)
|
||||
return;
|
||||
|
||||
@@ -58,6 +58,6 @@ void DISP_drawFillRect(GFX_display_t *disp, int16_t x, int16_t y, int16_t width,
|
||||
void DISP_drawCircle(GFX_display_t *disp, int16_t x0, int16_t y0, uint8_t radius, GFX_Color_t color);
|
||||
void DISP_drawQuarterCircle(GFX_display_t *disp, int16_t x0, int16_t y0, uint8_t radius, GFX_CircCorners_t corner, GFX_Color_t color);
|
||||
void DISP_drawRoundRect(GFX_display_t *disp, int16_t x, int16_t y, int16_t width, int16_t height, int16_t radius, GFX_Color_t color);
|
||||
void DISP_drawBitmap(GFX_display_t *disp, GFX_bitmap_t *bitmap, int8_t pos_x, int8_t pos_y, GFX_BitmapColor_t color);
|
||||
void DISP_drawBitmap(GFX_display_t *disp, const GFX_bitmap_t *bitmap, int8_t pos_x, int8_t pos_y, GFX_BitmapColor_t color);
|
||||
void DISP_clearRegion(GFX_display_t *disp, int16_t x, int16_t y, int16_t width, int16_t height);
|
||||
void DISP_clearScreen(GFX_display_t *disp);
|
||||
|
||||
Reference in New Issue
Block a user