12bit 8ch ADC with SWSPI instead to support variable SPI bit length

Fork of MCP3208_Y by Michael Chuah

mcp3208.h

Committer:
mcx
Date:
2017-04-06
Revision:
3:08c7702773b6
Parent:
2:701c3096336e

File content as of revision 3:08c7702773b6:

//
//
//
#ifndef _MCP3208_H
#define _MCP3208_H

#include <mbed.h>

#include "SWSPI.h"

class MCP3208 {
  protected:
    SWSPI _spi;
    DigitalOut _cs;
    float _vref;
  
  public:
    MCP3208(PinName mosi, PinName miso, PinName clk, PinName cs);
    int binary(int ch);
    float volt(int ch);
    float vref(float v){return _vref=v;}
};

#endif  //_MCP3208_H