Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FatFileSystem HighSpeedAnalogIn TB6612FNG2 mbed
HighSpeedAnalogIn/HighSpeedAnalogIn.h@0:373bcb197dc8, 2013-05-10 (annotated)
- Committer:
- jksoft
- Date:
- Fri May 10 11:48:07 2013 +0000
- Revision:
- 0:373bcb197dc8
?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:373bcb197dc8 | 1 | #ifndef HIGH_SPEED_ANALOG_IN_H |
jksoft | 0:373bcb197dc8 | 2 | #define HIGH_SPEED_ANALOG_IN_H |
jksoft | 0:373bcb197dc8 | 3 | |
jksoft | 0:373bcb197dc8 | 4 | #include "mbed.h" |
jksoft | 0:373bcb197dc8 | 5 | |
jksoft | 0:373bcb197dc8 | 6 | class HighSpeedAnalogIn { |
jksoft | 0:373bcb197dc8 | 7 | public: |
jksoft | 0:373bcb197dc8 | 8 | |
jksoft | 0:373bcb197dc8 | 9 | HighSpeedAnalogIn(PinName pin0, PinName pin1 = NC, PinName pin2 = NC, PinName pin3 = NC, PinName pin4 = NC, PinName pin5 = NC); |
jksoft | 0:373bcb197dc8 | 10 | ~HighSpeedAnalogIn(); |
jksoft | 0:373bcb197dc8 | 11 | float read(PinName pin); |
jksoft | 0:373bcb197dc8 | 12 | unsigned short read_u16(PinName pin); |
jksoft | 0:373bcb197dc8 | 13 | |
jksoft | 0:373bcb197dc8 | 14 | private: |
jksoft | 0:373bcb197dc8 | 15 | |
jksoft | 0:373bcb197dc8 | 16 | HighSpeedAnalogIn(); |
jksoft | 0:373bcb197dc8 | 17 | uint32_t _adc_data[8]; |
jksoft | 0:373bcb197dc8 | 18 | |
jksoft | 0:373bcb197dc8 | 19 | static const int XTAL_FREQ = 12000000; |
jksoft | 0:373bcb197dc8 | 20 | static const int MAX_ADC_CLOCK = 13000000; |
jksoft | 0:373bcb197dc8 | 21 | static const int CLKS_PER_SAMPLE = 64; |
jksoft | 0:373bcb197dc8 | 22 | |
jksoft | 0:373bcb197dc8 | 23 | static HighSpeedAnalogIn *instance; |
jksoft | 0:373bcb197dc8 | 24 | static int refcnt; |
jksoft | 0:373bcb197dc8 | 25 | |
jksoft | 0:373bcb197dc8 | 26 | static void static_adcisr(void); |
jksoft | 0:373bcb197dc8 | 27 | |
jksoft | 0:373bcb197dc8 | 28 | int get_channel(PinName pin); |
jksoft | 0:373bcb197dc8 | 29 | uint32_t get_data(PinName pin); |
jksoft | 0:373bcb197dc8 | 30 | void adcisr(void); |
jksoft | 0:373bcb197dc8 | 31 | void setup(PinName pin, int state); |
jksoft | 0:373bcb197dc8 | 32 | void interrupt_state(PinName pin, int state); |
jksoft | 0:373bcb197dc8 | 33 | }; |
jksoft | 0:373bcb197dc8 | 34 | |
jksoft | 0:373bcb197dc8 | 35 | #endif |