Seeed Grove ++  v0.0.1-2019
Linux C++ Library For Seeed Grove Devices
SG::I2CADC Class Reference

Analog-to-digital converter for analog I2C sensors. More...

#include <sg_103020013_I2CADC.hpp>

Inheritance diagram for SG::I2CADC:
Collaboration diagram for SG::I2CADC:

Public Types

enum  ERegister {
  ERegister::kConversionResult = 0,
  ERegister::kAlertStatus = 1,
  ERegister::kConfiguration = 2,
  ERegister::kLowLimit = 3,
  ERegister::kHighLimit = 4,
  ERegister::kHysteresis = 5,
  ERegister::kLowestConversion = 6,
  ERegister::kHighestConversion = 7
}
 I2CADC registers. More...
 
typedef uint8_t I2CBus
 I2C bus. More...
 
typedef uint8_t I2CAddress
 I2C addresses. More...
 
typedef uint8_t I2CRegister
 I2C register. More...
 
typedef std::vector< uint8_t > I2CBlock
 Block of sequential bytes to read or write. More...
 

Public Member Functions

virtual ~I2CADC (void)
 Destructor. More...
 
 I2CADC (const std::string &n="", const I2CAddress addr=0)
 Constructor. More...
 
I2CADCreset (void)
 Reset the I2CADC configuration. More...
 
I2CADCdisable_automatic_mode (void)
 The I2CADC can be configured to perform auto conversions. More...
 
I2CADCenable_automatic_mode (const uint8_t value=1)
 The I2CADC can be configured to perform periodic auto conversions. More...
 
uint16_t get_result (void)
 Read the most recent 12-bit analog-to-digital conversion result register (0x00). More...
 
uint16_t get_minimum_result (void)
 Return the lowest conversion result seen since the I2CADC was last reset. More...
 
uint16_t get_maximum_result (void)
 Return the highest conversion result seen since the I2CADC was last reset. More...
 
I2CADCreset_minimum_result (void)
 Reset the minimum conversion value stored in register 0x06 when automatic conversion mode is enabled. More...
 
I2CADCreset_maximum_result (void)
 Reset the maximum conversion value stored in register 0x07 when automatic conversion mode is enabled. More...
 
uint16_t get_and_reset_minimum_result (void)
 Get the minimum conversion result and reset the register. More...
 
uint16_t get_and_reset_maximum_result (void)
 Get the maximum conversion result and reset the register. More...
 
virtual bool is_analog (void) const
 This is always false for GroveI2CDigital. More...
 
virtual bool is_digital (void) const
 This is always true for GroveI2CDigital. More...
 
I2CAddress get_address_from_type (void) const
 Get the address for this Grove type. More...
 
virtual uint8_t read8 (const I2CRegister reg)
 Read a byte (8 bits) from the specificed register. More...
 
virtual uint16_t read16 (const I2CRegister reg)
 Read a 16-bit word from the specified register. More...
 
virtual uint16_t read12 (const I2CRegister reg)
 Read a 16-bit word from the specified register, but only keep the bottom 12 bits. More...
 
virtual I2CBlock read_block (const I2CRegister reg)
 Read a consecutive block of bytes, anywhere between 1 and 32 bytes in length. More...
 
virtual GroveI2CDigitalwrite_byte (const uint8_t value)
 Write a single byte to the I2C bus. More...
 
virtual GroveI2CDigitalwrite_block (const I2CRegister reg, const I2CBlock &v)
 Write a consecutive block of bytes, anywhere between 1 and 32 bytes in length. More...
 
virtual GroveI2CDigitalwrite_block (const I2CBlock &v)
 Write a consecutive block of bytes directly to the I2C file handle. More...
 
virtual bool is_grove_uart (void) const
 This is always false for GroveI2C. More...
 
virtual bool is_grove_i2c (void) const
 This is always true for GroveI2C. More...
 
virtual bool is_grove_gpio (void) const
 This is always false for GroveI2C. More...
 
virtual uint32_t get_sku (void) const
 Return a guess as to the Seeed SKU number based on the grove type. More...
 
virtual std::string get_type_name (void) const
 Return a short text string representing the grove type. More...
 
virtual EGroveType get_type (void) const
 Return the grove type. More...
 
virtual std::string get_name (void) const
 Return the user-supplied name. More...
 
virtual std::string get_description (void) const
 Return a multi-word 1-line description of this object. More...
 
bool operator== (const I2CADC &rhs) const
 Test object equality. More...
 
bool operator!= (const I2CADC &rhs) const
 Test object equality. More...
 
virtual uint8_t read8 (const ERegister reg)
 For convenience, read + write using the register enum. More...
 
virtual uint16_t read12 (const ERegister reg)
 For convenience, read + write using the register enum. More...
 
virtual I2CADCwrite8 (const ERegister reg, const uint8_t value)
 For convenience, read + write using the register enum. More...
 
virtual I2CADCwrite16 (const ERegister reg, const uint16_t value)
 For convenience, read + write using the register enum. More...
 
virtual GroveI2CDigitalwrite8 (const I2CRegister reg, const uint8_t value)
 Write the given value to the specified register. More...
 
virtual GroveI2CDigitalwrite16 (const I2CRegister reg, const uint16_t value)
 
bool operator== (const GroveBase &rhs) const
 Test object equality. More...
 
bool operator!= (const GroveBase &rhs) const
 Test object equality. More...
 

Static Public Member Functions

static I2CBus detect_i2c_bus_number (const bool force_detect=false, const int force_bus_number=-1)
 Detect the I2C bus to use to talk to Grove I2C devices. More...
 
static I2CAddress get_address_from_type (const EGroveType &type)
 Get the default I2C address for a given type. More...
 

Public Attributes

I2CBus i2c_bus_number
 The bus number to use for I2C Grove twigs. More...
 
I2CAddress i2c_address
 The I2C address used to communicate with the Grove device. More...
 
int i2c_file_handle
 The file handle to /dev/i2c-* used to communicate with the Grove device. More...
 
EGroveType grove_type
 Grove type. More...
 
std::string grove_name
 User-supplied name. More...
 

Detailed Description

Analog-to-digital converter for analog I2C sensors.

Apparently, the default I2C address for this twig used to be 0x55. This conflicts with the BeagleBone Green EEPROM which also uses i2c-1 addresses 0x54 through 0x57.

For example, do not connect any I2C Groves twigs and run the i2cdetect command:

sudo i2cdetect -r -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

If your ADC indicates it is using address 0x55, then locate the labels for ADDR0 and ADDR1, along with H and L at the bottom of the ADC. You'll need to cut the trace to use a different address. See http://www.seeedstudio.com/wiki/Grove_-_I2C_ADC#With_Beaglebone_Green for details.

Connect the ADC to the left-hand J4 I2C grove interface, and run the i2cdetect command to find the address of your ADC:

sudo i2cdetect -r -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

In the above example, the ADC is at address 0x50.

Description Image
I2C ADC with a default address of 0x50.
sg_103020013_I2CADC.jpg
I2C ADC with a temperature sensor.
J1 connects to the BeagleBone Green, and J2 connects to the analog I2C twig.
sg_101020015_TemperatureSensor.jpg
See also
http://www.seeedstudio.com/wiki/Grove_-_I2C_ADC
http://www.seeedstudio.com/depot/Grove-I2C-ADC-p-1580.html
http://www.seeedstudio.com/wiki/images/3/34/ADC121C021_Datasheet.pdf

Member Typedef Documentation

typedef uint8_t SG::GroveI2CDigital::I2CAddress
inherited

I2C addresses.

See also
get_address_from_type()
typedef std::vector<uint8_t> SG::GroveI2CDigital::I2CBlock
inherited

Block of sequential bytes to read or write.

typedef uint8_t SG::GroveI2CDigital::I2CBus
inherited

I2C bus.

See also
detect_i2c_bus_number()
typedef uint8_t SG::GroveI2CDigital::I2CRegister
inherited

I2C register.

Member Enumeration Documentation

enum SG::I2CADC::ERegister
strong

I2CADC registers.

See also
ADC121C021 datasheet page 17
Enumerator
kConversionResult 

0 (this register is read-only)

kAlertStatus 

1

kConfiguration 

2

kLowLimit 

3

kHighLimit 

4

kHysteresis 

5

kLowestConversion 

6

kHighestConversion 

7

Constructor & Destructor Documentation

SG::I2CADC::~I2CADC ( void  )
virtual

Destructor.

SG::I2CADC::I2CADC ( const std::string &  n = "",
const I2CAddress  addr = 0 
)

Constructor.

Member Function Documentation

SG::GroveI2CDigital::I2CBus SG::GroveI2CDigital::detect_i2c_bus_number ( const bool  force_detect = false,
const int  force_bus_number = -1 
)
staticinherited

Detect the I2C bus to use to talk to Grove I2C devices.

This is normally 1 or 2. The detection consists of looking at /dev/i2c* devices.

Parameters
[in]force_detectThe detected bus number is usually remembered to prevent having to re-detect it every time a new GroveI2C object is instantiated. If force_detect is set to true, then this will force GroveI2C to ignore the previously cached bus number and re-detect the I2C bus.
[in]force_bus_numberIf an explicit bus number should be used, then force_bus_number can be set to the correct bus value. This will prevent calls to detect_i2c_bus_number() from attempting to auto-detect the I2C bus. Setting the I2C bus number this way wont change existing GroveI2C objects that have already been instantiated. Only new objects will use the new bus number. The actual bus number used by specific objects is i2c_bus_number.
Exceptions
std::system_errorif /dev cannot be opened.
std::runtime_errorif the I2C bus cannot be found in /dev.

Referenced by SG::GroveI2CDigital::is_digital().

Here is the caller graph for this function:

I2CADC& SG::I2CADC::disable_automatic_mode ( void  )
inline

The I2CADC can be configured to perform auto conversions.

When automatic mode is disabled, the I2CADC can enter low-power mode, and a conversion is only started whenever the result register (register #0) is read.

Disabling automatic mode is equivalent to calling enable_automatic_mode(0).

Note
The Vmin and Vmax conversion registers (#6 and #7) which store the lowest and highest values seen by the I2CADC are not updated when automatic mode has been disabled.
See also
enable_automatic_mode()

References enable_automatic_mode().

Here is the call graph for this function:

SG::I2CADC & SG::I2CADC::enable_automatic_mode ( const uint8_t  value = 1)

The I2CADC can be configured to perform periodic auto conversions.

When enabled, the I2CADC will not go into low-power mode, but instead will periodically perform analog-to-digital conversions, set alerts if necessary, remember high and low values, and store the most recent result into the conversion result register.

Parameters
[in]valueDetermines the conversion interval. Must be between 0 and 7 (total of 3 bits). When auto-conversion is enabled, the I2CADC can be configured to perform between 0.4 and 27 thousands samples per second (ksps).
Value Binary Meaning
0 0b0000 automatic conversion mode is disabled.
1 0b0001 cycle time x 32 (27 ksps)
2 0b0010 cycle time x 64 (13.5 ksps)
3 0b0011 cycle time x 128 (6.7 ksps)
4 0b0100 cycle time x 256 (3.4 ksps)
5 0b0101 cycle time x 512 (1.7 ksps)
6 0b0110 cycle time x 1024 (0.9 ksps)
7 0b0111 cycle time x 2048 (0.4 ksps)
See also
ADC121C021 datasheet, page 19 ("configuration register")
ADC121C021 datasheet, page 27 ("automatic conversion mode")

References kConfiguration, read8(), and write8().

Referenced by disable_automatic_mode(), and temperature().

Here is the call graph for this function:

Here is the caller graph for this function:

I2CAddress SG::GroveI2CDigital::get_address_from_type ( void  ) const
inlineinherited

Get the address for this Grove type.

References SG::GroveI2CDigital::get_address_from_type(), SG::GroveBase::get_type(), SG::GroveI2CDigital::read16(), and SG::GroveI2CDigital::read8().

Referenced by SG::GroveI2CDigital::get_address_from_type(), SG::GroveI2CDigital::GroveI2CDigital(), and SG::GroveI2CDigital::is_digital().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t SG::I2CADC::get_and_reset_maximum_result ( void  )
inline

Get the maximum conversion result and reset the register.

References get_maximum_result(), read12(), read8(), reset_maximum_result(), write16(), and write8().

Here is the call graph for this function:

uint16_t SG::I2CADC::get_and_reset_minimum_result ( void  )
inline

Get the minimum conversion result and reset the register.

References get_minimum_result(), and reset_minimum_result().

Here is the call graph for this function:

uint16_t SG::I2CADC::get_maximum_result ( void  )
inline

Return the highest conversion result seen since the I2CADC was last reset.

This is the 12-bit value stored in register Vmin (0x06).

Note
This register is only updated when automatic mode has been enabled.

References kHighestConversion, and read12().

Referenced by get_and_reset_maximum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t SG::I2CADC::get_minimum_result ( void  )
inline

Return the lowest conversion result seen since the I2CADC was last reset.

This is the 12-bit value stored in register Vmin (0x06).

Note
This register is only updated when automatic mode has been enabled.

References kLowestConversion, and read12().

Referenced by get_and_reset_minimum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual std::string SG::GroveBase::get_name ( void  ) const
inlinevirtualinherited

Return the user-supplied name.

References SG::GroveBase::get_description(), SG::GroveBase::grove_name, SG::GroveBase::is_grove_gpio(), SG::GroveBase::is_grove_i2c(), and SG::GroveBase::is_grove_uart().

Referenced by SG::GroveBase::get_description(), SG::GroveBase::operator=(), and SG::GroveBase::operator==().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t SG::I2CADC::get_result ( void  )
inline

Read the most recent 12-bit analog-to-digital conversion result register (0x00).

If automatic mode is disabled, this will force the I2CADC to immediatelly perform a conversion.

When you have an analog Grove twig connected to an I2CADC, this is the method to call to read the value from the connected Grove. The value returned will only have 12 bits, even though the C++ type is uint16_t. This is because the I2CADC specifically stores only 12 bits. This means the result will be between 0 and 4095 (0x0fff).

Note
For advanced users, if you have enabled alerts on the I2CADC and need to inspect the alert flag, call read16(0x00) instead to get access to bit D15. Calling get_result() will mask out the upper 4 bits, including the alert flag.

References kConversionResult, and read12().

Referenced by SG::TemperatureSensor::get_celsius().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual uint32_t SG::GroveBase::get_sku ( void  ) const
inlinevirtualinherited

Return a guess as to the Seeed SKU number based on the grove type.

References SG::get_sku_from_grove_type(), and SG::GroveBase::grove_type.

Referenced by SG::GroveBase::get_description().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual EGroveType SG::GroveBase::get_type ( void  ) const
inlinevirtualinherited

Return the grove type.

References SG::GroveBase::grove_type.

Referenced by SG::GroveI2CDigital::get_address_from_type(), SG::GroveBase::operator=(), and SG::GroveBase::operator==().

Here is the caller graph for this function:

virtual std::string SG::GroveBase::get_type_name ( void  ) const
inlinevirtualinherited

Return a short text string representing the grove type.

References SG::GroveBase::grove_type, and SG::to_string().

Referenced by SG::GroveBase::get_description().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool SG::GroveI2CDigital::is_analog ( void  ) const
inlinevirtualinherited

This is always false for GroveI2CDigital.

Implements SG::GroveI2C.

virtual bool SG::GroveI2CDigital::is_digital ( void  ) const
inlinevirtualinherited

This is always true for GroveI2CDigital.

Implements SG::GroveI2C.

References SG::GroveI2CDigital::detect_i2c_bus_number(), and SG::GroveI2CDigital::get_address_from_type().

Here is the call graph for this function:

virtual bool SG::GroveI2C::is_grove_gpio ( void  ) const
inlinevirtualinherited

This is always false for GroveI2C.

Implements SG::GroveBase.

References SG::GroveI2C::is_analog(), and SG::GroveI2C::is_digital().

Here is the call graph for this function:

virtual bool SG::GroveI2C::is_grove_i2c ( void  ) const
inlinevirtualinherited

This is always true for GroveI2C.

Implements SG::GroveBase.

virtual bool SG::GroveI2C::is_grove_uart ( void  ) const
inlinevirtualinherited

This is always false for GroveI2C.

Implements SG::GroveBase.

bool SG::GroveBase::operator!= ( const GroveBase rhs) const
inlineinherited

Test object equality.

References SG::GroveBase::operator==().

Here is the call graph for this function:

bool SG::I2CADC::operator!= ( const I2CADC rhs) const
inline

Test object equality.

References operator==(), and reset().

Here is the call graph for this function:

bool SG::GroveBase::operator== ( const GroveBase rhs) const
inherited

Test object equality.

References SG::GroveBase::get_name(), and SG::GroveBase::get_type().

Referenced by SG::GroveBase::operator!=(), SG::Buzzer::operator==(), SG::TemperatureAndHumiditySensor::operator==(), SG::TemperatureSensor::operator==(), and operator==().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SG::I2CADC::operator== ( const I2CADC rhs) const

Test object equality.

References SG::GroveI2CDigital::i2c_address, and SG::GroveBase::operator==().

Referenced by operator!=().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual uint16_t SG::GroveI2CDigital::read12 ( const I2CRegister  reg)
inlinevirtualinherited

Read a 16-bit word from the specified register, but only keep the bottom 12 bits.

Some devices such as the I2CADC return 12-bit values.

References SG::GroveI2CDigital::read16(), SG::GroveI2CDigital::read_block(), SG::GroveI2CDigital::write16(), SG::GroveI2CDigital::write8(), SG::GroveI2CDigital::write_block(), and SG::GroveI2CDigital::write_byte().

Referenced by read12().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t SG::I2CADC::read12 ( const ERegister  reg)
virtual

For convenience, read + write using the register enum.

References SG::GroveI2CDigital::read12().

Referenced by get_and_reset_maximum_result(), get_maximum_result(), get_minimum_result(), and get_result().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t SG::GroveI2CDigital::read16 ( const I2CRegister  reg)
virtualinherited

Read a 16-bit word from the specified register.

Exceptions
std::system_errorif the register cannot be read.
Note
The high/low bytes in the 16-bit word are swapped after reading.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::GroveI2CDigital::get_address_from_type(), and SG::GroveI2CDigital::read12().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t SG::GroveI2CDigital::read8 ( const I2CRegister  reg)
virtualinherited

Read a byte (8 bits) from the specificed register.

Exceptions
std::system_errorif the register cannot be read.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::GroveI2CDigital::get_address_from_type(), SG::ThreeAxisDigitalCompass::get_config(), SG::ThreeAxisDigitalCompass::get_data(), SG::ThreeAxisDigitalCompass::get_mode(), SG::ThreeAxisDigitalCompass::get_status(), and read8().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t SG::I2CADC::read8 ( const ERegister  reg)
virtual

For convenience, read + write using the register enum.

References SG::GroveI2CDigital::read8().

Referenced by enable_automatic_mode(), and get_and_reset_maximum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::GroveI2CDigital::I2CBlock SG::GroveI2CDigital::read_block ( const I2CRegister  reg)
virtualinherited

Read a consecutive block of bytes, anywhere between 1 and 32 bytes in length.

See also
write_block()
Exceptions
std::system_errorif the register cannot be read.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::GroveI2CDigital::read12().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::I2CADC & SG::I2CADC::reset ( void  )

Reset the I2CADC configuration.

This stores a default value into every register, similar to when it is first powered on.

The exact default values for each register are described in the ADC121C021 datasheet, pages 18-22.

References kAlertStatus, kConfiguration, kHighestConversion, kHighLimit, kHysteresis, kLowestConversion, kLowLimit, write16(), and write8().

Referenced by operator!=().

Here is the call graph for this function:

Here is the caller graph for this function:

I2CADC& SG::I2CADC::reset_maximum_result ( void  )
inline

Reset the maximum conversion value stored in register 0x07 when automatic conversion mode is enabled.

References kHighestConversion, and write16().

Referenced by get_and_reset_maximum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

I2CADC& SG::I2CADC::reset_minimum_result ( void  )
inline

Reset the minimum conversion value stored in register 0x06 when automatic conversion mode is enabled.

References kLowestConversion, and write16().

Referenced by get_and_reset_minimum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::GroveI2CDigital & SG::GroveI2CDigital::write16 ( const I2CRegister  reg,
const uint16_t  value 
)
virtualinherited
Note
The high/low bytes in the 16-bit word are swapped prior to writting.
Exceptions
std::system_errorif the value cannot be written.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::GroveI2CDigital::read12(), and write16().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::I2CADC & SG::I2CADC::write16 ( const ERegister  reg,
const uint16_t  value 
)
virtual

For convenience, read + write using the register enum.

References SG::GroveI2CDigital::write16().

Referenced by get_and_reset_maximum_result(), reset(), reset_maximum_result(), and reset_minimum_result().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::GroveI2CDigital & SG::GroveI2CDigital::write8 ( const I2CRegister  reg,
const uint8_t  value 
)
virtualinherited

Write the given value to the specified register.

Exceptions
std::system_errorif the value cannot be written.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::GroveI2CDigital::read12(), SG::ThreeAxisDigitalCompass::set_config(), SG::ThreeAxisDigitalCompass::set_mode(), and write8().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::I2CADC & SG::I2CADC::write8 ( const ERegister  reg,
const uint8_t  value 
)
virtual

For convenience, read + write using the register enum.

References SG::GroveI2CDigital::write8().

Referenced by enable_automatic_mode(), get_and_reset_maximum_result(), and reset().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::GroveI2CDigital & SG::GroveI2CDigital::write_block ( const I2CRegister  reg,
const I2CBlock v 
)
virtualinherited

Write a consecutive block of bytes, anywhere between 1 and 32 bytes in length.

See also
read_block()
Exceptions
std::length_errorif the block is too long to write.
std::system_errorif the block failed to write.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, SG::GroveI2CDigital::i2c_file_handle, and SG::BeagleBone::Detect::to_string().

Referenced by SG::CommonOLED::flood(), SG::GroveI2CDigital::read12(), SG::OLED096::reset(), SG::CommonOLED::send_command(), SG::CommonOLED::set_display_bitmap(), SG::CommonOLED::set_orientation(), and SG::CommonOLED::show().

Here is the call graph for this function:

Here is the caller graph for this function:

SG::GroveI2CDigital & SG::GroveI2CDigital::write_block ( const I2CBlock v)
virtualinherited

Write a consecutive block of bytes directly to the I2C file handle.

Exceptions
std::system_errorif the block failed to write.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, SG::GroveI2CDigital::i2c_file_handle, and SG::BeagleBone::Detect::to_string().

Here is the call graph for this function:

SG::GroveI2CDigital & SG::GroveI2CDigital::write_byte ( const uint8_t  value)
virtualinherited

Write a single byte to the I2C bus.

Exceptions
std::system_errorif the value cannot be writen.

References SG::GroveBase::get_description(), SG::GroveI2CDigital::i2c_address, and SG::GroveI2CDigital::i2c_file_handle.

Referenced by SG::OLED096::all_off_display(), SG::OLED096::all_on_display(), SG::OLED096::invert_display(), SG::OLED096::normal_display(), SG::GroveI2CDigital::read12(), and SG::CommonOLED::set_display_bitmap().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::string SG::GroveBase::grove_name
inherited

User-supplied name.

Referenced by SG::GroveBase::get_name(), and SG::GroveBase::operator=().

I2CBus SG::GroveI2CDigital::i2c_bus_number
inherited

The bus number to use for I2C Grove twigs.

The exposed I2C bus is usually 1 or 2. This is normally auto-detected by detect_i2c_bus_number() called by the constructor, and doesn't need to be manually set.

Referenced by SG::GroveI2CDigital::GroveI2CDigital().


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