Subversion Repositories MK3Mag

Rev

Rev 19 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _ANALOG_H_
#define _ANALOG_H_

#include <inttypes.h>
#include <avr/io.h>

#define FLIP_HIGH  PORTD |=  ((1<<PORTD5)|(1<<PORTD6))
#define FLIP_LOW   PORTD &= ~((1<<PORTD5)|(1<<PORTD6))

typedef enum
{
        ADC0 = 0,
        ADC1 = 1,
        ADC2 = 2,
        ADC3 = 3,
        ADC4 = 4,
        ADC5 = 5,
        ADC6 = 6,
        ADC7 = 7,
        REF1V1 = 14,
        AGND = 15
} ADChannel_t;


#define MAG_X ADC0
#define MAG_Y ADC1
#define MAG_Z ADC7
#define ACC_X ADC2
#define ACC_Y ADC3
#define ACC_Z ADC6


extern uint8_t AccPresent;

void ADC_Init(void);
uint16_t ADC_GetValue(ADChannel_t channel);

#endif // _ANALOG_H_