DOS EOL and indentation fixes (platform files)

- Removed some DOS EOLs
- Changed some tabs to spaces
- Removed some trailing whitespaces

Closes #6
This commit is contained in:
George Oikonomou 2012-10-28 19:42:16 +00:00
parent 713c2e5974
commit 67bf9ec10e
14 changed files with 546 additions and 546 deletions

View file

@ -34,43 +34,43 @@
#include "dev/adc.h"
/*---------------------------------------------------------------------------*/
void
adc_init()
{
void
adc_init()
{
ADMUX = 0;
/* AVCC with external capacitor at AREF pin. */
ADMUX |= _BV(REFS0);
/* Disable ADC interrupts. */
/* Disable ADC interrupts. */
ADCSRA &= ~( _BV(ADIE) | _BV(ADIF) );
/* Set ADC prescaler to 64 and clear interrupt flag. */
ADCSRA |= _BV(ADPS2) | _BV(ADPS1) | _BV(ADIE);
ADCSRA |= _BV(ADPS2) | _BV(ADPS1) | _BV(ADIE);
}
/*---------------------------------------------------------------------------*/
/* Poll based approach. The interrupt based adc is currently not used.
The ADC result is right adjusted. First 8 bits(from left) are in ADCL and
other two bits are in ADCH. See Atmega128 datasheet page 228. */
uint16_t
get_adc(int channel)
{
uint16_t reading;
other two bits are in ADCH. See Atmega128 datasheet page 228. */
uint16_t
get_adc(int channel)
{
uint16_t reading;
ADMUX |= (channel & 0x1F);
/* Disable ADC interrupts. */
/* Disable ADC interrupts. */
ADCSRA &= ~_BV(ADIE);
/* Clear previous interrupts. */
/* Clear previous interrupts. */
ADCSRA |= _BV(ADIF);
/* Enable ADC and start conversion. */
ADCSRA |= _BV(ADEN) | _BV(ADSC);
/* Wait until conversion is completed. */
while ( ADCSRA & _BV(ADSC) );
/* Get first 8 bits. */
/* Enable ADC and start conversion. */
ADCSRA |= _BV(ADEN) | _BV(ADSC);
/* Wait until conversion is completed. */
while ( ADCSRA & _BV(ADSC) );
/* Get first 8 bits. */
reading = ADCL;
/* Get last two bits. */
/* Get last two bits. */
reading |= (ADCH & 3) << 8;
/* Disable ADC. */
ADCSRA &= ~_BV(ADEN);
return reading;
/* Disable ADC. */
ADCSRA &= ~_BV(ADEN);
return reading;
}
/*---------------------------------------------------------------------------*/