1 #ifndef _TWR_ATSHA204_H
2 #define _TWR_ATSHA204_H
4 #include <twr_common.h>
6 #include <twr_scheduler.h>
8 #define TWR_ATSHA204_RX_BUFFER_SIZE 32
35 TWR_ATSHA204_STATE_READY = 0,
36 TWR_ATSHA204_STATE_READ_SERIAL_NUMBER = 1,
37 TWR_ATSHA204_STATE_READ_SERIAL_NUMBER2 = 2,
38 TWR_ATSHA204_STATE_SERIAL_NUMBER = 3
40 } twr_atsha204_state_t;
49 twr_atsha204_state_t _state;
51 uint8_t _rx_buffer[TWR_ATSHA204_RX_BUFFER_SIZE];
bool twr_atsha204_get_serial_number(twr_atsha204_t *self, void *destination, size_t size)
Get serial number.
bool twr_atsha204_is_ready(twr_atsha204_t *self)
Check if is ready for commands.
struct twr_atsha204_t twr_atsha204_t
ATSHA204 instance.
void twr_atsha204_init(twr_atsha204_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize ATSHA204 driver.
bool twr_atsha204_read_serial_number(twr_atsha204_t *self)
Reqeust for serial number.
void twr_atsha204_set_event_handler(twr_atsha204_t *self, void(*event_handler)(twr_atsha204_t *, twr_atsha204_event_t, void *), void *event_param)
Set callback function.
@ TWR_ATSHA204_EVENT_SERIAL_NUMBER
Event serial number is available.
@ TWR_ATSHA204_EVENT_ERROR
Error event.
@ TWR_ATSHA204_EVENT_REVISION_NUMBER
Event revision number is available.
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.