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

I2C 0.96" OLED display. More...

#include <sg_104030011_OLED96.hpp>

Inheritance diagram for SG::OLED96:
Collaboration diagram for SG::OLED96:

Public Types

enum  ERegister {
  ERegister::kCommand = 0x80,
  ERegister::kData = 0x40
}
 OLED96 registers. More...
 
enum  E8BitCommand {
  E8BitCommand::kDisplayModeNormal = 0xa4,
  E8BitCommand::kDisplayModeAllOn = 0xa5,
  E8BitCommand::kDisplayModeAllOff = 0xa6,
  E8BitCommand::kDisplayModeInverse = 0xa7,
  E8BitCommand::kDisplayOff = 0xae,
  E8BitCommand::kDisplayOn = 0xaf
}
 

Public Member Functions

virtual ~OLED96 (void)
 Destructor. More...
 
 OLED96 (const uint8_t addr, const std::string &n="")
 Constructor requires the I2C address to use. More...
 
OLED96reset (void)
 Reset the OLED96 configuration. More...
 
OLED96cmd_set_display_mode (const uint8_t mode)
 Set the display mode. More...
 
virtual bool is_grove_uart (void) const
 Determine if this is a Grove UART device. More...
 
virtual bool is_grove_i2c (void) const
 Determine if this is a Grove I2C device. More...
 
virtual bool is_grove_gpio (void) const
 Determine if this is a Grove GPIO device. 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 OLED96 &rhs) const
 Test object equality. More...
 
bool operator!= (const OLED96 &rhs) const
 Test object equality. More...
 
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 bool auto_detect (void)
 Tries to detect if a OLED 96*96 is connected to I2C. More...
 

Public Attributes

uint8_t i2c_address
 I2C address. More...
 
int i2c_file_handle
 File handle to /dev/i2c-1. More...
 
EGroveType grove_type
 
std::string grove_name
 

Detailed Description

I2C 0.96" OLED display.

Connect the OLED display to the left-hand-side I2C interface. The I2C address for this I2C device is 0x3c.

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

Member Enumeration Documentation

Enumerator
kDisplayModeNormal 
kDisplayModeAllOn 
kDisplayModeAllOff 
kDisplayModeInverse 
kDisplayOff 
kDisplayOn 
enum SG::OLED96::ERegister
strong

OLED96 registers.

See also
SSD1327 datasheet pages 36-54
Enumerator
kCommand 
kData 

Constructor & Destructor Documentation

SG::OLED96::~OLED96 ( void  )
virtual

Destructor.

SG::OLED96::OLED96 ( const uint8_t  addr,
const std::string &  n = "" 
)

Constructor requires the I2C address to use.

Exceptions
std::system_errorif the I2C device cannot be opened.
std::system_errorif the I2C slave address cannot be set.

References i2c_address, i2c_file_handle, and SG::kI2CADC.

Member Function Documentation

bool SG::OLED96::auto_detect ( void  )
static

Tries to detect if a OLED 96*96 is connected to I2C.

Returns
true if it is possible that a OLED 96x96 is connected to the I2C bus.
false if it seems as if the I2C bus isn't connected to a OLED 96x96.
OLED96& SG::OLED96::cmd_set_display_mode ( const uint8_t  mode)

Set the display mode.

std::string SG::GroveBase::get_description ( void  ) const
virtualinherited

Return a multi-word 1-line description of this object.

References SG::demangle(), and SG::BeagleBone::to_string().

Referenced by buzzer(), chainable_rgb_led(), and temperature().

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::grove_name.

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

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().

Here is the call 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::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::to_string().

Here is the call graph for this function:

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

Determine if this is a Grove GPIO device.

See also
SG::GroveGPIO

Implements SG::GroveBase.

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

Determine if this is a Grove I2C device.

See also
SG::GroveI2C

Implements SG::GroveBase.

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

Determine if this is a Grove UART device.

See also
SG::GroveUART

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::OLED96::operator!= ( const OLED96 rhs) const
inline

Test object equality.

References operator==().

Here is the call graph for this function:

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

Test object equality.

Referenced by operator!=().

Here is the caller graph for this function:

OLED96& SG::OLED96::reset ( void  )

Reset the OLED96 configuration.

Member Data Documentation

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

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

EGroveType SG::GroveBase::grove_type
inherited

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

uint8_t SG::OLED96::i2c_address

I2C address.

Referenced by OLED96().

int SG::OLED96::i2c_file_handle

File handle to /dev/i2c-1.

Referenced by OLED96().


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