It is a library for controlling Wallbot

Dependents:   wallbot_test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HighSpeedAnalogIn.h Source File

HighSpeedAnalogIn.h

00001 #ifndef HIGH_SPEED_ANALOG_IN_H
00002 #define HIGH_SPEED_ANALOG_IN_H
00003 
00004 #include "mbed.h"
00005 
00006 class HighSpeedAnalogIn {
00007 public:
00008 
00009     HighSpeedAnalogIn(PinName pin0, PinName pin1 = NC, PinName pin2 = NC, PinName pin3 = NC, PinName pin4 = NC, PinName pin5 = NC);
00010     ~HighSpeedAnalogIn();
00011     float read(PinName pin);
00012     unsigned short read_u16(PinName pin);
00013 
00014 private:
00015 
00016     HighSpeedAnalogIn();
00017     uint32_t _adc_data[8];
00018 
00019     static const int XTAL_FREQ = 12000000;
00020     static const int MAX_ADC_CLOCK = 13000000;
00021     static const int CLKS_PER_SAMPLE = 64;
00022     
00023     static HighSpeedAnalogIn *instance;
00024     static int refcnt;
00025 
00026     static void static_adcisr(void);
00027 
00028     int get_channel(PinName pin);
00029     uint32_t get_data(PinName pin);
00030     void adcisr(void);
00031     void setup(PinName pin, int state);
00032     void interrupt_state(PinName pin, int state);
00033 };
00034 
00035 #endif