s32k1xx:Add PWM LED Support

This commit is contained in:
David Sidrane
2020-10-12 14:54:50 -07:00
committed by David Sidrane
parent 37e711c3fd
commit 78221ee3d2
5 changed files with 76 additions and 76 deletions

View File

@@ -37,6 +37,7 @@ px4_add_board(
gps
#imu # all available imu drivers
#lights
lights/rgbled_pwm
#magnetometer # all available magnetometer drivers
#optical_flow # all available optical flow drivers
pwm_out
@@ -55,7 +56,7 @@ px4_add_board(
#esc_calib
#hardfault_log
i2cdetect
#led_control
led_control
mixer
#motor_ramp
#motor_test

View File

@@ -105,17 +105,18 @@ __BEGIN_DECLS
* Pins:
* Defined in board.h
*/
// todo:Design this!
#define DIRECT_PWM_OUTPUT_CHANNELS 1
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
#define BOARD_HAS_LED_PWM 1
#define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1
#define BOARD_HAS_SHARED_PWM_TIMERS 1
#define LED_TIM3_CH1OUT /* PTD1 RGB_R */ PIN_FTM3_CH1_1
#define LED_TIM3_CH5OUT /* PTC9 RGB_G */ PIN_FTM3_CH5_1
#define LED_TIM3_CH4OUT /* PTC8 RGB_B */ PIN_FTM3_CH4_1
#define LED_TIM0_CH0OUT /* PTD15 RGB_R */ PIN_FTM0_CH0_3
#define LED_TIM0_CH1OUT /* PTD16 RGB_G */ PIN_FTM0_CH1_3
#define LED_TIM0_CH2OUT /* PTD0 RGB_B */ PIN_FTM0_CH2_3
/****************************************************************************
* Public Types

View File

@@ -118,39 +118,33 @@ constexpr io_timers_channel_mapping_t io_timers_channel_mapping =
initIOTimerChannelMapping(io_timers, timer_io_channels);
const struct io_timers_t led_pwm_timers[MAX_LED_TIMERS] = {
// To Do: Remove or add the right definitions.
/*
{
.base = S32K1XX_FTM0_BASE,
.clock_register = S32K1XX_PCC_FTM0,
.clock_bit = PCC_CGC,
//.vectorno = 0,
},
*/
};
const struct timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = {
// To Do: Remove or add the right definitions.
/*
{
.gpio_out = LED_TIM3_CH1OUT, // RGB_R
.gpio_out = LED_TIM0_CH0OUT, // RGB_R
.gpio_in = 0,
.timer_index = 0,
.timer_channel = 1,
},
{
.gpio_out = LED_TIM0_CH1OUT, // RGB_G
.gpio_in = 0,
.timer_index = 0,
.timer_channel = 2,
},
{
.gpio_out = LED_TIM3_CH5OUT, // RGB_G
.gpio_out = LED_TIM0_CH2OUT, // RGB_B
.gpio_in = 0,
.timer_index = 0,
.timer_channel = 6,
.timer_channel = 3,
},
{
.gpio_out = LED_TIM3_CH4OUT, // RGB_B
.gpio_in = 0,
.timer_index = 0,
.timer_channel = 5,
},
*/
};
void ucans32k_timer_initialize(void)