Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hal/mcu/at90can128_tqfp64/hal/mcu_timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class Timer0 {
};

static void init(Prescaler prescaler, Mode mode) {
TCCR0A = (static_cast<uint8_t>(mode) & 0b01 << WGM00) |
(static_cast<uint8_t>(mode) & 0b10 << WGM01) |
TCCR0A = (hal::libs::read_bit<0>(static_cast<uint8_t>(mode)) << WGM00) |
(hal::libs::read_bit<1>(static_cast<uint8_t>(mode)) << WGM01) |
static_cast<uint8_t>(prescaler);
}

Expand Down
8 changes: 4 additions & 4 deletions hal/mcu/atmega128_tqfp64/hal/mcu_timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class Timer0 {
};

static void init(Prescaler prescaler, Mode mode) {
TCCR0 = (static_cast<uint8_t>(mode) & 0b01 << WGM00) |
(static_cast<uint8_t>(mode) & 0b10 << WGM01) |
TCCR0 = (hal::libs::read_bit<0>(static_cast<uint8_t>(mode)) << WGM00) |
(hal::libs::read_bit<1>(static_cast<uint8_t>(mode)) << WGM01) |
static_cast<uint8_t>(prescaler);
}

Expand Down Expand Up @@ -198,8 +198,8 @@ class Timer2 {
};

static void init(Prescaler prescaler, Mode mode) {
TCCR2 = (static_cast<uint8_t>(mode) & 0b01 << WGM20) |
(static_cast<uint8_t>(mode) & 0b10 << WGM21) |
TCCR2 = (hal::libs::read_bit<0>(static_cast<uint8_t>(mode)) << WGM20) |
(hal::libs::read_bit<1>(static_cast<uint8_t>(mode)) << WGM21) |
static_cast<uint8_t>(prescaler);
}

Expand Down
6 changes: 3 additions & 3 deletions hal/mcu/atmega328p_tqfp32/hal/mcu_timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Timer0 {
enum class Mode : uint8_t { Normal = 0 };

static void init(Prescaler prescaler, Mode mode) {
TCCR0A = (static_cast<uint8_t>(mode) & 0b001 << WGM00) |
(static_cast<uint8_t>(mode) & 0b010 << WGM01);
TCCR0B = (static_cast<uint8_t>(mode) & 0b100 << WGM02) |
TCCR0A = (hal::libs::read_bit<0>(static_cast<uint8_t>(mode)) << WGM00) |
(hal::libs::read_bit<1>(static_cast<uint8_t>(mode)) << WGM01);
TCCR0B = (hal::libs::read_bit<2>(static_cast<uint8_t>(mode)) << WGM02) |
static_cast<uint8_t>(prescaler);
}

Expand Down