Skip to content

Commit

Permalink
Clang Tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aul12 committed Apr 5, 2020
1 parent 9cf8775 commit 0a9eea4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pwm16bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ static pwm_instance_t instances [] = {
};

void pwm_init(uint8_t id, pwm_clock_option_t pwm_clock_option, uint16_t top) {
*instances[id].tccra = 0b10101010; // Enable all three outputs in non inverting mode, set to Fast PWM with ICRn as TOP (mode 14)
*instances[id].tccrb = 0b00011000 | pwm_clock_option; //No input capture, select the prescaler
*instances[id].tccrc = 0x00; // No force output compare
*instances[id].timsk = 0x00; // No interrupts
*instances[id].tifr = 0x00; // Clear all interrupt flags
*instances[id].tccra = 0b10101010u; // Enable all three outputs in non inverting mode, set to Fast PWM with ICRn as TOP (mode 14)
*instances[id].tccrb = 0b00011000u | pwm_clock_option; //No input capture, select the prescaler
*instances[id].tccrc = 0x00u; // No force output compare
*instances[id].timsk = 0x00u; // No interrupts
*instances[id].tifr = 0x00u; // Clear all interrupt flags
*instances[id].icr = top; // Set the top value
*instances[id].tcnt = 0;
*instances[id].tcnt = 0u;
}

void pwm_set_out_a(uint8_t id, uint16_t val) {
Expand Down
6 changes: 3 additions & 3 deletions timer8bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ISR(TIMER0_OVF_vect) {

void timer0_init(timer_clock_option_t timer_clock_option, void (*callback)(void)) {
_callback = callback;
TCCR0A = 0b00000000; // Output compare disconnected, normal mode
TCCR0B = 0b00000000 | timer_clock_option; // No force override, normal mode, prescaler
TIMSK0 = 0b00000001; // Overflow interrupt enabled
TCCR0A = 0b00000000u; // Output compare disconnected, normal mode
TCCR0B = 0b00000000u | timer_clock_option; // No force override, normal mode, prescaler
TIMSK0 = 0b00000001u; // Overflow interrupt enabled

TCNT0 = 0; // Set the counter to 0
}
2 changes: 1 addition & 1 deletion uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void uart_init(uint8_t id, uint32_t baud, uart_parity_t parity, uint8_t stop_bit
}
if (baud > MIN_U2X_BAUD) {
*instances[id].ubrr = lroundf(F_CPU / (8.0 * baud) - 1);
*instances[id].ucsra |= (1 << 1); // Switch to double transmission speed
*instances[id].ucsra |= (1u << 1u); // Switch to double transmission speed
} else {
*instances[id].ubrr = lroundf(F_CPU / (16.0 * baud) - 1);
}
Expand Down

0 comments on commit 0a9eea4

Please sign in to comment.