[I2C] This is used to avoid path resolving issues and defines the common known Arduino Wire-Interface
Don't use manually
More...
#include <eagle_TwoWire.h>
Inherits Stream.
|
| TwoWire () |
| The constructor of the TwoWire class. More...
|
|
void | begin () |
| begin the TwoWire communcation without any data set More...
|
|
void | begin (uint8_t address) |
| begin the TwoWire communication with a special address More...
|
|
void | begin (int address) |
| begin the TwoWire communication with a special address More...
|
|
void | beginTransmission (uint8_t address) |
| this will start a new transmission to a specific address => master mode More...
|
|
void | beginTransmission (int address) |
| this will start a new transmission to a specific address => master mode More...
|
|
uint8_t | endTransmission (void) |
| this will end the transmission and send the STOP-sequence More...
|
|
uint8_t | endTransmission (uint8_t sendStop) |
| this will end the transmission and send the STOP-sequence dependent on sendStop More...
|
|
uint8_t | requestFrom (uint8_t address, uint8_t quantity) |
| this will read a specific quantity of bytes from a specific address More...
|
|
uint8_t | requestFrom (uint8_t address, uint8_t quantity, uint8_t sendStop) |
| this will read a specific quantity of bytes from a specific address More...
|
|
uint8_t | requestFrom (int address, int quantity) |
| this will read a specific quantity of bytes from a specific address More...
|
|
uint8_t | requestFrom (int address, int quantity, int sendStop) |
| this will read a specific quantity of bytes from a specific address More...
|
|
virtual size_t | write (uint8_t data) |
| this will write a single unsigned 8-bit value to address More...
|
|
virtual size_t | write (const uint8_t *data, size_t quantity) |
| this will write an array of unsigned 8-bit values to address More...
|
|
virtual int | available (void) |
| this will return the amount of rxBuffer left More...
|
|
virtual int | read (void) |
| this will read a single byte from rxBuffer and increment the Index More...
|
|
virtual int | peek (void) |
| this will read a single byte from rxBuffer without increment the Index More...
|
|
void | onReceive (void(*function)(int)) |
| this will set the user_onReceive method More...
|
|
void | onRequest (void(*function)(void)) |
| this will set the user_onRequest method More...
|
|
[I2C] This is used to avoid path resolving issues and defines the common known Arduino Wire-Interface
Don't use manually
- Authors
- Nicholas Zambetti for Arduino
-
[mod] Todd Krein
- Copyright
- 2006 GNU Lesser General Public License 2.1 as published by the Free Software Foundation
- Note
- this code was documented and modified by EagleoutIce in 2018 for custom use!
Definition at line 42 of file eagle_TwoWire.h.
◆ TwoWire()
eagle_impl::TwoWire::TwoWire |
( |
| ) |
|
The constructor of the TwoWire class.
◆ available()
virtual int eagle_impl::TwoWire::available |
( |
void |
| ) |
|
|
virtual |
this will return the amount of rxBuffer left
- Returns
- (rxBufferLength-rxBufferIndex)
◆ begin() [1/3]
void eagle_impl::TwoWire::begin |
( |
| ) |
|
begin the TwoWire communcation without any data set
◆ begin() [2/3]
void eagle_impl::TwoWire::begin |
( |
uint8_t |
address | ) |
|
begin the TwoWire communication with a special address
- Parameters
-
address | the address the TwoWire Interface should use |
◆ begin() [3/3]
void eagle_impl::TwoWire::begin |
( |
int |
address | ) |
|
begin the TwoWire communication with a special address
- Parameters
-
address | the address the TwoWire Interface should use |
- Note
- this will cast the address to an uint8_t type and call the same TwoWire::begin()
◆ beginTransmission() [1/2]
void eagle_impl::TwoWire::beginTransmission |
( |
uint8_t |
address | ) |
|
this will start a new transmission to a specific address => master mode
- Parameters
-
address | the address to talk to |
◆ beginTransmission() [2/2]
void eagle_impl::TwoWire::beginTransmission |
( |
int |
address | ) |
|
this will start a new transmission to a specific address => master mode
- Parameters
-
address | the address to talk to |
- Note
- this will cast the address to an uint8_t type and call the same TwoWire::beginTransmission()
◆ endTransmission() [1/2]
uint8_t eagle_impl::TwoWire::endTransmission |
( |
void |
| ) |
|
this will end the transmission and send the STOP-sequence
- Returns
- The following unsigned values:
- 0 in case of success
- 1 if data was too long for transmit buffer
- 2 if received a NACK on transmit of address
- 3 if received a NACK on transmit of data
- 4 if an 'other'/unknown error occured
- Note
- this will call TwoWire::endTransmission() with 'true' as param internally
◆ endTransmission() [2/2]
uint8_t eagle_impl::TwoWire::endTransmission |
( |
uint8_t |
sendStop | ) |
|
this will end the transmission and send the STOP-sequence dependent on sendStop
- Parameters
-
sendStop | set this to true (0x1) if STOP should be send.
Some devices will behave oddly if you set this to false (0x0)! |
- Returns
- The following unsigned values:
- 0 in case of success
- 1 if data was too long for transmit buffer
- 2 if received a NACK on transmit of address
- 3 if received a NACK on transmit of data
- 4 if an 'other'/unknown error occured
◆ onReceive()
void eagle_impl::TwoWire::onReceive |
( |
void(*)(int) |
function | ) |
|
this will set the user_onReceive method
- Parameters
-
function | the function to link |
For further uses see TwoWire::user_onReceive()
◆ onReceiveService()
static void eagle_impl::TwoWire::onReceiveService |
( |
uint8_t * |
inBytes, |
|
|
int |
numBytes |
|
) |
| |
|
staticprivate |
twi slave [Rx]receive-event handler
- Parameters
-
inBytes | array of receive Bytes |
numBytes | length of inBytes array |
◆ onRequest()
void eagle_impl::TwoWire::onRequest |
( |
void(*)(void) |
function | ) |
|
this will set the user_onRequest method
- Parameters
-
function | the function to link |
For further uses see TwoWire::user_onRequest()
◆ onRequestService()
static void eagle_impl::TwoWire::onRequestService |
( |
void |
| ) |
|
|
staticprivate |
twi slave [Tx]transmitting-event handler
◆ peek()
virtual int eagle_impl::TwoWire::peek |
( |
void |
| ) |
|
|
virtual |
this will read a single byte from rxBuffer without increment the Index
- Note
- this has to be called after TwoWire::requestFrom() [or in slave rx event callback]
- Returns
- the read value (-1 if failed)
◆ read()
virtual int eagle_impl::TwoWire::read |
( |
void |
| ) |
|
|
virtual |
this will read a single byte from rxBuffer and increment the Index
- Note
- this has to be called after TwoWire::requestFrom() [or in slave rx event callback]
- Returns
- the read value (-1 if failed)
◆ requestFrom() [1/4]
uint8_t eagle_impl::TwoWire::requestFrom |
( |
uint8_t |
address, |
|
|
uint8_t |
quantity |
|
) |
| |
this will read a specific quantity of bytes from a specific address
- Parameters
-
address | the address to read from |
quantity | the amount if bytes to read |
- Returns
- the amount of read bytes
- Note
- this will call the 3*uint8_t (sendStop = true) variant of TwoWire::requestFrom() internally
◆ requestFrom() [2/4]
uint8_t eagle_impl::TwoWire::requestFrom |
( |
uint8_t |
address, |
|
|
uint8_t |
quantity, |
|
|
uint8_t |
sendStop |
|
) |
| |
this will read a specific quantity of bytes from a specific address
- Parameters
-
address | the address to read from |
quantity | the amount if bytes to read |
sendStop | set this to true (0x1) if STOP should be send.
Some devices will behave oddly if you set this to false (0x0)! |
- Returns
- the amount of read bytes
◆ requestFrom() [3/4]
uint8_t eagle_impl::TwoWire::requestFrom |
( |
int |
address, |
|
|
int |
quantity |
|
) |
| |
this will read a specific quantity of bytes from a specific address
- Parameters
-
address | the address to read from |
quantity | the amount if bytes to read |
- Returns
- the amount of read bytes
- Note
- this will call the 3*uint8_t (sendStop = true) variant of TwoWire::requestFrom() internally
◆ requestFrom() [4/4]
uint8_t eagle_impl::TwoWire::requestFrom |
( |
int |
address, |
|
|
int |
quantity, |
|
|
int |
sendStop |
|
) |
| |
this will read a specific quantity of bytes from a specific address
- Parameters
-
address | the address to read from |
quantity | the amount if bytes to read |
sendStop | set this to true (0x1) if STOP should be send.
Some devices will behave oddly if you set this to false (0x0)! |
- Returns
- the amount of read bytes
- Note
- this will call the 3*uint8_t (sendStop = true) variant of TwoWire::requestFrom() internally
◆ write() [1/2]
virtual size_t eagle_impl::TwoWire::write |
( |
uint8_t |
data | ) |
|
|
virtual |
this will write a single unsigned 8-bit value to address
- Note
- this has to be called after TwoWire::beginTransmission() [or in slave tx event callback]
- Parameters
-
data | the data that should be send if in master-mode it will be stored in buffer! |
- Returns
- 0 in case of an overflow
- 1 when everything worked fine ;)
◆ write() [2/2]
virtual size_t eagle_impl::TwoWire::write |
( |
const uint8_t * |
data, |
|
|
size_t |
quantity |
|
) |
| |
|
virtual |
this will write an array of unsigned 8-bit values to address
- Note
- this has to be called after TwoWire::beginTransmission() [or in slave tx event callback]
- Parameters
-
data | the data array that should be send if in master-mode it will be stored in buffer! |
quantity | the length of the array |
- Returns
- the quantity sent
◆ rxBuffer
uint8_t eagle_impl::TwoWire::rxBuffer[] |
|
staticprivate |
this defines the rxBuffer used to enable delayed read
Definition at line 45 of file eagle_TwoWire.h.
◆ rxBufferIndex
uint8_t eagle_impl::TwoWire::rxBufferIndex |
|
staticprivate |
this defines the rxBuffer Index - current position in rxBuffer array
Definition at line 47 of file eagle_TwoWire.h.
◆ rxBufferLength
uint8_t eagle_impl::TwoWire::rxBufferLength |
|
staticprivate |
◆ transmitting
uint8_t eagle_impl::TwoWire::transmitting |
|
staticprivate |
'boolean' value. Set to 1 if transmitting => in master write mode
Definition at line 61 of file eagle_TwoWire.h.
◆ txAddress
uint8_t eagle_impl::TwoWire::txAddress |
|
staticprivate |
this defines the txAddress the transmitting Dta
Definition at line 52 of file eagle_TwoWire.h.
◆ txBuffer
uint8_t eagle_impl::TwoWire::txBuffer[] |
|
staticprivate |
this defines the txBuffer used to enable delayed read
Definition at line 54 of file eagle_TwoWire.h.
◆ txBufferIndex
uint8_t eagle_impl::TwoWire::txBufferIndex |
|
staticprivate |
this defines the txBuffer Index - current position in txBuffer array
Definition at line 56 of file eagle_TwoWire.h.
◆ txBufferLength
uint8_t eagle_impl::TwoWire::txBufferLength |
|
staticprivate |
◆ user_onReceive
void(* eagle_impl::TwoWire::user_onReceive) (int numBytes) |
|
staticprivate |
twi slave [Rx]receive-event user def handler
- Parameters
-
numBytes | amount of received bytes stored in rxBuffer |
Definition at line 68 of file eagle_TwoWire.h.
◆ user_onRequest
void(* eagle_impl::TwoWire::user_onRequest) (void) |
|
staticprivate |
twi slave [Tx]transmitting-event user def handler
Definition at line 63 of file eagle_TwoWire.h.
The documentation for this class was generated from the following file: