mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
RGB LED cleanup
Removed dead code and magic numbers Defined the RGB LED to support 2 timers
This commit is contained in:
committed by
Lorenz Meier
parent
a81aceea58
commit
3f64bf81f3
@@ -59,7 +59,7 @@ __EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = { };
|
||||
__EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { };
|
||||
|
||||
// Invalidate all timers (base == 0): we don't have any
|
||||
__EXPORT const struct io_timers_t led_pwm_timers[1] = { };
|
||||
__EXPORT const struct io_timers_t led_pwm_timers[MAX_LED_TIMERS] = { };
|
||||
|
||||
// Invalidate all channels (timer_channel == 0): we don't have any
|
||||
__EXPORT const struct timer_io_channels_t led_pwm_channels[3] = { };
|
||||
__EXPORT const struct timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = { };
|
||||
|
||||
@@ -176,12 +176,6 @@
|
||||
#define GPIO_GPIO6_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN14)
|
||||
#define GPIO_GPIO7_OUTPUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN15)
|
||||
|
||||
// #define BOARD_HAS_LED_PWM
|
||||
// #define BOARD_LED_PWM_DRIVE_ACTIVE_LOW
|
||||
// #define LED_TIM3_CH3OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OPENDRAIN|GPIO_PORTB|GPIO_PIN0)
|
||||
// #define LED_TIM3_CH2OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OPENDRAIN|GPIO_PORTC|GPIO_PIN7)
|
||||
// #define LED_TIM3_CH4OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OPENDRAIN|GPIO_PORTB|GPIO_PIN1)
|
||||
|
||||
/* Power supply control and monitoring GPIOs */
|
||||
// #define GPIO_VDD_5V_PERIPH_EN (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN8)
|
||||
// #define GPIO_VDD_BRICK_VALID (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5)
|
||||
|
||||
@@ -139,33 +139,3 @@ __EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
.masks = GTIM_SR_CC4IF | GTIM_SR_CC4OF
|
||||
}
|
||||
};
|
||||
|
||||
// __EXPORT const struct io_timers_t led_pwm_timers[1] = {
|
||||
// {
|
||||
// .base = STM32_TIM3_BASE,
|
||||
// .clock_register = STM32_RCC_APB1ENR,
|
||||
// .clock_bit = RCC_APB1ENR_TIM3EN,
|
||||
// .clock_freq = STM32_APB1_TIM3_CLKIN,
|
||||
// }
|
||||
// };
|
||||
|
||||
// __EXPORT const struct timer_io_channels_t led_pwm_channels[3] = {
|
||||
// {
|
||||
// .gpio_out = LED_TIM3_CH3OUT,
|
||||
// .gpio_in = 0,
|
||||
// .timer_index = 0,
|
||||
// .timer_channel = 3,
|
||||
// },
|
||||
// {
|
||||
// .gpio_out = LED_TIM3_CH2OUT,
|
||||
// .gpio_in = 0,
|
||||
// .timer_index = 0,
|
||||
// .timer_channel = 2,
|
||||
// },
|
||||
// {
|
||||
// .gpio_out = LED_TIM3_CH4OUT,
|
||||
// .gpio_in = 0,
|
||||
// .timer_index = 0,
|
||||
// .timer_channel = 4,
|
||||
// }
|
||||
// };
|
||||
|
||||
@@ -75,7 +75,7 @@ __EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
}
|
||||
};
|
||||
|
||||
__EXPORT const struct io_timers_t led_pwm_timers[1] = {
|
||||
__EXPORT const struct io_timers_t led_pwm_timers[MAX_LED_TIMERS] = {
|
||||
{
|
||||
.base = STM32_TIM3_BASE,
|
||||
.clock_register = STM32_RCC_APB1ENR,
|
||||
@@ -87,7 +87,7 @@ __EXPORT const struct io_timers_t led_pwm_timers[1] = {
|
||||
}
|
||||
};
|
||||
|
||||
__EXPORT const struct timer_io_channels_t led_pwm_channels[3] = {
|
||||
__EXPORT const struct timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = {
|
||||
{
|
||||
.gpio_out = LED_TIM3_CH1OUT,
|
||||
.gpio_in = 0,
|
||||
|
||||
@@ -48,8 +48,8 @@ __BEGIN_DECLS
|
||||
#define MAX_IO_TIMERS 4
|
||||
#define MAX_TIMER_IO_CHANNELS 8
|
||||
|
||||
#define MAX_LED_TIMERS 1
|
||||
#define MAX_TIMER_LED_CHANNELS 3
|
||||
#define MAX_LED_TIMERS 2
|
||||
#define MAX_TIMER_LED_CHANNELS 6
|
||||
|
||||
#define IO_TIMER_ALL_MODES_CHANNELS 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user