#include <TWI.hh>
|
virtual void | on_event (uint8_t type, uint16_t value) |
|
Slave device abstraction. Should set up buffers for request and response and handle incoming requests. See also USI/TWI.hh for definition for ATtiny devices.
Definition at line 129 of file TWI.hh.
TWI::Slave::Slave |
( |
uint8_t |
addr | ) |
|
|
inline |
Construct slave with given address.
- Parameters
-
Definition at line 135 of file TWI.hh.
void TWI::Driver::async_request |
( |
| ) |
|
|
inlineinherited |
Set asynchronous request mode.
Definition at line 94 of file TWI.hh.
void TWI::Slave::begin |
( |
| ) |
|
Start TWI bus logic for the slave device.
Definition at line 290 of file TWI.cpp.
bool TWI::Driver::is_async |
( |
| ) |
const |
|
inlineinherited |
Return true(1) if the request is asyncrhonous otherwise false(0).
Definition at line 78 of file TWI.hh.
virtual void TWI::Slave::on_completion |
( |
uint8_t |
type, |
|
|
int |
count |
|
) |
| |
|
inlinevirtual |
Service completion callback when a read/write has been completed.
- Parameters
-
[in] | type | event code. |
[in] | count | number of bytes in request. |
Reimplemented from TWI::Driver.
Definition at line 163 of file TWI.hh.
void TWI::Slave::on_event |
( |
uint8_t |
type, |
|
|
uint16_t |
value |
|
) |
| |
|
protectedvirtual |
Filter Event::WRITE_COMPLETED_TYPE(size) and calls on_request() with given write block as argument. The device is marked as ready when the request has been completed and a possible result block is available.
- Parameters
-
[in] | type | the event type. |
[in] | value | the event value. |
Reimplemented from Event::Handler.
Definition at line 302 of file TWI.cpp.
virtual void TWI::Slave::on_request |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Service request callback when a write has been completed, i.e., an argument block as been written. Must be defined by sub-class. Must handle write-read and write-write sequences. The device will become ready after the completion of the function.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | size | of buffer. |
Implemented in VLCD::Slave.
void TWI::Slave::read_buf |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
Set read (result) buffer. Must be called before starting TWI.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | size | of buffer. |
Definition at line 319 of file TWI.cpp.
void TWI::Driver::sync_request |
( |
| ) |
|
|
inlineinherited |
Set synchronous request mode.
Definition at line 86 of file TWI.hh.
void TWI::Slave::write_buf |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
Set write (argument) buffer. Must be called before starting TWI.
- Parameters
-
[in] | buf | buffer pointer. |
[in] | size | of buffer. |
Definition at line 312 of file TWI.cpp.
Allow access.
Definition at line 198 of file TWI.hh.
uint8_t TWI::Driver::m_addr |
|
protectedinherited |
Device bus address.
Definition at line 114 of file TWI.hh.
bool TWI::Driver::m_async |
|
protectedinherited |
Asynchronious mode.
Definition at line 117 of file TWI.hh.
const uint8_t TWI::Slave::READ_IX = 1 |
|
staticprotected |
const uint8_t TWI::Slave::WRITE_IX = 0 |
|
staticprotected |
Internal index in io-vector for read/write buffers.
Definition at line 183 of file TWI.hh.
The documentation for this class was generated from the following files: