Adafruit TinyWireM Library
Public Member Functions | List of all members
USI_TWI Class Reference

class USI_TWI : public Stream More...

#include <TinyWireM.h>

Public Member Functions

void begin ()
 Initialize library for main function.
 
void beginTransmission (uint8_t)
 Setup address & write bit. More...
 
size_t write (uint8_t)
 Buffers up data to send. More...
 
size_t write (uint8_t *d, uint8_t n)
 Sends data. More...
 
size_t write (unsigned long n)
 Sends data. More...
 
size_t write (long n)
 Sends data. More...
 
size_t write (unsigned int n)
 Sends data. More...
 
size_t write (int n)
 Sends data. More...
 
void send (uint8_t b)
 Buffers up data to send. More...
 
void send (uint8_t *d, uint8_t n)
 Sends data. More...
 
void send (int n)
 Sends data. More...
 
uint8_t endTransmission ()
 Ends the transmission. More...
 
uint8_t endTransmission (uint8_t)
 Ends the transmission. More...
 
uint8_t requestFrom (uint8_t, uint8_t)
 Setup for receiving from secondary. More...
 
int read ()
 Returns the bytes received one at a time. More...
 
int available ()
 The bytes available htat haven't been read yet. More...
 
int peek (void)
 Returns the top value. More...
 
void flush (void)
 Flushes the buffer.
 
uint8_t receive (void)
 Receives data from the device. More...
 
void end ()
 Function for generating a TWI Stop Condition. Used to release the TWI bus.
 

Detailed Description

class USI_TWI : public Stream

Member Function Documentation

◆ beginTransmission()

void USI_TWI::beginTransmission ( uint8_t  slaveAddr)

Setup address & write bit.

Parameters
slaveAddrSecondary device address

◆ write() [1/6]

size_t USI_TWI::write ( uint8_t  data)

Buffers up data to send.

Parameters
dataData to send
Returns
Returns 1 when successful

◆ write() [2/6]

size_t USI_TWI::write ( uint8_t *  d,
uint8_t  n 
)
inline

Sends data.

Parameters
dData buffer
nHow much data to send
Returns
Returns 1 when successful

◆ write() [3/6]

size_t USI_TWI::write ( unsigned long  n)
inline

Sends data.

Parameters
nData to send
Returns
Returns 1 when successful

◆ write() [4/6]

size_t USI_TWI::write ( long  n)
inline

Sends data.

Parameters
nData to send
Returns
Returns 1 when successful

◆ write() [5/6]

size_t USI_TWI::write ( unsigned int  n)
inline

Sends data.

Parameters
nData to send
Returns
Returns 1 when successful

◆ write() [6/6]

size_t USI_TWI::write ( int  n)
inline

Sends data.

Parameters
nData to send
Returns
Returns 1 when successful

◆ send() [1/3]

void USI_TWI::send ( uint8_t  b)
inline

Buffers up data to send.

Parameters
bData to send
Returns
Returns 1 when successful

◆ send() [2/3]

void USI_TWI::send ( uint8_t *  d,
uint8_t  n 
)
inline

Sends data.

Parameters
dBuffer to send from
nHow much to send from buffer
Returns
Returns 1 when successful

◆ send() [3/3]

void USI_TWI::send ( int  n)
inline

Sends data.

Parameters
nData to send
Returns
Returns 1 when successful

◆ endTransmission() [1/2]

uint8_t USI_TWI::endTransmission ( )

Ends the transmission.

Returns
Returns the error code if there was one

◆ endTransmission() [2/2]

uint8_t USI_TWI::endTransmission ( uint8_t  stop)

Ends the transmission.

Parameters
stopBuffer to send to end the transmission
Returns
Returns the error code if there was one

◆ requestFrom()

uint8_t USI_TWI::requestFrom ( uint8_t  slaveAddr,
uint8_t  numBytes 
)

Setup for receiving from secondary.

Parameters
slaveAddrSecondary device address
numBytesHow many bytes to request
Returns
Returns 0, if there was an error, returns the error code

◆ read()

int USI_TWI::read ( )

Returns the bytes received one at a time.

Returns
Returns the bytes received one at a time

◆ available()

int USI_TWI::available ( )

The bytes available htat haven't been read yet.

Returns
Returns how many bytes are available

◆ peek()

int USI_TWI::peek ( void  )

Returns the top value.

Returns
Returns the top value

◆ receive()

uint8_t USI_TWI::receive ( void  )
inline

Receives data from the device.

Returns
Returns the data

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