forked from len0rd/rockbox
Cleanup some tabs and whitespace
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17288 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c741ecc68a
commit
f3d83c7be7
1 changed files with 38 additions and 46 deletions
|
|
@ -21,16 +21,12 @@
|
|||
#include "adc-target.h"
|
||||
#include "kernel.h"
|
||||
|
||||
|
||||
|
||||
static unsigned short adc_readings[NUM_ADC_CHANNELS];
|
||||
|
||||
/* prototypes */
|
||||
static unsigned short __adc_read(int channel);
|
||||
static void adc_tick(void);
|
||||
|
||||
|
||||
|
||||
void adc_init(void)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -59,20 +55,14 @@ void adc_init(void)
|
|||
|
||||
/* attach the adc reading to the tick */
|
||||
tick_add_task(adc_tick);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Called to get the recent ADC reading */
|
||||
inline unsigned short adc_read(int channel)
|
||||
{
|
||||
return adc_readings[channel];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Read the ADC by polling
|
||||
* @param channel The ADC channel to read
|
||||
|
|
@ -89,13 +79,17 @@ static unsigned short __adc_read(int channel)
|
|||
ADCCON |= 0x1;
|
||||
|
||||
/* Wait for a low Enable_start */
|
||||
for (i = 20000;;) {
|
||||
if(0 == (ADCCON & 0x1)) {
|
||||
for (i = 20000;;)
|
||||
{
|
||||
if(0 == (ADCCON & 0x1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
i--;
|
||||
if (0 == i) {
|
||||
if (0 == i)
|
||||
{
|
||||
/* Ran out of time */
|
||||
return ADC_READ_ERROR;
|
||||
}
|
||||
|
|
@ -103,24 +97,25 @@ static unsigned short __adc_read(int channel)
|
|||
}
|
||||
|
||||
/* Wait for high End_of_Conversion */
|
||||
for(i = 20000;;) {
|
||||
if(ADCCON & (1<<15)) {
|
||||
for(i = 20000;;)
|
||||
{
|
||||
if(ADCCON & (1<<15))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
i--;
|
||||
if(0 == i) {
|
||||
if(0 == i)
|
||||
{
|
||||
/* Ran out of time */
|
||||
return ADC_READ_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (ADCDAT0 & 0x3ff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add this to the tick so that the ADC converts are done in the background */
|
||||
static void adc_tick(void)
|
||||
{
|
||||
|
|
@ -140,6 +135,3 @@ static void adc_tick(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue