try out analog stuff, probably needs more work
This commit is contained in:
parent
488e42605b
commit
6a58efbfa4
2
analog.c
2
analog.c
|
|
@ -1,5 +1,7 @@
|
|||
#include "analog.h"
|
||||
|
||||
#include "arduino.h"
|
||||
|
||||
void analog_init() {
|
||||
PRR &= ~MASK(PRADC);
|
||||
ADMUX = REFERENCE;
|
||||
|
|
|
|||
6
analog.h
6
analog.h
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue