initialize ad9833 and mcp41
This commit is contained in:
@@ -1 +1 @@
|
|||||||
[]
|
[{"node":"ADC1","expanded":true,"format":0,"pinned":false}]
|
||||||
3
firmware/.vscode/settings.json
vendored
3
firmware/.vscode/settings.json
vendored
@@ -18,5 +18,6 @@
|
|||||||
"ulog.h": "c",
|
"ulog.h": "c",
|
||||||
"ctrl_generator.h": "c",
|
"ctrl_generator.h": "c",
|
||||||
"type_traits": "c"
|
"type_traits": "c"
|
||||||
}
|
},
|
||||||
|
"cortex-debug.variableUseNaturalFormat": true
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,7 @@
|
|||||||
#define __MAIN_H
|
#define __MAIN_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
@@ -34,25 +33,25 @@ extern "C"
|
|||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
// #include "SEGGER_RTT.h"
|
// #include "SEGGER_RTT.h"
|
||||||
#include "ulog.h"
|
#include "ulog.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN ET */
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
/* USER CODE END ET */
|
/* USER CODE END ET */
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EC */
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
/* USER CODE END EC */
|
/* USER CODE END EC */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EM */
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
/* USER CODE END EM */
|
/* USER CODE END EM */
|
||||||
|
|
||||||
/* Exported functions prototypes ---------------------------------------------*/
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
void Error_Handler(void);
|
void Error_Handler(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN EFP */
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
@@ -61,41 +60,47 @@ extern "C"
|
|||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define B1_Pin GPIO_PIN_13
|
#define B1_Pin GPIO_PIN_13
|
||||||
#define B1_GPIO_Port GPIOC
|
#define B1_GPIO_Port GPIOC
|
||||||
|
#define BTN1_Pin GPIO_PIN_0
|
||||||
|
#define BTN1_GPIO_Port GPIOA
|
||||||
|
#define BTN2_Pin GPIO_PIN_1
|
||||||
|
#define BTN2_GPIO_Port GPIOA
|
||||||
#define USART_TX_Pin GPIO_PIN_2
|
#define USART_TX_Pin GPIO_PIN_2
|
||||||
#define USART_TX_GPIO_Port GPIOA
|
#define USART_TX_GPIO_Port GPIOA
|
||||||
#define USART_RX_Pin GPIO_PIN_3
|
#define USART_RX_Pin GPIO_PIN_3
|
||||||
#define USART_RX_GPIO_Port GPIOA
|
#define USART_RX_GPIO_Port GPIOA
|
||||||
#define LD2_Pin GPIO_PIN_5
|
#define BTN3_Pin GPIO_PIN_4
|
||||||
#define LD2_GPIO_Port GPIOA
|
#define BTN3_GPIO_Port GPIOA
|
||||||
#define BTN1_Pin GPIO_PIN_1
|
#define BTN4_Pin GPIO_PIN_5
|
||||||
#define BTN1_GPIO_Port GPIOB
|
#define BTN4_GPIO_Port GPIOA
|
||||||
#define BTN2_Pin GPIO_PIN_2
|
#define AMP1_CS_Pin GPIO_PIN_11
|
||||||
#define BTN2_GPIO_Port GPIOB
|
#define AMP1_CS_GPIO_Port GPIOB
|
||||||
#define BTN3_Pin GPIO_PIN_11
|
#define DDS1_CS_Pin GPIO_PIN_12
|
||||||
#define BTN3_GPIO_Port GPIOB
|
#define DDS1_CS_GPIO_Port GPIOB
|
||||||
#define BTN4_Pin GPIO_PIN_12
|
#define ST7565_RST_Pin GPIO_PIN_8
|
||||||
#define BTN4_GPIO_Port GPIOB
|
#define ST7565_RST_GPIO_Port GPIOC
|
||||||
#define BTN5_Pin GPIO_PIN_11
|
#define ST7565_A0_Pin GPIO_PIN_9
|
||||||
|
#define ST7565_A0_GPIO_Port GPIOC
|
||||||
|
#define BTN5_Pin GPIO_PIN_8
|
||||||
#define BTN5_GPIO_Port GPIOA
|
#define BTN5_GPIO_Port GPIOA
|
||||||
|
#define BTN_CH1_Pin GPIO_PIN_9
|
||||||
|
#define BTN_CH1_GPIO_Port GPIOA
|
||||||
|
#define LED_CH1_Pin GPIO_PIN_10
|
||||||
|
#define LED_CH1_GPIO_Port GPIOA
|
||||||
#define TMS_Pin GPIO_PIN_13
|
#define TMS_Pin GPIO_PIN_13
|
||||||
#define TMS_GPIO_Port GPIOA
|
#define TMS_GPIO_Port GPIOA
|
||||||
#define TCK_Pin GPIO_PIN_14
|
#define TCK_Pin GPIO_PIN_14
|
||||||
#define TCK_GPIO_Port GPIOA
|
#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_Pin GPIO_PIN_10
|
||||||
#define ST7565_SCK_GPIO_Port GPIOC
|
#define ST7565_SCK_GPIO_Port GPIOC
|
||||||
#define ST7565_RST_Pin GPIO_PIN_11
|
#define ST7565_CS_Pin GPIO_PIN_11
|
||||||
#define ST7565_RST_GPIO_Port GPIOC
|
#define ST7565_CS_GPIO_Port GPIOC
|
||||||
#define ST7565_MOSI_Pin GPIO_PIN_12
|
#define ST7565_MOSI_Pin GPIO_PIN_12
|
||||||
#define ST7565_MOSI_GPIO_Port GPIOC
|
#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_Pin GPIO_PIN_3
|
||||||
#define SWO_GPIO_Port GPIOB
|
#define SWO_GPIO_Port GPIOB
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN Header */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file gpio.c
|
* @file gpio.c
|
||||||
* @brief This file provides code for the configuration
|
* @brief This file provides code for the configuration
|
||||||
* of all used GPIO pins.
|
* of all used GPIO pins.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @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 */
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
@@ -49,16 +49,15 @@ void MX_GPIO_Init(void)
|
|||||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOA, LD2_Pin|ST7565_CS_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOB, AMP1_CS_Pin|DDS1_CS_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(ST7565_RST_GPIO_Port, ST7565_RST_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOC, ST7565_RST_Pin|ST7565_A0_Pin|ST7565_CS_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(ST7565_A0_GPIO_Port, ST7565_A0_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(LED_CH1_GPIO_Port, LED_CH1_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin : PtPin */
|
/*Configure GPIO pin : PtPin */
|
||||||
GPIO_InitStruct.Pin = B1_Pin;
|
GPIO_InitStruct.Pin = B1_Pin;
|
||||||
@@ -66,38 +65,34 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PAPin PAPin */
|
/*Configure GPIO pins : PAPin PAPin PAPin PAPin
|
||||||
GPIO_InitStruct.Pin = LD2_Pin|ST7565_CS_Pin;
|
PAPin PAPin */
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Pin = BTN1_Pin|BTN2_Pin|BTN3_Pin|BTN4_Pin
|
||||||
|
|BTN5_Pin|BTN_CH1_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PBPin PBPin PBPin PBPin */
|
/*Configure GPIO pins : PBPin PBPin */
|
||||||
GPIO_InitStruct.Pin = BTN1_Pin|BTN2_Pin|BTN3_Pin|BTN4_Pin;
|
GPIO_InitStruct.Pin = AMP1_CS_Pin|DDS1_CS_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin : PtPin */
|
/*Configure GPIO pins : PCPin PCPin PCPin */
|
||||||
GPIO_InitStruct.Pin = BTN5_Pin;
|
GPIO_InitStruct.Pin = ST7565_RST_Pin|ST7565_A0_Pin|ST7565_CS_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.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(ST7565_RST_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin : PtPin */
|
/*Configure GPIO pin : PtPin */
|
||||||
GPIO_InitStruct.Pin = ST7565_A0_Pin;
|
GPIO_InitStruct.Pin = LED_CH1_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(ST7565_A0_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(LED_CH1_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,9 +102,8 @@ int main(void)
|
|||||||
MX_TIM3_Init();
|
MX_TIM3_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
ulog_init();
|
ulog_init();
|
||||||
ulog_subscribe(RTT_console_logger, ULOG_DEBUG_LEVEL);
|
ulog_subscribe(RTT_console_logger, ULOG_TRACE_LEVEL);
|
||||||
|
|
||||||
APP_init(&app_data);
|
|
||||||
HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_ALL);
|
HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_ALL);
|
||||||
// SEGGER_RTT_WriteString(0, "App start...\n");
|
// SEGGER_RTT_WriteString(0, "App start...\n");
|
||||||
ULOG_INFO("start app...");
|
ULOG_INFO("start app...");
|
||||||
@@ -124,8 +123,9 @@ int main(void)
|
|||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
DISP_clearScreen(&disp);
|
DISP_clearScreen(&disp);
|
||||||
ST7565_DisplayAll(&hst7565);
|
ST7565_DisplayAll(&hst7565);
|
||||||
|
HAL_Delay(1000);
|
||||||
uint32_t last_tick = HAL_GetTick();
|
uint32_t last_tick = HAL_GetTick();
|
||||||
|
APP_init(&app_data);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
CTRL_buttonsHandler();
|
CTRL_buttonsHandler();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void MX_SPI2_Init(void)
|
|||||||
hspi2.Init.Mode = SPI_MODE_MASTER;
|
hspi2.Init.Mode = SPI_MODE_MASTER;
|
||||||
hspi2.Init.Direction = SPI_DIRECTION_2LINES;
|
hspi2.Init.Direction = SPI_DIRECTION_2LINES;
|
||||||
hspi2.Init.DataSize = SPI_DATASIZE_8BIT;
|
hspi2.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||||
hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;
|
hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;
|
||||||
hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
|
hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||||
hspi2.Init.NSS = SPI_NSS_SOFT;
|
hspi2.Init.NSS = SPI_NSS_SOFT;
|
||||||
hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
|
hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Fri Apr 21 19:03:25 CEST 2023]
|
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Sun May 21 21:04:44 CEST 2023]
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
|||||||
@@ -21,35 +21,38 @@ Mcu.Name=STM32F303R(D-E)Tx
|
|||||||
Mcu.Package=LQFP64
|
Mcu.Package=LQFP64
|
||||||
Mcu.Pin0=PC13
|
Mcu.Pin0=PC13
|
||||||
Mcu.Pin1=PC14-OSC32_IN
|
Mcu.Pin1=PC14-OSC32_IN
|
||||||
Mcu.Pin10=PB1
|
Mcu.Pin10=PA5
|
||||||
Mcu.Pin11=PB2
|
Mcu.Pin11=PA6
|
||||||
Mcu.Pin12=PB11
|
Mcu.Pin12=PA7
|
||||||
Mcu.Pin13=PB12
|
Mcu.Pin13=PB11
|
||||||
Mcu.Pin14=PB13
|
Mcu.Pin14=PB12
|
||||||
Mcu.Pin15=PB14
|
Mcu.Pin15=PB13
|
||||||
Mcu.Pin16=PB15
|
Mcu.Pin16=PB14
|
||||||
Mcu.Pin17=PA11
|
Mcu.Pin17=PB15
|
||||||
Mcu.Pin18=PA13
|
Mcu.Pin18=PC8
|
||||||
Mcu.Pin19=PA14
|
Mcu.Pin19=PC9
|
||||||
Mcu.Pin2=PC15-OSC32_OUT
|
Mcu.Pin2=PC15-OSC32_OUT
|
||||||
Mcu.Pin20=PA15
|
Mcu.Pin20=PA8
|
||||||
Mcu.Pin21=PC10
|
Mcu.Pin21=PA9
|
||||||
Mcu.Pin22=PC11
|
Mcu.Pin22=PA10
|
||||||
Mcu.Pin23=PC12
|
Mcu.Pin23=PA13
|
||||||
Mcu.Pin24=PD2
|
Mcu.Pin24=PA14
|
||||||
Mcu.Pin25=PB3
|
Mcu.Pin25=PC10
|
||||||
Mcu.Pin26=PB6
|
Mcu.Pin26=PC11
|
||||||
Mcu.Pin27=PB7
|
Mcu.Pin27=PC12
|
||||||
Mcu.Pin28=VP_SYS_VS_Systick
|
Mcu.Pin28=PB3
|
||||||
Mcu.Pin29=VP_TIM2_VS_ClockSourceINT
|
Mcu.Pin29=PB6
|
||||||
Mcu.Pin3=PF0-OSC_IN
|
Mcu.Pin3=PF0-OSC_IN
|
||||||
|
Mcu.Pin30=PB7
|
||||||
|
Mcu.Pin31=VP_SYS_VS_Systick
|
||||||
|
Mcu.Pin32=VP_TIM2_VS_ClockSourceINT
|
||||||
Mcu.Pin4=PF1-OSC_OUT
|
Mcu.Pin4=PF1-OSC_OUT
|
||||||
Mcu.Pin5=PA2
|
Mcu.Pin5=PA0
|
||||||
Mcu.Pin6=PA3
|
Mcu.Pin6=PA1
|
||||||
Mcu.Pin7=PA5
|
Mcu.Pin7=PA2
|
||||||
Mcu.Pin8=PA6
|
Mcu.Pin8=PA3
|
||||||
Mcu.Pin9=PA7
|
Mcu.Pin9=PA4
|
||||||
Mcu.PinsNb=30
|
Mcu.PinsNb=33
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F303RETx
|
Mcu.UserName=STM32F303RETx
|
||||||
@@ -66,10 +69,18 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
|
|||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
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.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true\:true\:false
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
PA11.GPIOParameters=GPIO_Label
|
PA0.GPIOParameters=GPIO_Label
|
||||||
PA11.GPIO_Label=BTN5
|
PA0.GPIO_Label=BTN1
|
||||||
PA11.Locked=true
|
PA0.Locked=true
|
||||||
PA11.Signal=GPIO_Input
|
PA0.Signal=GPIO_Input
|
||||||
|
PA1.GPIOParameters=GPIO_Label
|
||||||
|
PA1.GPIO_Label=BTN2
|
||||||
|
PA1.Locked=true
|
||||||
|
PA1.Signal=GPIO_Input
|
||||||
|
PA10.GPIOParameters=GPIO_Label
|
||||||
|
PA10.GPIO_Label=LED_CH1
|
||||||
|
PA10.Locked=true
|
||||||
|
PA10.Signal=GPIO_Output
|
||||||
PA13.GPIOParameters=GPIO_Label
|
PA13.GPIOParameters=GPIO_Label
|
||||||
PA13.GPIO_Label=TMS
|
PA13.GPIO_Label=TMS
|
||||||
PA13.Locked=true
|
PA13.Locked=true
|
||||||
@@ -80,10 +91,6 @@ PA14.GPIO_Label=TCK
|
|||||||
PA14.Locked=true
|
PA14.Locked=true
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
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.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||||
PA2.GPIO_Label=USART_TX
|
PA2.GPIO_Label=USART_TX
|
||||||
PA2.GPIO_Mode=GPIO_MODE_AF_PP
|
PA2.GPIO_Mode=GPIO_MODE_AF_PP
|
||||||
@@ -100,38 +107,39 @@ PA3.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
|||||||
PA3.Locked=true
|
PA3.Locked=true
|
||||||
PA3.Mode=Asynchronous
|
PA3.Mode=Asynchronous
|
||||||
PA3.Signal=USART2_RX
|
PA3.Signal=USART2_RX
|
||||||
PA5.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
PA4.GPIOParameters=GPIO_Label
|
||||||
PA5.GPIO_Label=LD2 [Green Led]
|
PA4.GPIO_Label=BTN3
|
||||||
PA5.GPIO_Mode=GPIO_MODE_OUTPUT_PP
|
PA4.Locked=true
|
||||||
PA5.GPIO_PuPd=GPIO_NOPULL
|
PA4.Signal=GPIO_Input
|
||||||
PA5.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
PA5.GPIOParameters=GPIO_Label
|
||||||
|
PA5.GPIO_Label=BTN4
|
||||||
PA5.Locked=true
|
PA5.Locked=true
|
||||||
PA5.Signal=GPIO_Output
|
PA5.Signal=GPIO_Input
|
||||||
PA6.Signal=S_TIM3_CH1
|
PA6.Signal=S_TIM3_CH1
|
||||||
PA7.Locked=true
|
PA7.Locked=true
|
||||||
PA7.Signal=S_TIM3_CH2
|
PA7.Signal=S_TIM3_CH2
|
||||||
PB1.GPIOParameters=GPIO_Label
|
PA8.GPIOParameters=GPIO_Label
|
||||||
PB1.GPIO_Label=BTN1
|
PA8.GPIO_Label=BTN5
|
||||||
PB1.Locked=true
|
PA8.Locked=true
|
||||||
PB1.Signal=GPIO_Input
|
PA8.Signal=GPIO_Input
|
||||||
|
PA9.GPIOParameters=GPIO_Label
|
||||||
|
PA9.GPIO_Label=BTN_CH1
|
||||||
|
PA9.Locked=true
|
||||||
|
PA9.Signal=GPIO_Input
|
||||||
PB11.GPIOParameters=GPIO_Label
|
PB11.GPIOParameters=GPIO_Label
|
||||||
PB11.GPIO_Label=BTN3
|
PB11.GPIO_Label=AMP1_CS
|
||||||
PB11.Locked=true
|
PB11.Locked=true
|
||||||
PB11.Signal=GPIO_Input
|
PB11.Signal=GPIO_Output
|
||||||
PB12.GPIOParameters=GPIO_Label
|
PB12.GPIOParameters=GPIO_Label
|
||||||
PB12.GPIO_Label=BTN4
|
PB12.GPIO_Label=DDS1_CS
|
||||||
PB12.Locked=true
|
PB12.Locked=true
|
||||||
PB12.Signal=GPIO_Input
|
PB12.Signal=GPIO_Output
|
||||||
PB13.Mode=Full_Duplex_Master
|
PB13.Mode=Full_Duplex_Master
|
||||||
PB13.Signal=SPI2_SCK
|
PB13.Signal=SPI2_SCK
|
||||||
PB14.Mode=Full_Duplex_Master
|
PB14.Mode=Full_Duplex_Master
|
||||||
PB14.Signal=SPI2_MISO
|
PB14.Signal=SPI2_MISO
|
||||||
PB15.Mode=Full_Duplex_Master
|
PB15.Mode=Full_Duplex_Master
|
||||||
PB15.Signal=SPI2_MOSI
|
PB15.Signal=SPI2_MOSI
|
||||||
PB2.GPIOParameters=GPIO_Label
|
|
||||||
PB2.GPIO_Label=BTN2
|
|
||||||
PB2.Locked=true
|
|
||||||
PB2.Signal=GPIO_Input
|
|
||||||
PB3.GPIOParameters=GPIO_Label
|
PB3.GPIOParameters=GPIO_Label
|
||||||
PB3.GPIO_Label=SWO
|
PB3.GPIO_Label=SWO
|
||||||
PB3.Locked=true
|
PB3.Locked=true
|
||||||
@@ -147,7 +155,7 @@ PC10.Locked=true
|
|||||||
PC10.Mode=Simplex_Bidirectional_Master
|
PC10.Mode=Simplex_Bidirectional_Master
|
||||||
PC10.Signal=SPI3_SCK
|
PC10.Signal=SPI3_SCK
|
||||||
PC11.GPIOParameters=GPIO_Label
|
PC11.GPIOParameters=GPIO_Label
|
||||||
PC11.GPIO_Label=ST7565_RST
|
PC11.GPIO_Label=ST7565_CS
|
||||||
PC11.Locked=true
|
PC11.Locked=true
|
||||||
PC11.Signal=GPIO_Output
|
PC11.Signal=GPIO_Output
|
||||||
PC12.GPIOParameters=GPIO_Label
|
PC12.GPIOParameters=GPIO_Label
|
||||||
@@ -165,10 +173,14 @@ PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
|||||||
PC15-OSC32_OUT.Locked=true
|
PC15-OSC32_OUT.Locked=true
|
||||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||||
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||||
PD2.GPIOParameters=GPIO_Label
|
PC8.GPIOParameters=GPIO_Label
|
||||||
PD2.GPIO_Label=ST7565_A0
|
PC8.GPIO_Label=ST7565_RST
|
||||||
PD2.Locked=true
|
PC8.Locked=true
|
||||||
PD2.Signal=GPIO_Output
|
PC8.Signal=GPIO_Output
|
||||||
|
PC9.GPIOParameters=GPIO_Label
|
||||||
|
PC9.GPIO_Label=ST7565_A0
|
||||||
|
PC9.Locked=true
|
||||||
|
PC9.Signal=GPIO_Output
|
||||||
PF0-OSC_IN.Locked=true
|
PF0-OSC_IN.Locked=true
|
||||||
PF0-OSC_IN.Mode=HSE-External-Clock-Source
|
PF0-OSC_IN.Mode=HSE-External-Clock-Source
|
||||||
PF0-OSC_IN.Signal=RCC_OSC_IN
|
PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||||
@@ -202,7 +214,7 @@ ProjectManager.StackSize=0x400
|
|||||||
ProjectManager.TargetToolchain=Makefile
|
ProjectManager.TargetToolchain=Makefile
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
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_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,7-MX_TIM2_Init-TIM2-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,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_TIM3_Init-TIM3-false-HAL-true,9-MX_ADC1_Init-ADC1-false-HAL-true
|
||||||
RCC.ADC12outputFreq_Value=72000000
|
RCC.ADC12outputFreq_Value=72000000
|
||||||
RCC.ADC34outputFreq_Value=72000000
|
RCC.ADC34outputFreq_Value=72000000
|
||||||
RCC.AHBFreq_Value=72000000
|
RCC.AHBFreq_Value=72000000
|
||||||
@@ -258,10 +270,11 @@ SH.S_TIM3_CH1.ConfNb=1
|
|||||||
SH.S_TIM3_CH2.0=TIM3_CH2,Encoder_Interface
|
SH.S_TIM3_CH2.0=TIM3_CH2,Encoder_Interface
|
||||||
SH.S_TIM3_CH2.ConfNb=1
|
SH.S_TIM3_CH2.ConfNb=1
|
||||||
SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
|
SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
|
||||||
|
SPI2.CLKPolarity=SPI_POLARITY_HIGH
|
||||||
SPI2.CalculateBaudRate=1.125 MBits/s
|
SPI2.CalculateBaudRate=1.125 MBits/s
|
||||||
SPI2.DataSize=SPI_DATASIZE_8BIT
|
SPI2.DataSize=SPI_DATASIZE_8BIT
|
||||||
SPI2.Direction=SPI_DIRECTION_2LINES
|
SPI2.Direction=SPI_DIRECTION_2LINES
|
||||||
SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,NSSPMode,BaudRatePrescaler
|
SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,NSSPMode,BaudRatePrescaler,CLKPolarity
|
||||||
SPI2.Mode=SPI_MODE_MASTER
|
SPI2.Mode=SPI_MODE_MASTER
|
||||||
SPI2.NSSPMode=SPI_NSS_PULSE_ENABLE
|
SPI2.NSSPMode=SPI_NSS_PULSE_ENABLE
|
||||||
SPI2.VirtualType=VM_MASTER
|
SPI2.VirtualType=VM_MASTER
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "ctrl_bottom_button.h"
|
#include "ctrl_bottom_button.h"
|
||||||
#include "ctrl_channel_button.h"
|
#include "ctrl_channel_button.h"
|
||||||
#include "ctrl_encoder.h"
|
#include "ctrl_encoder.h"
|
||||||
|
#include "ctrl_generator.h"
|
||||||
|
|
||||||
#include "ctrl_app.h"
|
#include "ctrl_app.h"
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ static const uint32_t pow_of_10[7] = {1, 10, 100, 1000, 10000, 100000, 1000000};
|
|||||||
static HW_BotBtnName_t last_key;
|
static HW_BotBtnName_t last_key;
|
||||||
static APP_data_t *_app_data;
|
static APP_data_t *_app_data;
|
||||||
|
|
||||||
static const GENERATOR_t generators[CHANNEL_MAX] = {
|
static GENERATOR_t generators[CHANNEL_MAX] = {
|
||||||
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[0]},
|
{.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[1]},
|
||||||
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[2]},
|
{.gen_type = GEN_FG_TYPE, .gen = &func_gen[2]},
|
||||||
@@ -55,13 +56,15 @@ void APP_init(APP_data_t *app_data)
|
|||||||
_app_data->isButtonBlink = 1;
|
_app_data->isButtonBlink = 1;
|
||||||
|
|
||||||
CTRL_buttonsInit();
|
CTRL_buttonsInit();
|
||||||
|
HAL_GPIO_WritePin(LED_CH1_GPIO_Port, LED_CH1_Pin, GPIO_PIN_SET);
|
||||||
|
gen_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTRL_buttonsInit(void)
|
void CTRL_buttonsInit(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
CTRL_bottomButtonInit();
|
CTRL_bottomButtonInit();
|
||||||
// CTRL_channelButtonInit();
|
CTRL_channelButtonInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTRL_buttonsHandler(void)
|
void CTRL_buttonsHandler(void)
|
||||||
@@ -84,6 +87,25 @@ void CTRL_pushedChanBtnEvent(ButtonKey_t *key)
|
|||||||
UNUSED(key);
|
UNUSED(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTRL_longPushedChanBtnEvent(ButtonKey_t *key)
|
||||||
|
{
|
||||||
|
ULOG_TRACE("Chan btn(long): %d", key->instance);
|
||||||
|
GEN_fg_t *dds_ch0 = generators[key->instance].gen;
|
||||||
|
if (dds_ch0->enabled)
|
||||||
|
{
|
||||||
|
dds_ch0->enabled = FALSE;
|
||||||
|
setEnabled(&generators[CHANNEL1], CHANNEL1);
|
||||||
|
HAL_GPIO_WritePin(LED_CH1_GPIO_Port, LED_CH1_Pin, GPIO_PIN_SET);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dds_ch0->enabled = TRUE;
|
||||||
|
setEnabled(&generators[CHANNEL1], CHANNEL1);
|
||||||
|
HAL_GPIO_WritePin(LED_CH1_GPIO_Port, LED_CH1_Pin, GPIO_PIN_RESET);
|
||||||
|
}
|
||||||
|
UNUSED(key);
|
||||||
|
}
|
||||||
|
|
||||||
static void _changeValueFunGen(int8_t dir)
|
static void _changeValueFunGen(int8_t dir)
|
||||||
{
|
{
|
||||||
GEN_fg_t *gen = (GEN_fg_t *)_app_data->generator;
|
GEN_fg_t *gen = (GEN_fg_t *)_app_data->generator;
|
||||||
@@ -99,6 +121,7 @@ static void _changeValueFunGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->frequency = new_freq;
|
gen->frequency = new_freq;
|
||||||
|
setFreq(&generators[CHANNEL1], CHANNEL1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_AMPL:
|
case LAY_AMPL:
|
||||||
@@ -110,6 +133,7 @@ static void _changeValueFunGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->amplitude = new_ampl;
|
gen->amplitude = new_ampl;
|
||||||
|
setAmplitude(&generators[CHANNEL1], CHANNEL1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_OFFS:
|
case LAY_OFFS:
|
||||||
@@ -121,6 +145,7 @@ static void _changeValueFunGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->offset = new_offs;
|
gen->offset = new_offs;
|
||||||
|
setOfsset(&generators[CHANNEL1], CHANNEL1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_PHAS:
|
case LAY_PHAS:
|
||||||
@@ -158,6 +183,7 @@ static void _changeValuePwmGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->frequency = new_freq;
|
gen->frequency = new_freq;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_AMPL:
|
case LAY_AMPL:
|
||||||
@@ -169,6 +195,7 @@ static void _changeValuePwmGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->amplitude = new_ampl;
|
gen->amplitude = new_ampl;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_OFFS:
|
case LAY_OFFS:
|
||||||
@@ -180,6 +207,7 @@ static void _changeValuePwmGen(int8_t dir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen->offset = new_offs;
|
gen->offset = new_offs;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LAY_PHAS:
|
case LAY_PHAS:
|
||||||
|
|||||||
@@ -11,31 +11,31 @@ void CTRL_bottomButtonInit(void)
|
|||||||
bottom_buttons[BTN_BOT_1].buttonPressed = CTRL_pushedDispBtnEvent;
|
bottom_buttons[BTN_BOT_1].buttonPressed = CTRL_pushedDispBtnEvent;
|
||||||
bottom_buttons[BTN_BOT_1].gpio_port = BTN1_GPIO_Port;
|
bottom_buttons[BTN_BOT_1].gpio_port = BTN1_GPIO_Port;
|
||||||
bottom_buttons[BTN_BOT_1].gpio_pin = BTN1_Pin;
|
bottom_buttons[BTN_BOT_1].gpio_pin = BTN1_Pin;
|
||||||
bottom_buttons[BTN_BOT_1].pushed_state = GPIO_PIN_SET;
|
bottom_buttons[BTN_BOT_1].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
bottom_buttons[BTN_BOT_2].instance = BTN_BOT_2;
|
bottom_buttons[BTN_BOT_2].instance = BTN_BOT_2;
|
||||||
bottom_buttons[BTN_BOT_2].buttonPressed = CTRL_pushedDispBtnEvent;
|
bottom_buttons[BTN_BOT_2].buttonPressed = CTRL_pushedDispBtnEvent;
|
||||||
bottom_buttons[BTN_BOT_2].gpio_port = BTN2_GPIO_Port;
|
bottom_buttons[BTN_BOT_2].gpio_port = BTN2_GPIO_Port;
|
||||||
bottom_buttons[BTN_BOT_2].gpio_pin = BTN2_Pin;
|
bottom_buttons[BTN_BOT_2].gpio_pin = BTN2_Pin;
|
||||||
bottom_buttons[BTN_BOT_2].pushed_state = GPIO_PIN_SET;
|
bottom_buttons[BTN_BOT_2].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
bottom_buttons[BTN_BOT_3].instance = BTN_BOT_3;
|
bottom_buttons[BTN_BOT_3].instance = BTN_BOT_3;
|
||||||
bottom_buttons[BTN_BOT_3].buttonPressed = CTRL_pushedDispBtnEvent;
|
bottom_buttons[BTN_BOT_3].buttonPressed = CTRL_pushedDispBtnEvent;
|
||||||
bottom_buttons[BTN_BOT_3].gpio_port = BTN3_GPIO_Port;
|
bottom_buttons[BTN_BOT_3].gpio_port = BTN3_GPIO_Port;
|
||||||
bottom_buttons[BTN_BOT_3].gpio_pin = BTN3_Pin;
|
bottom_buttons[BTN_BOT_3].gpio_pin = BTN3_Pin;
|
||||||
bottom_buttons[BTN_BOT_3].pushed_state = GPIO_PIN_SET;
|
bottom_buttons[BTN_BOT_3].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
bottom_buttons[BTN_BOT_4].instance = BTN_BOT_4;
|
bottom_buttons[BTN_BOT_4].instance = BTN_BOT_4;
|
||||||
bottom_buttons[BTN_BOT_4].buttonPressed = CTRL_pushedDispBtnEvent;
|
bottom_buttons[BTN_BOT_4].buttonPressed = CTRL_pushedDispBtnEvent;
|
||||||
bottom_buttons[BTN_BOT_4].gpio_port = BTN4_GPIO_Port;
|
bottom_buttons[BTN_BOT_4].gpio_port = BTN4_GPIO_Port;
|
||||||
bottom_buttons[BTN_BOT_4].gpio_pin = BTN4_Pin;
|
bottom_buttons[BTN_BOT_4].gpio_pin = BTN4_Pin;
|
||||||
bottom_buttons[BTN_BOT_4].pushed_state = GPIO_PIN_SET;
|
bottom_buttons[BTN_BOT_4].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
bottom_buttons[BTN_BOT_5].instance = BTN_BOT_5;
|
bottom_buttons[BTN_BOT_5].instance = BTN_BOT_5;
|
||||||
bottom_buttons[BTN_BOT_5].buttonPressed = CTRL_pushedDispBtnEvent;
|
bottom_buttons[BTN_BOT_5].buttonPressed = CTRL_pushedDispBtnEvent;
|
||||||
bottom_buttons[BTN_BOT_5].gpio_port = BTN5_GPIO_Port;
|
bottom_buttons[BTN_BOT_5].gpio_port = BTN5_GPIO_Port;
|
||||||
bottom_buttons[BTN_BOT_5].gpio_pin = BTN5_Pin;
|
bottom_buttons[BTN_BOT_5].gpio_pin = BTN5_Pin;
|
||||||
bottom_buttons[BTN_BOT_5].pushed_state = GPIO_PIN_SET;
|
bottom_buttons[BTN_BOT_5].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
for (HW_BotBtnName_t btn_key = BTN_BOT_1; btn_key < BTN_BOT_MAX; btn_key++)
|
for (HW_BotBtnName_t btn_key = BTN_BOT_1; btn_key < BTN_BOT_MAX; btn_key++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "hw_button.h"
|
#include "hw_button.h"
|
||||||
#include "ctrl_channel_button.h"
|
#include "ctrl_channel_button.h"
|
||||||
|
|
||||||
#define DUMMY_GPIO_Port GPIOA
|
#define DUMMY_GPIO_Port B1_GPIO_Port
|
||||||
#define DUMMY_GPIO_Pin GPIO_PIN_0
|
#define DUMMY_GPIO_Pin B1_Pin
|
||||||
|
|
||||||
static ButtonKey_t channel_buttons[BTN_CH_MAX];
|
static ButtonKey_t channel_buttons[BTN_CH_MAX];
|
||||||
|
|
||||||
@@ -11,39 +11,40 @@ void CTRL_channelButtonInit(void)
|
|||||||
{
|
{
|
||||||
channel_buttons[BTN_CH_1].instance = BTN_CH_1;
|
channel_buttons[BTN_CH_1].instance = BTN_CH_1;
|
||||||
channel_buttons[BTN_CH_1].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_1].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_1].gpio_port = DUMMY_GPIO_Port;
|
channel_buttons[BTN_CH_1].buttonLongPressed = CTRL_longPushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_1].gpio_pin = DUMMY_GPIO_Pin;
|
channel_buttons[BTN_CH_1].gpio_port = BTN_CH1_GPIO_Port;
|
||||||
channel_buttons[BTN_CH_1].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_1].gpio_pin = BTN_CH1_Pin;
|
||||||
|
channel_buttons[BTN_CH_1].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
channel_buttons[BTN_CH_2].instance = BTN_CH_2;
|
channel_buttons[BTN_CH_2].instance = BTN_CH_2;
|
||||||
channel_buttons[BTN_CH_2].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_2].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_2].gpio_port = DUMMY_GPIO_Port;
|
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].gpio_pin = DUMMY_GPIO_Pin;
|
||||||
channel_buttons[BTN_CH_2].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_2].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
channel_buttons[BTN_CH_3].instance = BTN_CH_3;
|
channel_buttons[BTN_CH_3].instance = BTN_CH_3;
|
||||||
channel_buttons[BTN_CH_3].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_3].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_3].gpio_port = DUMMY_GPIO_Port;
|
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].gpio_pin = DUMMY_GPIO_Pin;
|
||||||
channel_buttons[BTN_CH_3].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_3].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
channel_buttons[BTN_CH_4].instance = BTN_CH_4;
|
channel_buttons[BTN_CH_4].instance = BTN_CH_4;
|
||||||
channel_buttons[BTN_CH_4].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_4].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_4].gpio_port = DUMMY_GPIO_Port;
|
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].gpio_pin = DUMMY_GPIO_Pin;
|
||||||
channel_buttons[BTN_CH_4].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_4].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
channel_buttons[BTN_CH_5].instance = BTN_CH_5;
|
channel_buttons[BTN_CH_5].instance = BTN_CH_5;
|
||||||
channel_buttons[BTN_CH_5].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_5].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_5].gpio_port = DUMMY_GPIO_Port;
|
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].gpio_pin = DUMMY_GPIO_Pin;
|
||||||
channel_buttons[BTN_CH_5].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_5].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
channel_buttons[BTN_CH_6].instance = BTN_CH_6;
|
channel_buttons[BTN_CH_6].instance = BTN_CH_6;
|
||||||
channel_buttons[BTN_CH_6].buttonPressed = CTRL_pushedChanBtnEvent;
|
channel_buttons[BTN_CH_6].buttonPressed = CTRL_pushedChanBtnEvent;
|
||||||
channel_buttons[BTN_CH_6].gpio_port = DUMMY_GPIO_Port;
|
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].gpio_pin = DUMMY_GPIO_Pin;
|
||||||
channel_buttons[BTN_CH_6].pushed_state = GPIO_PIN_SET;
|
channel_buttons[BTN_CH_6].pushed_state = GPIO_PIN_RESET;
|
||||||
|
|
||||||
for (HW_chanBtnName_t btn_key = BTN_CH_1; btn_key < BTN_CH_MAX; btn_key++)
|
for (HW_chanBtnName_t btn_key = BTN_CH_1; btn_key < BTN_CH_MAX; btn_key++)
|
||||||
{
|
{
|
||||||
@@ -63,6 +64,11 @@ void CTRL_channelButtonsHandler(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__weak void CTRL_pushedChanBtnEvent(ButtonKey_t *key)
|
__weak void CTRL_pushedChanBtnEvent(ButtonKey_t *key)
|
||||||
|
{
|
||||||
|
UNUSED(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void CTRL_longPushedChanBtnEvent(ButtonKey_t *key)
|
||||||
{
|
{
|
||||||
UNUSED(key);
|
UNUSED(key);
|
||||||
}
|
}
|
||||||
@@ -13,4 +13,5 @@ typedef enum
|
|||||||
|
|
||||||
void CTRL_channelButtonInit(void);
|
void CTRL_channelButtonInit(void);
|
||||||
void CTRL_channelButtonsHandler(void);
|
void CTRL_channelButtonsHandler(void);
|
||||||
void CTRL_pushedChanBtnEvent(ButtonKey_t *key);
|
void CTRL_pushedChanBtnEvent(ButtonKey_t *key);
|
||||||
|
void CTRL_longPushedChanBtnEvent(ButtonKey_t *key);
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "ctrl_app_types.h"
|
#include "ctrl_app_types.h"
|
||||||
#include "ctrl_app.h"
|
|
||||||
#include "ad9833.h"
|
#include "ad9833.h"
|
||||||
#include "ltc2631.h"
|
#include "ltc2631.h"
|
||||||
#include "mcp41x.h"
|
#include "mcp41x.h"
|
||||||
@@ -47,35 +46,35 @@ PWM_handle_t pwm_gen[PWM_CHAN_MAX];
|
|||||||
|
|
||||||
uint8_t ch_to_gen_ch[CHANNEL_MAX] = {FG_CHAN1, FG_CHAN2, FG_CHAN3, PWM_CHAN1, PWM_CHAN2, PWM_CHAN3};
|
uint8_t ch_to_gen_ch[CHANNEL_MAX] = {FG_CHAN1, FG_CHAN2, FG_CHAN3, PWM_CHAN1, PWM_CHAN2, PWM_CHAN3};
|
||||||
|
|
||||||
#define DDS1_CS_PORT GPIOC
|
// #define DDS1_CS_PORT GPIOC
|
||||||
#define DDS2_CS_PORT GPIOC
|
// #define DDS2_CS_PORT GPIOC
|
||||||
#define DDS3_CS_PORT GPIOC
|
// #define DDS3_CS_PORT GPIOC
|
||||||
|
|
||||||
#define DDS1_CS_PIN GPIO_PIN_0
|
// #define DDS1_CS_PIN GPIO_PIN_0
|
||||||
#define DDS2_CS_PIN GPIO_PIN_0
|
// #define DDS2_CS_PIN GPIO_PIN_0
|
||||||
#define DDS3_CS_PIN GPIO_PIN_0
|
// #define DDS3_CS_PIN GPIO_PIN_0
|
||||||
|
|
||||||
#define AMP1_CS_PORT GPIOC
|
// #define AMP1_CS_PORT GPIOC
|
||||||
#define AMP2_CS_PORT GPIOC
|
// #define AMP2_CS_PORT GPIOC
|
||||||
#define AMP3_CS_PORT GPIOC
|
// #define AMP3_CS_PORT GPIOC
|
||||||
|
|
||||||
#define AMP1_CS_PIN GPIO_PIN_0
|
// #define AMP1_CS_PIN GPIO_PIN_0
|
||||||
#define AMP2_CS_PIN GPIO_PIN_0
|
// #define AMP2_CS_PIN GPIO_PIN_0
|
||||||
#define AMP3_CS_PIN GPIO_PIN_0
|
// #define AMP3_CS_PIN GPIO_PIN_0
|
||||||
|
|
||||||
void gen_init()
|
void gen_init()
|
||||||
{
|
{
|
||||||
ad9833_init(&dds_gen[FG_CHAN1].hdds, &hspi2, DDS1_CS_PORT, DDS1_CS_PIN);
|
ad9833_init(&dds_gen[FG_CHAN1].hdds, &hspi2, DDS1_CS_GPIO_Port, DDS1_CS_Pin);
|
||||||
ad9833_init(&dds_gen[FG_CHAN2].hdds, &hspi2, DDS2_CS_PORT, DDS2_CS_PIN);
|
// ad9833_init(&dds_gen[FG_CHAN2].hdds, &hspi2, DDS2_CS_PORT, DDS2_CS_PIN);
|
||||||
ad9833_init(&dds_gen[FG_CHAN3].hdds, &hspi2, DDS3_CS_PORT, DDS3_CS_PIN);
|
// ad9833_init(&dds_gen[FG_CHAN3].hdds, &hspi2, DDS3_CS_PORT, DDS3_CS_PIN);
|
||||||
|
|
||||||
ltc2631_init(&dds_gen[FG_CHAN1].hoffs, &hi2c1, 0x00, LTC2631_8BIT, LTC_REF_2V5);
|
// ltc2631_init(&dds_gen[FG_CHAN1].hoffs, &hi2c1, 0x00, LTC2631_8BIT, LTC_REF_2V5);
|
||||||
ltc2631_init(&dds_gen[FG_CHAN2].hoffs, &hi2c1, 0x01, LTC2631_8BIT, LTC_REF_2V5);
|
// ltc2631_init(&dds_gen[FG_CHAN2].hoffs, &hi2c1, 0x01, LTC2631_8BIT, LTC_REF_2V5);
|
||||||
ltc2631_init(&dds_gen[FG_CHAN3].hoffs, &hi2c1, 0x02, LTC2631_8BIT, LTC_REF_2V5);
|
// ltc2631_init(&dds_gen[FG_CHAN3].hoffs, &hi2c1, 0x02, LTC2631_8BIT, LTC_REF_2V5);
|
||||||
|
|
||||||
mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP1_CS_PORT, AMP1_CS_PIN, MCP41X_10K);
|
mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP1_CS_GPIO_Port, AMP1_CS_Pin, MCP41X_10K);
|
||||||
mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP2_CS_PORT, AMP2_CS_PIN, MCP41X_10K);
|
// mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP2_CS_PORT, AMP2_CS_PIN, MCP41X_10K);
|
||||||
mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP3_CS_PORT, AMP3_CS_PIN, MCP41X_10K);
|
// mcp41x_init(&dds_gen[FG_CHAN1].hampl, &hspi2, AMP3_CS_PORT, AMP3_CS_PIN, MCP41X_10K);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _setAmpliude(mcp41x_handle_t *hampl, uint16_t ampl_x100)
|
static void _setAmpliude(mcp41x_handle_t *hampl, uint16_t ampl_x100)
|
||||||
|
|||||||
@@ -1 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "ctrl_app.h"
|
||||||
|
|
||||||
|
void setLink(GENERATOR_t *source_gen, GEN_channel_t source_ch, GENERATOR_t *dest_gen, GEN_channel_t dest_ch);
|
||||||
|
void setEnabled(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setDuty(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setWave(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setPhase(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setOfsset(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setAmplitude(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void setFreq(GENERATOR_t *gen, GEN_channel_t channel);
|
||||||
|
void gen_init();
|
||||||
@@ -249,7 +249,7 @@ static void _drawOffsetLine(GFX_display_t *disp, int16_t offs, uint32_t ampl)
|
|||||||
vert_shift = MIN(vert_shift, 20);
|
vert_shift = MIN(vert_shift, 20);
|
||||||
vert_shift = MAX(vert_shift, -19);
|
vert_shift = MAX(vert_shift, -19);
|
||||||
|
|
||||||
ULOG_TRACE("<OFFSLINE> shift: %i", vert_shift);
|
// ULOG_DEBUG("<OFFSLINE> shift: %i", vert_shift);
|
||||||
DISP_drawHorizontalLine(disp, 2, 31 + vert_shift, 57, GFX_WHITE);
|
DISP_drawHorizontalLine(disp, 2, 31 + vert_shift, 57, GFX_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user