modm API documentation
modm::mcp3008< SpiMaster, Cs > Class Template Reference

#include <modm/driver/adc/mcp3008.hpp>

Inheritance diagram for modm::mcp3008< SpiMaster, Cs >:
modm::SpiDevice< SpiMaster > modm::NestedResumable< 1 >

Public Types

enum  Channel : uint8_t {
  Ch0 = 0b1000, Ch1 = 0b1001, Ch2 = 0b1010, Ch3 = 0b1011,
  Ch4 = 0b1100, Ch5 = 0b1101, Ch6 = 0b1110, Ch7 = 0b1111,
  Ch0Ch1Diff = 0b0000, Ch1Ch0Diff = 0b0001, Ch2Ch3Diff = 0b0010, Ch3Ch2Diff = 0b0011,
  Ch4Ch5Diff = 0b0100, Ch5Ch4Diff = 0b0101, Ch6Ch7Diff = 0b0110, Ch7Ch6Diff = 0b0111
}
 

Public Member Functions

 Mcp3008 () = default
 
void initialize ()
 Call initialize() before reading ADC.
 
modm::ResumableResult< uint16_t > read (Channel channel)
 Read ADC channel.
 
void attachConfigurationHandler (Spi::ConfigurationHandler handler)
 

Protected Member Functions

bool acquireMaster ()
 
bool releaseMaster ()
 
int8_t getResumableDepth () const
 
bool isResumableRunning () const
 
void stopResumable ()
 

Detailed Description

template<typename SpiMaster, typename Cs>
class modm::mcp3008< SpiMaster, Cs >

Simple driver for MCP3004/MCP3008 10-bit SAR SPI ADCs. Max SPI frequency 3.6 MHz at 5V, 1.36 MHz at 2.7V.

Author
Christopher Durand

Member Enumeration Documentation

template<typename SpiMaster , typename Cs >
enum modm::mcp3008::Channel : uint8_t
strong

ADC channels For MCP3004 only channels 0-3 are valid.


The documentation for this class was generated from the following file: