try out analog stuff, probably needs more work

This commit is contained in:
Michael Moon 2010-08-24 15:49:21 +10:00
parent 488e42605b
commit 6a58efbfa4
3 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#include "analog.h"
#include "arduino.h"
void analog_init() {
PRR &= ~MASK(PRADC);
ADMUX = REFERENCE;

View File

@ -1,10 +1,14 @@
#ifndef _ANALOG_H
#define _ANALOG_H
#include <stdint.h>
#define REFERENCE_AREF 0
#define REFERENCE_AVCC 64
#define REFERENCE_1V1 192
#include "machine.h"
#ifndef REFERENCE
#warning define REFERENCE as one of
#warning REFERENCE_AREF, REFERENCE_AVCC or REFERENCE_1V1
@ -12,7 +16,7 @@
#error REFERENCE undefined
#endif
void analog_init();
void analog_init(void);
uint16_t analog_read(uint8_t channel);
#endif /* _ANALOG_H */

View File

@ -70,4 +70,8 @@
*/
#define MOVEBUFFER_SIZE 8
/*
*/
#define REFERENCE REFERENCE_AREF
#endif /* _MACHINE_H */