snickerdoodle Platform Controller
firmware for STM32F0 platform controller
PWM Functions

Functions

void sd_tim1_init (void)
 Timer 1 Initialization.
 
void sd_tim3_init (void)
 Timer 3 Initialization.
 
void HAL_TIM_PWM_MspInit (TIM_HandleTypeDef *htim_pwm)
 
void HAL_TIM_PWM_MspDeInit (TIM_HandleTypeDef *htim_pwm)
 

Detailed Description

Function Documentation

◆ HAL_TIM_PWM_MspDeInit()

void HAL_TIM_PWM_MspDeInit ( TIM_HandleTypeDef *  htim_pwm)

#include <Src/sd_pwm.c>

TIM1 GPIO Configuration

Pin/Port Channel LED -------——
PA8 Channel 1 fault_led

TIM3 GPIO Configuration

Pin/Port Channel LED ----------—
PC6 Channel 1 usb_led
PC7 Channel 2 bluetooth_led
PC8 Channel 3 app_led
PC9 Channel 4 wireless_led
246 {
247  if (htim_pwm->Instance == TIM1) {
248  /* Peripheral clock disable */
249  __TIM1_CLK_DISABLE();
250 
258  HAL_GPIO_DeInit(RED_GPIO_Port, RED_Pin);
259  } else if (htim_pwm->Instance == TIM3) {
260  /* Peripheral clock disable */
261  __TIM3_CLK_DISABLE();
262 
273  HAL_GPIO_DeInit(GPIOC, ORANGE_Pin | WHITE_Pin | BLUE_Pin | GREEN_Pin);
274  }
275 }

◆ HAL_TIM_PWM_MspInit()

void HAL_TIM_PWM_MspInit ( TIM_HandleTypeDef *  htim_pwm)

#include <Src/sd_pwm.c>

TIM1 GPIO Configuration

Pin/Port Channel LED -------——
PA8 Channel 1 fault_led

TIM3 GPIO Configuration

Pin/Port Channel LED ----------—
PC6 Channel 1 usb_led
PC7 Channel 2 bluetooth_led
PC8 Channel 3 app_led
PC9 Channel 4 wireless_led
177 {
178  GPIO_InitTypeDef GPIO_InitStruct;
179  if (htim_pwm->Instance==TIM1) {
180  /* Peripheral clock enable */
181  __TIM1_CLK_ENABLE();
182 
190  GPIO_InitStruct.Pin = RED_Pin;
191  GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
192  GPIO_InitStruct.Pull = GPIO_NOPULL;
193  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
194  GPIO_InitStruct.Alternate = GPIO_AF2_TIM1;
195  HAL_GPIO_Init(RED_GPIO_Port, &GPIO_InitStruct);
196 
197  fault_led.tim = htim_pwm;
198  fault_led.chan = TIM_CHANNEL_1;
199  fault_led.cfg = &fault_cfg;
200 
201  } else if (htim_pwm->Instance==TIM3) {
202  /* Peripheral clock enable */
203  __TIM3_CLK_ENABLE();
204 
215  GPIO_InitStruct.Pin = ORANGE_Pin |
216  WHITE_Pin |
217  BLUE_Pin |
218  GREEN_Pin;
219 
220  GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
221  GPIO_InitStruct.Pull = GPIO_NOPULL;
222  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
223  GPIO_InitStruct.Alternate = GPIO_AF0_TIM3;
224  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
225 
226  usb_led.tim = htim_pwm;
227  usb_led.chan = TIM_CHANNEL_1;
228  usb_led.cfg = &usb_cfg;
229 
230  bluetooth_led.tim = htim_pwm;
231  bluetooth_led.chan = TIM_CHANNEL_2;
232  bluetooth_led.cfg = &bluetooth_cfg;
233 
234  app_led.tim = htim_pwm;
235  app_led.chan = TIM_CHANNEL_3;
236  app_led.cfg = &app_cfg;
237 
238  wireless_led.tim = htim_pwm;
239  wireless_led.chan = TIM_CHANNEL_4;
240  wireless_led.cfg = &wireless_cfg;
241  }
242 }
struct sd_led wireless_led
Definition: sd_led.c:68
struct sd_led usb_led
Definition: sd_led.c:65
struct sd_led fault_led
Definition: sd_led.c:64
uint32_t chan
Definition: sd_led.h:102
TIM_HandleTypeDef * tim
Definition: sd_led.h:100
struct sd_led app_led
Definition: sd_led.c:67
struct sd_led bluetooth_led
Definition: sd_led.c:66
TIM_OC_InitTypeDef * cfg
Definition: sd_led.h:101