Merge pull request #17387 from ngandrass/pr/cpu/atmega_common/timer_periodic
cpu/atmega_common: Remember CTC mode with timer_periodic
This commit is contained in:
commit
1f53b88a62
@ -219,11 +219,12 @@ int timer_set_periodic(tim_t tim, int channel, unsigned int value, uint8_t flags
|
|||||||
if (channel == 0) {
|
if (channel == 0) {
|
||||||
if (flags & TIM_FLAG_RESET_ON_MATCH) {
|
if (flags & TIM_FLAG_RESET_ON_MATCH) {
|
||||||
/* enable CTC mode */
|
/* enable CTC mode */
|
||||||
ctx[tim].dev->CRB |= (1 << 3);
|
ctx[tim].mode |= (1 << 3);
|
||||||
} else {
|
} else {
|
||||||
/* disable CTC mode */
|
/* disable CTC mode */
|
||||||
ctx[tim].dev->CRB &= (1 << 3);
|
ctx[tim].mode &= (1 << 3);
|
||||||
}
|
}
|
||||||
|
ctx[tim].dev->CRB = ctx[tim].mode;
|
||||||
} else {
|
} else {
|
||||||
assert((flags & TIM_FLAG_RESET_ON_MATCH) == 0);
|
assert((flags & TIM_FLAG_RESET_ON_MATCH) == 0);
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user