12bit 8ch ADC with SPI interface

Fork of MCP3208 by Yoji KURODA

Committer:
ykuroda
Date:
Wed Oct 24 03:41:03 2012 +0000
Revision:
0:2300f3b42cdb
Child:
1:0876e83ba21b
MCP3208 ADC Library

Who changed what in which revision?

UserRevisionLine numberNew 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 0:2300f3b42cdb 13
ykuroda 0:2300f3b42cdb 14 public:
ykuroda 0:2300f3b42cdb 15 MCP3208(PinName mosi=p11, PinName miso=p12, PinName clk=p13, PinName cs=p14);
ykuroda 0:2300f3b42cdb 16 int binary(int ch);
ykuroda 0:2300f3b42cdb 17 float volt(int ch);
ykuroda 0:2300f3b42cdb 18 float vref;
ykuroda 0:2300f3b42cdb 19 void start(void){_cs = 0;};
ykuroda 0:2300f3b42cdb 20 void stop(void){_cs = 1;};
ykuroda 0:2300f3b42cdb 21 };
ykuroda 0:2300f3b42cdb 22
ykuroda 0:2300f3b42cdb 23 #endif //_MCP3208?H