PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
MyI2CSlave Class Reference
+ Inheritance diagram for MyI2CSlave:
+ Collaboration diagram for MyI2CSlave:

Public Member Functions

template<size_t I2C_BUFFER_SIZE, size_t STACK_SIZE, size_t QUEUE_BUFFER_SIZE>
 MyI2CSlave (uint8_t(&buffer)[I2C_BUFFER_SIZE], const uint32_t(&stack)[STACK_SIZE], uint8_t(&queueBuffer)[QUEUE_BUFFER_SIZE])
 
void run ()
 Enter the loop that will watch and operate the bus.
 
size_t available () const
 Get the amount of bytes in the receive buffer. More...
 
int read ()
 Read the next byte from the receiveBuffer. More...
 
void write (const uint8_t data)
 Send the given byte of data on the bus during a request from the bus master. More...
 

Static Public Member Functions

template<class T >
static int8_t invoke (T &runnable)
 Start a new cog running the given object. More...
 

Static Public Attributes

static const int ADDRESS = 42
 
static const int SHIFTED_ADDRESS = ADDRESS << 1
 
static const Pin::Mask DEFAULT_SCL_MASK = Pin::Mask::P28
 
static const Pin::Mask DEFAULT_SDA_MASK = Pin::Mask::P29
 

Detailed Description

Examples
I2CSlave_Demo.cpp.

Definition at line 36 of file I2CSlave_Demo.cpp.

Member Function Documentation

◆ available()

size_t PropWare::I2CSlave::available ( ) const
inherited

Get the amount of bytes in the receive buffer.

Returns
The amount of bytes in the receive buffer

Definition at line 144 of file i2cslave.h.

◆ invoke()

template<class T >
static int8_t PropWare::Runnable::invoke ( T &  runnable)
staticinherited

Start a new cog running the given object.

Parameters
[in]runnableObject that should be invoked in a new cog
Returns
If the cog was successfully started, the new cog ID is returned. Otherwise, -1 is returned

Definition at line 85 of file runnable.h.

+ Here is the call graph for this function:

◆ read()

int PropWare::I2CSlave::read ( )
inherited

Read the next byte from the receiveBuffer.

Returns
The next byte from the receiveBuffer, -1 when none is available.
Examples
I2CSlave_Demo.cpp.

Definition at line 153 of file i2cslave.h.

◆ write()

void PropWare::I2CSlave::write ( const uint8_t  data)
inherited

Send the given byte of data on the bus during a request from the bus master.

Parameters
[in]dataByte to send to the requesting master.
Warning
Calling this method too late may result in a defective state of the i2c state machine.
Examples
I2CSlave_Demo.cpp.

Definition at line 167 of file i2cslave.h.

+ Here is the caller graph for this function:

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