mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
Complete px4fmu-v5 Led configuration
This commit is contained in:
committed by
Lorenz Meier
parent
3f64bf81f3
commit
4712ed1889
@@ -17,7 +17,7 @@ set(config_module_list
|
||||
drivers/led
|
||||
drivers/px4fmu
|
||||
drivers/boards/px4fmu-v5
|
||||
drivers/rgbled
|
||||
drivers/rgbled_pwm
|
||||
drivers/mpu6000
|
||||
drivers/mpu9250
|
||||
drivers/hmc5883
|
||||
|
||||
@@ -494,7 +494,7 @@ CONFIG_ARCH_BOARD="px4fmu-v5"
|
||||
# Common Board Options
|
||||
#
|
||||
CONFIG_ARCH_HAVE_LEDS=y
|
||||
CONFIG_ARCH_LEDS=y
|
||||
CONFIG_ARCH_LEDS=n
|
||||
CONFIG_ARCH_HAVE_BUTTONS=y
|
||||
# CONFIG_ARCH_BUTTONS is not set
|
||||
CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
||||
|
||||
@@ -248,6 +248,18 @@ __BEGIN_DECLS
|
||||
|
||||
#define DIRECT_INPUT_TIMER_CHANNELS 6
|
||||
|
||||
#define BOARD_HAS_LED_PWM
|
||||
#define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1
|
||||
|
||||
#define LED_TIM3_CH1OUT /* PC6 T3C1 GREEN */ GPIO_TIM3_CH1OUT_3
|
||||
#define LED_TIM3_CH2OUT /* PC7 T3C2 BLUE */ GPIO_TIM3_CH2OUT_3
|
||||
#define LED_TIM3_CH4OUT /* PB1 T3C4 RED */ GPIO_TIM3_CH4OUT_1
|
||||
|
||||
#define LED_TIM5_CH1OUT /* PH10 T5C1 RED */ GPIO_TIM5_CH1OUT_2
|
||||
#define LED_TIM5_CH2OUT /* PH11 T5C2 GREEN */ GPIO_TIM5_CH2OUT_2
|
||||
#define LED_TIM5_CH3OUT /* PH12 T5C3 BLUE */ GPIO_TIM5_CH3OUT_2
|
||||
|
||||
|
||||
/* User GPIOs
|
||||
*
|
||||
* GPIO0-5 are the PWM servo outputs.
|
||||
|
||||
@@ -77,7 +77,7 @@ static uint32_t g_ledmap[] = {
|
||||
|
||||
#else
|
||||
|
||||
# define xlat(p)
|
||||
# define xlat(p) (p)
|
||||
static uint32_t g_ledmap[] = {
|
||||
GPIO_LED_BLUE, // Indexed by LED_BLUE
|
||||
GPIO_LED_RED, // Indexed by LED_RED, LED_AMBER
|
||||
@@ -97,9 +97,9 @@ __EXPORT void led_init(void)
|
||||
|
||||
static void phy_set_led(int led, bool state)
|
||||
{
|
||||
/* Drive High to switch on */
|
||||
/* Drive Low to switch on */
|
||||
|
||||
stm32_gpiowrite(g_ledmap[led], state);
|
||||
stm32_gpiowrite(g_ledmap[led], !state);
|
||||
}
|
||||
|
||||
static bool phy_get_led(int led)
|
||||
|
||||
@@ -124,3 +124,63 @@ __EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
.masks = GTIM_SR_CC3IF | GTIM_SR_CC3OF
|
||||
}
|
||||
};
|
||||
|
||||
__EXPORT const struct io_timers_t led_pwm_timers[MAX_LED_TIMERS] = {
|
||||
{
|
||||
.base = STM32_TIM3_BASE,
|
||||
.clock_register = STM32_RCC_APB1ENR,
|
||||
.clock_bit = RCC_APB1ENR_TIM3EN,
|
||||
.clock_freq = STM32_APB1_TIM3_CLKIN,
|
||||
.vectorno = 0,
|
||||
.first_channel_index = 0,
|
||||
.last_channel_index = 2,
|
||||
},
|
||||
{
|
||||
.base = STM32_TIM5_BASE,
|
||||
.clock_register = STM32_RCC_APB1ENR,
|
||||
.clock_bit = RCC_APB1ENR_TIM5EN,
|
||||
.clock_freq = STM32_APB1_TIM5_CLKIN,
|
||||
.vectorno = 0,
|
||||
.first_channel_index = 3,
|
||||
.last_channel_index = 5,
|
||||
}
|
||||
};
|
||||
|
||||
__EXPORT const struct timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = {
|
||||
{
|
||||
.gpio_out = LED_TIM3_CH4OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 0,
|
||||
.timer_channel = 4,
|
||||
},
|
||||
{
|
||||
.gpio_out = LED_TIM3_CH1OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 0,
|
||||
.timer_channel = 1,
|
||||
},
|
||||
{
|
||||
.gpio_out = LED_TIM3_CH2OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 0,
|
||||
.timer_channel = 2,
|
||||
},
|
||||
{
|
||||
.gpio_out = LED_TIM5_CH1OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 1,
|
||||
.timer_channel = 1,
|
||||
},
|
||||
{
|
||||
.gpio_out = LED_TIM5_CH2OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 1,
|
||||
.timer_channel = 2,
|
||||
},
|
||||
{
|
||||
.gpio_out = LED_TIM5_CH3OUT,
|
||||
.gpio_in = 0,
|
||||
.timer_index = 1,
|
||||
.timer_channel = 3,
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user