int countertimer_get_capture_val(uint8_t timer_num, uint8_t channel, uint32_t* val)
{
- if (channel >= MAX_CHANNELS) {
+ if (channel >= NUM_COUNTERTIMERS_CHANS) {
return -EINVAL;
}
*val = countertimers[timer_num].regs->capture_reg[channel];
/* Change the match value of a single timer channel */
int countertimer_set_match(uint8_t timer_num, uint8_t channel, uint32_t val)
{
- if (channel > NUM_COUNTERTIMERS_CHANS)
+ if (channel >= NUM_COUNTERTIMERS_CHANS)
return -EINVAL;
countertimers[timer_num].regs->match_reg[channel] = val;
break;
}
- if (conf->period_chan >= MAX_CHANNELS) {
+ if (conf->period_chan >= NUM_COUNTERTIMERS_CHANS) {
return -EINVAL;
}
/* Setup selected PWM channels */
}
if (conf->mode & LPC_TIMER_MODE_CAPTURE) {
- for (i = 0; i < MAX_CHANNELS; i++) {
+ for (i = 0; i < NUM_COUNTERTIMERS_CHANS; i++) {
timer->regs->capture_ctrl |= ((conf->cap_control[i] & 0x07) << LPC_TIMER_CAPTURE_SHIFT(i));
}
}
if (conf->mode & LPC_TIMER_MODE_MATCH) {
- for (i = 0; i < MAX_CHANNELS; i++) {
+ for (i = 0; i < NUM_COUNTERTIMERS_CHANS; i++) {
timer->regs->match_ctrl |= ((conf->match_control[i] & 0x07) << LPC_TIMER_MATCH_SHIFT(i));
timer->regs->match_reg[i] = conf->match[i];
timer->regs->external_match |= ((conf->ext_match_config[i] & 0x03) << LPC_TIMER_EXT_MATCH_SHIFT(i));