Struct capsules::i2c_master_slave_driver::I2CMasterSlaveDriver
[−]
[src]
pub struct I2CMasterSlaveDriver<'a> { i2c: &'a I2CMasterSlave, listening: Cell<bool>, master_action: Cell<MasterAction>, master_buffer: TakeCell<'static, [u8]>, slave_buffer1: TakeCell<'static, [u8]>, slave_buffer2: TakeCell<'static, [u8]>, app: MapCell<App>, }
Fields
i2c: &'a I2CMasterSlave
listening: Cell<bool>
master_action: Cell<MasterAction>
master_buffer: TakeCell<'static, [u8]>
slave_buffer1: TakeCell<'static, [u8]>
slave_buffer2: TakeCell<'static, [u8]>
app: MapCell<App>
Methods
impl<'a> I2CMasterSlaveDriver<'a>
[src]
pub fn new(
i2c: &'a I2CMasterSlave,
master_buffer: &'static mut [u8],
slave_buffer1: &'static mut [u8],
slave_buffer2: &'static mut [u8]
) -> I2CMasterSlaveDriver<'a>
[src]
i2c: &'a I2CMasterSlave,
master_buffer: &'static mut [u8],
slave_buffer1: &'static mut [u8],
slave_buffer2: &'static mut [u8]
) -> I2CMasterSlaveDriver<'a>
Trait Implementations
impl<'a> I2CHwMasterClient for I2CMasterSlaveDriver<'a>
[src]
fn command_complete(&self, buffer: &'static mut [u8], error: Error)
[src]
Called when an I2C command completed. The error
denotes whether the command completed successfully or if an error occured. Read more
impl<'a> I2CHwSlaveClient for I2CMasterSlaveDriver<'a>
[src]
fn command_complete(
&self,
buffer: &'static mut [u8],
length: u8,
transmission_type: SlaveTransmissionType
)
[src]
&self,
buffer: &'static mut [u8],
length: u8,
transmission_type: SlaveTransmissionType
)
Called when an I2C command completed.
fn read_expected(&self)
[src]
Called from the I2C slave hardware to say that a Master has sent us a read message, but the driver did not have a buffer containing data setup, and therefore cannot respond. The I2C slave hardware will stretch the clock while waiting for the upper layer capsule to provide data to send to the remote master. Call I2CSlave::read_send()
to provide data. Read more
fn write_expected(&self)
[src]
Called from the I2C slave hardware to say that a Master has sent us a write message, but there was no buffer setup to read the bytes into. The HW will stretch the clock while waiting for the user to call I2CSlave::write_receive()
with a buffer. Read more
impl<'a> Driver for I2CMasterSlaveDriver<'a>
[src]
fn allow(
&self,
_appid: AppId,
allow_num: usize,
slice: AppSlice<Shared, u8>
) -> ReturnCode
[src]
&self,
_appid: AppId,
allow_num: usize,
slice: AppSlice<Shared, u8>
) -> ReturnCode
allow
lets an application give the driver access to a buffer in the application's memory. This returns ENOSUPPORT
if not used. Read more
fn subscribe(&self, subscribe_num: usize, callback: Callback) -> ReturnCode
[src]
subscribe
lets an application pass a callback to the driver to be called later. This returns ENOSUPPORT
if not used. Read more
fn command(
&self,
command_num: usize,
data: usize,
_: usize,
_: AppId
) -> ReturnCode
[src]
&self,
command_num: usize,
data: usize,
_: usize,
_: AppId
) -> ReturnCode
command
instructs a driver to perform some action synchronously. This returns ENOSUPPORT
if not used. Read more