12bit 8ch ADC with SPI interface for STM32 Nucleo to support 16-bit words. SPI speed bumped up to 8MHz
Fork of MCP3208_Y by
mcp3208.h@2:701c3096336e, 2015-02-20 (annotated)
- Committer:
- mcx
- Date:
- Fri Feb 20 17:53:27 2015 +0000
- Revision:
- 2:701c3096336e
- Parent:
- 1:0876e83ba21b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ykuroda | 0:2300f3b42cdb | 1 | // |
ykuroda | 0:2300f3b42cdb | 2 | // |
ykuroda | 0:2300f3b42cdb | 3 | // |
ykuroda | 0:2300f3b42cdb | 4 | #ifndef _MCP3208_H |
ykuroda | 0:2300f3b42cdb | 5 | #define _MCP3208_H |
ykuroda | 0:2300f3b42cdb | 6 | |
ykuroda | 0:2300f3b42cdb | 7 | #include <mbed.h> |
ykuroda | 0:2300f3b42cdb | 8 | |
ykuroda | 0:2300f3b42cdb | 9 | class MCP3208 { |
ykuroda | 0:2300f3b42cdb | 10 | protected: |
ykuroda | 0:2300f3b42cdb | 11 | SPI _spi; |
ykuroda | 0:2300f3b42cdb | 12 | DigitalOut _cs; |
ykuroda | 1:0876e83ba21b | 13 | float _vref; |
ykuroda | 0:2300f3b42cdb | 14 | |
ykuroda | 0:2300f3b42cdb | 15 | public: |
mcx | 2:701c3096336e | 16 | MCP3208(PinName mosi, PinName miso, PinName clk, PinName cs); |
ykuroda | 0:2300f3b42cdb | 17 | int binary(int ch); |
ykuroda | 0:2300f3b42cdb | 18 | float volt(int ch); |
ykuroda | 1:0876e83ba21b | 19 | float vref(float v){return _vref=v;} |
ykuroda | 0:2300f3b42cdb | 20 | }; |
ykuroda | 0:2300f3b42cdb | 21 | |
ykuroda | 1:0876e83ba21b | 22 | #endif //_MCP3208_H |