samv7/pwm: set number of channels based on configuration options
Number of channels are now set based on enabled channels in configuration instead of the usage of static 4. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
parent
701e56d4ae
commit
bdcf8b2b66
@ -147,7 +147,7 @@ static struct sam_pwm_s g_pwm0 =
|
||||
{
|
||||
.ops = &g_pwmops,
|
||||
.channels = g_pwm0_channels,
|
||||
.channels_num = 4,
|
||||
.channels_num = PWM0_NCHANNELS,
|
||||
.frequency = 0,
|
||||
.base = SAM_PWM0_BASE,
|
||||
};
|
||||
@ -191,7 +191,7 @@ static struct sam_pwm_s g_pwm1 =
|
||||
{
|
||||
.ops = &g_pwmops,
|
||||
.channels = g_pwm1_channels,
|
||||
.channels_num = 4,
|
||||
.channels_num = PWM1_NCHANNELS,
|
||||
.frequency = 0,
|
||||
.base = SAM_PWM1_BASE,
|
||||
};
|
||||
|
@ -36,6 +36,60 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM0_CH0
|
||||
#define PWM0_CH0 1
|
||||
#else
|
||||
#define PWM0_CH0 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM0_CH1
|
||||
#define PWM0_CH1 1
|
||||
#else
|
||||
#define PWM0_CH1 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM0_CH2
|
||||
#define PWM0_CH2 1
|
||||
#else
|
||||
#define PWM0_CH2 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM0_CH3
|
||||
#define PWM0_CH3 1
|
||||
#else
|
||||
#define PWM0_CH3 0
|
||||
#endif
|
||||
|
||||
#define PWM0_NCHANNELS (PWM0_CH0 + PWM0_CH1 + \
|
||||
PWM0_CH2 + PWM0_CH3)
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM1_CH0
|
||||
#define PWM1_CH0 1
|
||||
#else
|
||||
#define PWM1_CH0 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM1_CH1
|
||||
#define PWM1_CH1 1
|
||||
#else
|
||||
#define PWM1_CH1 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM1_CH2
|
||||
#define PWM1_CH2 1
|
||||
#else
|
||||
#define PWM1_CH2 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_PWM1_CH3
|
||||
#define PWM1_CH3 1
|
||||
#else
|
||||
#define PWM1_CH3 0
|
||||
#endif
|
||||
|
||||
#define PWM1_NCHANNELS (PWM1_CH0 + PWM1_CH1 + \
|
||||
PWM1_CH2 + PWM1_CH3)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user