49 spi.
read(&header,
sizeof(header));
50 payload -=
sizeof(header);
55 if (header.
len <= len) {
58 padding = ((res & 1) == 0);
68 for (uint16_t i = 0; i < payload; i++)
spi.
transfer(0);
81 HCI::write(uint8_t type, uint16_t op,
const void* args, uint8_t len,
bool progmem)
84 bool padding = (len & 1) == 0;
140 if (res < 0)
return (res);
143 if (op == event && res == len) {
159 void* data, uint16_t data_len)
163 uint16_t payload = 0;
179 spi.
read(&header,
sizeof(header));
180 payload -=
sizeof(header);
187 if ((uint16_t) res <= data_len) {
193 for (uint8_t i = 0; i < args_len; i++)
spi.
transfer(0);
208 for (uint16_t i = 0; i < payload; i++)
spi.
transfer(0);
222 const void* data, uint16_t data_len,
bool progmem)
225 int len = args_len + data_len;
227 bool padding = (payload & 1) == 0;
228 if (padding) payload += 1;
int read(uint16_t &op, void *args, uint8_t len)
uint8_t transfer(uint8_t data)
SPI Read(0,Payload Length).
HCI Event (SPI_OP_READ only).
void acquire(Driver *dev)
int await(uint16_t op, void *args=NULL, uint8_t len=0)
int write_data(uint8_t op, const void *args, uint8_t args_len, const void *data, uint16_t data_len)
void read(void *buf, size_t count)
static uint32_t since(uint32_t start)
int read_data(uint8_t op, void *args, uint8_t args_len, void *data, uint16_t data_len)
void write(const void *buf, size_t count)
int write(uint8_t type, uint16_t op, const void *args, uint8_t len)
Event::Handler * m_event_handler
volatile bool m_available
SPI Write(Payload Length,0).
void write_P(const uint8_t *buf, size_t count)
HCI Data (both SPI_OP_WRITE/READ).
static const uint8_t EVNT_MAX
virtual void on_event(uint16_t event, void *args, size_t len)=0