LED PWM WIP
This commit is contained in:
parent
4536d4003f
commit
464dbc78e4
@ -1,5 +1,5 @@
|
|||||||
[PreviousLibFiles]
|
[PreviousLibFiles]
|
||||||
LibFiles=Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm3.h;
|
LibFiles=Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/mpu_armv7.h;
|
||||||
|
|
||||||
[PreviousUsedCubeIDEFiles]
|
[PreviousUsedCubeIDEFiles]
|
||||||
SourceFiles=Core/Src/main.c;Core/Src/stm32l0xx_it.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;;;
|
SourceFiles=Core/Src/main.c;Core/Src/stm32l0xx_it.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;;;
|
||||||
@ -9,16 +9,16 @@ CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTU
|
|||||||
[PreviousGenFiles]
|
[PreviousGenFiles]
|
||||||
AdvancedFolderStructure=true
|
AdvancedFolderStructure=true
|
||||||
HeaderFileListSize=3
|
HeaderFileListSize=3
|
||||||
HeaderFiles#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/stm32l0xx_it.h
|
HeaderFiles#0=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Inc/stm32l0xx_it.h
|
||||||
HeaderFiles#1=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/stm32_assert.h
|
HeaderFiles#1=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Inc/stm32_assert.h
|
||||||
HeaderFiles#2=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/main.h
|
HeaderFiles#2=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Inc/main.h
|
||||||
HeaderFolderListSize=1
|
HeaderFolderListSize=1
|
||||||
HeaderPath#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc
|
HeaderPath#0=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Inc
|
||||||
HeaderFiles=;
|
HeaderFiles=;
|
||||||
SourceFileListSize=2
|
SourceFileListSize=2
|
||||||
SourceFiles#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src/stm32l0xx_it.c
|
SourceFiles#0=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Src/stm32l0xx_it.c
|
||||||
SourceFiles#1=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src/main.c
|
SourceFiles#1=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Src/main.c
|
||||||
SourceFolderListSize=1
|
SourceFolderListSize=1
|
||||||
SourcePath#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src
|
SourcePath#0=/home/dooku/projekty/hdiot/iaq_wired_sensor/fw/Core/Src
|
||||||
SourceFiles=;
|
SourceFiles=;
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
#define RGBLED_OK 0
|
#define RGBLED_OK 0
|
||||||
#define RGBLED_ERROR -1 // generic error
|
#define RGBLED_ERROR -1 // generic error
|
||||||
|
|
||||||
|
#define RGBLED_PRESCALER 0
|
||||||
|
#define RGBLED_PERIOD 255
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Type definitions
|
* Type definitions
|
||||||
*/
|
*/
|
||||||
@ -26,6 +29,7 @@ typedef struct {
|
|||||||
// tim2 ch1 B
|
// tim2 ch1 B
|
||||||
// tim22 ch1 G
|
// tim22 ch1 G
|
||||||
// tim22 ch2 R
|
// tim22 ch2 R
|
||||||
|
// TODO union, aby se dalo nastavovat LED v cyklu (set_color)
|
||||||
TIM_TypeDef *timer_R;
|
TIM_TypeDef *timer_R;
|
||||||
TIM_TypeDef *timer_G;
|
TIM_TypeDef *timer_G;
|
||||||
TIM_TypeDef *timer_B;
|
TIM_TypeDef *timer_B;
|
||||||
|
@ -220,11 +220,12 @@ int main(void)
|
|||||||
rgbled_context.timer_R = TIM22;
|
rgbled_context.timer_R = TIM22;
|
||||||
rgbled_context.timer_G = TIM22;
|
rgbled_context.timer_G = TIM22;
|
||||||
rgbled_context.timer_B = TIM2;
|
rgbled_context.timer_B = TIM2;
|
||||||
|
rgbled_context.channel_R = 2;
|
||||||
|
rgbled_context.channel_G = 1;
|
||||||
|
rgbled_context.channel_B = 1;
|
||||||
rgbled_init(&rgbled_context);
|
rgbled_init(&rgbled_context);
|
||||||
|
|
||||||
LL_TIM_OC_SetCompareCH1(TIM2, 0); // B
|
rgbled_set_color(255, 0, 0);
|
||||||
LL_TIM_OC_SetCompareCH1(TIM22, 65535); // G
|
|
||||||
LL_TIM_OC_SetCompareCH2(TIM22, 65535); // R
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// rgbled_set_color(30000, 0, 0);
|
// rgbled_set_color(30000, 0, 0);
|
||||||
@ -513,9 +514,9 @@ static void MX_TIM2_Init(void)
|
|||||||
/* USER CODE BEGIN TIM2_Init 1 */
|
/* USER CODE BEGIN TIM2_Init 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM2_Init 1 */
|
/* USER CODE END TIM2_Init 1 */
|
||||||
TIM_InitStruct.Prescaler = 0;
|
TIM_InitStruct.Prescaler = RGBLED_PRESCALER;
|
||||||
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
TIM_InitStruct.Autoreload = 65535;
|
TIM_InitStruct.Autoreload = RGBLED_PERIOD;
|
||||||
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
||||||
LL_TIM_Init(TIM2, &TIM_InitStruct);
|
LL_TIM_Init(TIM2, &TIM_InitStruct);
|
||||||
LL_TIM_DisableARRPreload(TIM2);
|
LL_TIM_DisableARRPreload(TIM2);
|
||||||
@ -607,21 +608,20 @@ static void MX_TIM22_Init(void)
|
|||||||
/* USER CODE BEGIN TIM22_Init 1 */
|
/* USER CODE BEGIN TIM22_Init 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM22_Init 1 */
|
/* USER CODE END TIM22_Init 1 */
|
||||||
TIM_InitStruct.Prescaler = 0;
|
TIM_InitStruct.Prescaler = RGBLED_PRESCALER;
|
||||||
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
|
||||||
TIM_InitStruct.Autoreload = 65535;
|
TIM_InitStruct.Autoreload = RGBLED_PERIOD;
|
||||||
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
|
||||||
LL_TIM_Init(TIM22, &TIM_InitStruct);
|
LL_TIM_Init(TIM22, &TIM_InitStruct);
|
||||||
LL_TIM_DisableARRPreload(TIM22);
|
LL_TIM_DisableARRPreload(TIM22);
|
||||||
LL_TIM_OC_EnablePreload(TIM22, LL_TIM_CHANNEL_CH1);
|
LL_TIM_OC_EnablePreload(TIM22, LL_TIM_CHANNEL_CH1);
|
||||||
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
|
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
|
||||||
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
|
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;
|
||||||
TIM_OC_InitStruct.CompareValue = 32768;
|
TIM_OC_InitStruct.CompareValue = 0;
|
||||||
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
|
TIM_OC_InitStruct.OCPolarity = LL_TIM_OCPOLARITY_HIGH;
|
||||||
LL_TIM_OC_Init(TIM22, LL_TIM_CHANNEL_CH1, &TIM_OC_InitStruct);
|
LL_TIM_OC_Init(TIM22, LL_TIM_CHANNEL_CH1, &TIM_OC_InitStruct);
|
||||||
LL_TIM_OC_DisableFast(TIM22, LL_TIM_CHANNEL_CH1);
|
LL_TIM_OC_DisableFast(TIM22, LL_TIM_CHANNEL_CH1);
|
||||||
LL_TIM_OC_EnablePreload(TIM22, LL_TIM_CHANNEL_CH2);
|
LL_TIM_OC_EnablePreload(TIM22, LL_TIM_CHANNEL_CH2);
|
||||||
TIM_OC_InitStruct.CompareValue = 0;
|
|
||||||
LL_TIM_OC_Init(TIM22, LL_TIM_CHANNEL_CH2, &TIM_OC_InitStruct);
|
LL_TIM_OC_Init(TIM22, LL_TIM_CHANNEL_CH2, &TIM_OC_InitStruct);
|
||||||
LL_TIM_OC_DisableFast(TIM22, LL_TIM_CHANNEL_CH2);
|
LL_TIM_OC_DisableFast(TIM22, LL_TIM_CHANNEL_CH2);
|
||||||
LL_TIM_SetTriggerOutput(TIM22, LL_TIM_TRGO_RESET);
|
LL_TIM_SetTriggerOutput(TIM22, LL_TIM_TRGO_RESET);
|
||||||
|
@ -25,9 +25,18 @@ int8_t rgbled_set_color(uint16_t R, uint16_t G, uint16_t B)
|
|||||||
// tim2 ch1 B
|
// tim2 ch1 B
|
||||||
// tim22 ch1 G
|
// tim22 ch1 G
|
||||||
// tim22 ch2 R
|
// tim22 ch2 R
|
||||||
LL_TIM_OC_SetCompareCH1(TIM2, (uint32_t)B); // B
|
if (
|
||||||
LL_TIM_OC_SetCompareCH1(TIM22, (uint32_t)G); // G
|
R > RGBLED_PERIOD || \
|
||||||
LL_TIM_OC_SetCompareCH2(TIM22, (uint32_t)R); // R
|
G > RGBLED_PERIOD || \
|
||||||
|
B > RGBLED_PERIOD)
|
||||||
|
{
|
||||||
|
return RGBLED_ERROR;
|
||||||
|
}
|
||||||
|
LL_TIM_OC_SetCompareCH1(rgbled_context->timer_B, (uint32_t)(RGBLED_PERIOD - B)); // B
|
||||||
|
LL_TIM_OC_SetCompareCH1(rgbled_context->timer_G, (uint32_t)(RGBLED_PERIOD - G)); // G
|
||||||
|
LL_TIM_OC_SetCompareCH2(rgbled_context->timer_R, (uint32_t)(RGBLED_PERIOD - R)); // R
|
||||||
|
|
||||||
|
return RGBLED_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t rgbled_off(void)
|
int8_t rgbled_off(void)
|
||||||
|
@ -133,7 +133,10 @@ SH.S_TIM22_CH2.ConfNb=1
|
|||||||
SH.S_TIM2_CH1.0=TIM2_CH1,PWM Generation1 CH1
|
SH.S_TIM2_CH1.0=TIM2_CH1,PWM Generation1 CH1
|
||||||
SH.S_TIM2_CH1.ConfNb=1
|
SH.S_TIM2_CH1.ConfNb=1
|
||||||
TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM2.IPParameters=Channel-PWM Generation1 CH1
|
TIM2.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period
|
||||||
|
TIM2.IPParametersWithoutCheck=Prescaler,Period
|
||||||
|
TIM2.Period=RGBLED_PERIOD
|
||||||
|
TIM2.Prescaler=RGBLED_PRESCALER
|
||||||
TIM21.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
TIM21.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
||||||
TIM21.IPParameters=Prescaler,Period,AutoReloadPreload
|
TIM21.IPParameters=Prescaler,Period,AutoReloadPreload
|
||||||
TIM21.IPParametersWithoutCheck=Prescaler,Period
|
TIM21.IPParametersWithoutCheck=Prescaler,Period
|
||||||
@ -141,8 +144,11 @@ TIM21.Period=tim21_period
|
|||||||
TIM21.Prescaler=tim21_prescaler
|
TIM21.Prescaler=tim21_prescaler
|
||||||
TIM22.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
TIM22.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM22.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
TIM22.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||||
TIM22.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Pulse-PWM Generation1 CH1
|
TIM22.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Pulse-PWM Generation1 CH1,Period,Prescaler
|
||||||
TIM22.Pulse-PWM\ Generation1\ CH1=32768
|
TIM22.IPParametersWithoutCheck=Prescaler,Period
|
||||||
|
TIM22.Period=RGBLED_PERIOD
|
||||||
|
TIM22.Prescaler=RGBLED_PRESCALER
|
||||||
|
TIM22.Pulse-PWM\ Generation1\ CH1=0
|
||||||
USART2.BaudRate=config_baudrates[sensor_config.baudrate_index]
|
USART2.BaudRate=config_baudrates[sensor_config.baudrate_index]
|
||||||
USART2.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485),BaudRate,WordLength,Parity
|
USART2.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485),BaudRate,WordLength,Parity
|
||||||
USART2.IPParametersWithoutCheck=BaudRate
|
USART2.IPParametersWithoutCheck=BaudRate
|
||||||
|
Loading…
Reference in New Issue
Block a user