Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • polystar/robomaster/controle/bsp
1 result
Show changes
Commits on Source (5)
......@@ -11,7 +11,6 @@
#ifndef __BSP_OLED__H
#define __BSP_OLED__H
#include "stm32f4xx.h"
#include "spi.h"
#include <stdint.h>
......
#include "tim.h"
#include "bsp_pwm.h"
void PWM_init(void){
/* Open 4 sets of PWM waves respectively */
/**TIM2 GPIO Configuration
PA8 ------> TIM2_CH1
PA9 ------> TIM2_CH2
PA10 ------> TIM2_CH3
PA11 ------> TIM2_CH4
*/
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
}
void PWM_SetDuty(TIM_HandleTypeDef *tim,uint32_t tim_channel,float duty){
switch(tim_channel){
case TIM_CHANNEL_1: tim->Instance->CCR1 = (PWM_RESOLUTION*duty) - 1;break;
case TIM_CHANNEL_2: tim->Instance->CCR2 = (PWM_RESOLUTION*duty) - 1;break;
case TIM_CHANNEL_3: tim->Instance->CCR3 = (PWM_RESOLUTION*duty) - 1;break;
case TIM_CHANNEL_4: tim->Instance->CCR4 = (PWM_RESOLUTION*duty) - 1;break;
}
}
#ifndef __BSP_PWM
#define __BSP_PWM
#include "main.h"
void PWM_SetDuty(TIM_HandleTypeDef *tim,uint32_t tim_channel,float duty);
void PWM_init(void);
#endif
# BSP
Board Support Package
\ No newline at end of file
This is our "Board Support Package" repository.
In the "Driver" folder, you will find the layer of code that interacts directly with the HAL Libraries and the DJI Boards.
In the "Device" folder, you will find a layer of code that interacts with the Driver layer, and that represents different devices in our robots' system : the OLED board, the DT7 controller, and more.
\ No newline at end of file