Fixes style of AVR HAL
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5900 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
1a100c442a
commit
1076c100ce
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
||||
|
|
Loading…
Reference in New Issue