12bit 8ch ADC with SPI interface
Diff: mcp3208.h
- Revision:
- 0:2300f3b42cdb
- Child:
- 1:0876e83ba21b
diff -r 000000000000 -r 2300f3b42cdb mcp3208.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mcp3208.h Wed Oct 24 03:41:03 2012 +0000 @@ -0,0 +1,23 @@ +// +// +// +#ifndef _MCP3208_H +#define _MCP3208_H + +#include <mbed.h> + +class MCP3208 { + protected: + SPI _spi; + DigitalOut _cs; + + public: + MCP3208(PinName mosi=p11, PinName miso=p12, PinName clk=p13, PinName cs=p14); + int binary(int ch); + float volt(int ch); + float vref; + void start(void){_cs = 0;}; + void stop(void){_cs = 1;}; +}; + +#endif //_MCP3208?H