API
 
Loading...
Searching...
No Matches
MCP3008Lib::MCP3008 Class Reference

#include <MCP3008.h>

Collaboration diagram for MCP3008Lib::MCP3008:
Collaboration graph

Public Member Functions

 MCP3008 (const int dev=DEFAULT_SPI_DEV, const int channel=DEFAULT_SPI_CHANNEL, const int baud=DEFAULT_SPI_BAUD, const int flags=DEFAULT_SPI_FLAGS) noexcept
 
virtual ~MCP3008 ()
 
void connect ()
 
void disconnect ()
 
unsigned short read (const std::uint8_t channel, const Mode m=Mode::SINGLE) const
 

Static Public Attributes

static const int DEFAULT_SPI_DEV = 0
 
static const int DEFAULT_SPI_CHANNEL = 0
 
static const int SPI_5V_BAUD = 3600000
 
static const int SPI_2_7V_BAUD = 1350000
 
static const int DEFAULT_SPI_BAUD = SPI_2_7V_BAUD
 
static const int DEFAULT_SPI_FLAGS = SPI_MODE_0
 

Protected Attributes

int _handle
 
int _dev
 
int _channel
 
int _baud
 
int _flags
 

Detailed Description

Definition at line 41 of file MCP3008.h.

Constructor & Destructor Documentation

◆ MCP3008()

MCP3008Lib::MCP3008::MCP3008 ( const int  dev = DEFAULT_SPI_DEV,
const int  channel = DEFAULT_SPI_CHANNEL,
const int  baud = DEFAULT_SPI_BAUD,
const int  flags = DEFAULT_SPI_FLAGS 
)
noexcept

Definition at line 8 of file MCP3008.cpp.

◆ ~MCP3008()

MCP3008Lib::MCP3008::~MCP3008 ( )
virtual

Definition at line 20 of file MCP3008.cpp.

Member Function Documentation

◆ connect()

void MCP3008Lib::MCP3008::connect ( )

Definition at line 31 of file MCP3008.cpp.

Referenced by MagAOX::app::mcp3008Ctrl::appStartup().

◆ disconnect()

void MCP3008Lib::MCP3008::disconnect ( )

Definition at line 51 of file MCP3008.cpp.

Referenced by ~MCP3008().

◆ read()

unsigned short MCP3008Lib::MCP3008::read ( const std::uint8_t  channel,
const Mode  m = Mode::SINGLE 
) const

Definition at line 65 of file MCP3008.cpp.

Referenced by MagAOX::app::mcp3008Ctrl::acquireAndCheckValid().

Member Data Documentation

◆ _baud

int MCP3008Lib::MCP3008::_baud
protected

Definition at line 69 of file MCP3008.h.

Referenced by connect().

◆ _channel

int MCP3008Lib::MCP3008::_channel
protected

Definition at line 68 of file MCP3008.h.

Referenced by connect().

◆ _dev

int MCP3008Lib::MCP3008::_dev
protected

Definition at line 67 of file MCP3008.h.

Referenced by connect().

◆ _flags

int MCP3008Lib::MCP3008::_flags
protected

Definition at line 70 of file MCP3008.h.

Referenced by connect().

◆ _handle

int MCP3008Lib::MCP3008::_handle
protected

Definition at line 66 of file MCP3008.h.

Referenced by connect(), disconnect(), and read().

◆ DEFAULT_SPI_BAUD

const int MCP3008Lib::MCP3008::DEFAULT_SPI_BAUD = SPI_2_7V_BAUD
static

Definition at line 47 of file MCP3008.h.

◆ DEFAULT_SPI_CHANNEL

const int MCP3008Lib::MCP3008::DEFAULT_SPI_CHANNEL = 0
static

Definition at line 44 of file MCP3008.h.

◆ DEFAULT_SPI_DEV

const int MCP3008Lib::MCP3008::DEFAULT_SPI_DEV = 0
static

Definition at line 43 of file MCP3008.h.

◆ DEFAULT_SPI_FLAGS

const int MCP3008Lib::MCP3008::DEFAULT_SPI_FLAGS = SPI_MODE_0
static

Definition at line 50 of file MCP3008.h.

◆ SPI_2_7V_BAUD

const int MCP3008Lib::MCP3008::SPI_2_7V_BAUD = 1350000
static

Definition at line 46 of file MCP3008.h.

◆ SPI_5V_BAUD

const int MCP3008Lib::MCP3008::SPI_5V_BAUD = 3600000
static

Definition at line 45 of file MCP3008.h.


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