1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/atmega_common: Remember CTC mode with timer_periodic

This commit is contained in:
Niels Gandraß 2021-12-13 12:08:38 +01:00
parent 921a841147
commit 41e8a57960
No known key found for this signature in database
GPG Key ID: 63BE0AE9319ECB87

View File

@ -219,11 +219,12 @@ int timer_set_periodic(tim_t tim, int channel, unsigned int value, uint8_t flags
if (channel == 0) {
if (flags & TIM_FLAG_RESET_ON_MATCH) {
/* enable CTC mode */
ctx[tim].dev->CRB |= (1 << 3);
ctx[tim].mode |= (1 << 3);
} else {
/* disable CTC mode */
ctx[tim].dev->CRB &= (1 << 3);
ctx[tim].mode &= (1 << 3);
}
ctx[tim].dev->CRB = ctx[tim].mode;
} else {
assert((flags & TIM_FLAG_RESET_ON_MATCH) == 0);
res = -1;