aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/platforms/AVR/atmega_pins.h20
-rw-r--r--os/hal/platforms/AVR/hal_lld.c6
-rw-r--r--os/hal/platforms/AVR/hal_lld.h12
3 files changed, 19 insertions, 19 deletions
diff --git a/os/hal/platforms/AVR/atmega_pins.h b/os/hal/platforms/AVR/atmega_pins.h
index bf2479b34..498d16cbb 100644
--- a/os/hal/platforms/AVR/atmega_pins.h
+++ b/os/hal/platforms/AVR/atmega_pins.h
@@ -1,19 +1,19 @@
-
-#include <avr/io.h>
#ifndef ATMEGA_PINS_H
#define ATMEGA_PINS_H
+#include <avr/io.h>
+
#if defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)
#define PINADC PINA
#define PORTADC PORTA
#define DDRADC DDRA
- #define PIN_SPI1 PINB
- #define PORT_SPI1 PORTB
- #define DDR_SPI1 DDRB
+ #define PIN_SPI1 PINB
+ #define PORT_SPI1 PORTB
+ #define DDR_SPI1 DDRB
#define SPI1_SS 4
- #define SPI1_SCK 7
- #define SPI1_MOSI 5
- #define SPI1_MISO 6
+ #define SPI1_SCK 7
+ #define SPI1_MOSI 5
+ #define SPI1_MISO 6
#elif defined(__AVR_ATmega328P__)
#define PINADC PINC
@@ -27,7 +27,7 @@
#define SPI1_MOSI 3
#define SPI1_MISO 4
- #elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega128__)
+ #elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega128__)
#define PINADC PINF
#define PORTADC PORTF
#define DDRADC DDRF
@@ -39,7 +39,7 @@
#define SPI1_MOSI 2
#define SPI1_MISO 3
#else
- #warning "Device not supported by ADC or SPI driver"
+ #warning "Device not supported by ADC or SPI driver"
#endif
#endif
diff --git a/os/hal/platforms/AVR/hal_lld.c b/os/hal/platforms/AVR/hal_lld.c
index dbe870534..f8afbfdb2 100644
--- a/os/hal/platforms/AVR/hal_lld.c
+++ b/os/hal/platforms/AVR/hal_lld.c
@@ -70,7 +70,7 @@ void hal_lld_init(void) {
/*
* Timer 0 setup.
*/
-#ifdef TCCR0A /* Timer has multiple output comparators */
+#if defined(TCCR0A) /* Timer has multiple output comparators */
TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
(0 << COM0A1) | (0 << COM0A0) | /* OC0A disabled. */
(0 << COM0B1) | (0 << COM0B0); /* OC0B disabled. */
@@ -83,13 +83,13 @@ void hal_lld_init(void) {
#elif defined(TCCR0) /* Timer has single output comparator */
TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
(0 << COM01) | (0 << COM00) | /* OC0A disabled. */
- AVR_TIMER_PRESCALER_BITS;
+ AVR_TIMER_PRESCALER_BITS;
OCR0 = AVR_TIMER_COUNTER - 1;
TCNT0 = 0; /* Reset counter. */
TIFR = (1 << OCF0); /* Reset pending. */
TIMSK = (1 << OCIE0); /* IRQ on compare. */
#else
- #error "Neither TCCR0A nor TCCRO registers are defined"
+ #error "Neither TCCR0A nor TCCR0 registers are defined"
#endif
}
diff --git a/os/hal/platforms/AVR/hal_lld.h b/os/hal/platforms/AVR/hal_lld.h
index d2dae48bd..1dfb5edc9 100644
--- a/os/hal/platforms/AVR/hal_lld.h
+++ b/os/hal/platforms/AVR/hal_lld.h
@@ -50,13 +50,13 @@
/* Work out what the timer interrupt is called on this MCU */
#ifdef TIMER0_COMPA_vect
- #define AVR_TIMER_VECT TIMER0_COMPA_vect
+ #define AVR_TIMER_VECT TIMER0_COMPA_vect
#elif defined(TIMER_COMPA_vect)
- #define AVR_TIMER_VECT TIMER_COMPA_vect
+ #define AVR_TIMER_VECT TIMER_COMPA_vect
#elif defined(TIMER0_COMP_vect)
- #define AVR_TIMER_VECT TIMER0_COMP_vect
+ #define AVR_TIMER_VECT TIMER0_COMP_vect
#else
- #error "Cannot find interrupt vector name for timer"
+ #error "Cannot find interrupt vector name for timer"
#endif
/*===========================================================================*/
@@ -83,12 +83,12 @@
#error "Frequency too low for timer, please set CH_FREQUENCY to a higher value"
#endif
-#define AVR_TIMER_COUNTER F_CPU / CH_FREQUENCY / AVR_TIMER_PRESCALER
+#define AVR_TIMER_COUNTER (F_CPU / CH_FREQUENCY / AVR_TIMER_PRESCALER)
/* Test if CH_FREQUENCY can be matched exactly using this timer */
#define F_CPU_ (AVR_TIMER_COUNTER * AVR_TIMER_PRESCALER * CH_FREQUENCY)
#if (F_CPU_ != F_CPU)
- #warning "CH_FREQUENCY cannot be generated exactly using timer"
+ #warning "CH_FREQUENCY cannot be generated exactly using timer"
#endif
#undef F_CPU_