It is a library for controlling Wallbot

Dependents:   wallbot_test

Committer:
jksoft
Date:
Sun Jul 28 08:20:17 2013 +0000
Revision:
0:f8571ffd252a
First

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:f8571ffd252a 1 #ifndef HIGH_SPEED_ANALOG_IN_H
jksoft 0:f8571ffd252a 2 #define HIGH_SPEED_ANALOG_IN_H
jksoft 0:f8571ffd252a 3
jksoft 0:f8571ffd252a 4 #include "mbed.h"
jksoft 0:f8571ffd252a 5
jksoft 0:f8571ffd252a 6 class HighSpeedAnalogIn {
jksoft 0:f8571ffd252a 7 public:
jksoft 0:f8571ffd252a 8
jksoft 0:f8571ffd252a 9 HighSpeedAnalogIn(PinName pin0, PinName pin1 = NC, PinName pin2 = NC, PinName pin3 = NC, PinName pin4 = NC, PinName pin5 = NC);
jksoft 0:f8571ffd252a 10 ~HighSpeedAnalogIn();
jksoft 0:f8571ffd252a 11 float read(PinName pin);
jksoft 0:f8571ffd252a 12 unsigned short read_u16(PinName pin);
jksoft 0:f8571ffd252a 13
jksoft 0:f8571ffd252a 14 private:
jksoft 0:f8571ffd252a 15
jksoft 0:f8571ffd252a 16 HighSpeedAnalogIn();
jksoft 0:f8571ffd252a 17 uint32_t _adc_data[8];
jksoft 0:f8571ffd252a 18
jksoft 0:f8571ffd252a 19 static const int XTAL_FREQ = 12000000;
jksoft 0:f8571ffd252a 20 static const int MAX_ADC_CLOCK = 13000000;
jksoft 0:f8571ffd252a 21 static const int CLKS_PER_SAMPLE = 64;
jksoft 0:f8571ffd252a 22
jksoft 0:f8571ffd252a 23 static HighSpeedAnalogIn *instance;
jksoft 0:f8571ffd252a 24 static int refcnt;
jksoft 0:f8571ffd252a 25
jksoft 0:f8571ffd252a 26 static void static_adcisr(void);
jksoft 0:f8571ffd252a 27
jksoft 0:f8571ffd252a 28 int get_channel(PinName pin);
jksoft 0:f8571ffd252a 29 uint32_t get_data(PinName pin);
jksoft 0:f8571ffd252a 30 void adcisr(void);
jksoft 0:f8571ffd252a 31 void setup(PinName pin, int state);
jksoft 0:f8571ffd252a 32 void interrupt_state(PinName pin, int state);
jksoft 0:f8571ffd252a 33 };
jksoft 0:f8571ffd252a 34
jksoft 0:f8571ffd252a 35 #endif