1 #ifndef _TWR_WSSFM10R1AT_H
2 #define _TWR_WSSFM10R1AT_H
4 #include <twr_scheduler.h>
14 #define TWR_WSSFM10R1AT_TX_FIFO_BUFFER_SIZE 64
15 #define TWR_WSSFM10R1AT_RX_FIFO_BUFFER_SIZE 64
51 TWR_WSSFM10R1AT_STATE_READY = 0,
52 TWR_WSSFM10R1AT_STATE_ERROR = 1,
53 TWR_WSSFM10R1AT_STATE_INITIALIZE = 2,
54 TWR_WSSFM10R1AT_STATE_INITIALIZE_RESET_L = 3,
55 TWR_WSSFM10R1AT_STATE_INITIALIZE_RESET_H = 4,
56 TWR_WSSFM10R1AT_STATE_INITIALIZE_AT_COMMAND = 5,
57 TWR_WSSFM10R1AT_STATE_INITIALIZE_AT_RESPONSE = 6,
58 TWR_WSSFM10R1AT_STATE_SET_POWER_COMMAND = 7,
59 TWR_WSSFM10R1AT_STATE_SET_POWER_RESPONSE = 8,
60 TWR_WSSFM10R1AT_STATE_SEND_RF_FRAME_COMMAND = 9,
61 TWR_WSSFM10R1AT_STATE_SEND_RF_FRAME_RESPONSE = 10,
62 TWR_WSSFM10R1AT_STATE_READ_DEVICE_ID_COMMAND = 11,
63 TWR_WSSFM10R1AT_STATE_READ_DEVICE_ID_RESPONSE = 12,
64 TWR_WSSFM10R1AT_STATE_READ_DEVICE_PAC_COMMAND = 13,
65 TWR_WSSFM10R1AT_STATE_READ_DEVICE_PAC_RESPONSE = 14,
66 TWR_WSSFM10R1AT_STATE_CONTINUOUS_WAVE_COMMAND = 15,
67 TWR_WSSFM10R1AT_STATE_CONTINUOUS_WAVE_RESPONSE = 16,
68 TWR_WSSFM10R1AT_STATE_CONTINUOUS_WAVE = 17,
69 TWR_WSSFM10R1AT_STATE_DEEP_SLEEP_COMMAND = 18,
70 TWR_WSSFM10R1AT_STATE_DEEP_SLEEP_RESPONSE = 19,
71 TWR_WSSFM10R1AT_STATE_DEEP_SLEEP = 20
73 } twr_wssfm10r1at_state_t;
80 twr_wssfm10r1at_state_t _state;
81 twr_wssfm10r1at_state_t _state_after_sleep;
85 uint8_t _tx_fifo_buffer[TWR_WSSFM10R1AT_TX_FIFO_BUFFER_SIZE];
86 uint8_t _rx_fifo_buffer[TWR_WSSFM10R1AT_RX_FIFO_BUFFER_SIZE];
89 char _command[TWR_WSSFM10R1AT_TX_FIFO_BUFFER_SIZE];
90 char _response[TWR_WSSFM10R1AT_RX_FIFO_BUFFER_SIZE];
91 uint8_t _message_buffer[12];
92 size_t _message_length;
twr_gpio_channel_t
GPIO channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
twr_uart_channel_t
UART channels.
bool twr_wssfm10r1at_get_device_id(twr_wssfm10r1at_t *self, char *buffer, size_t buffer_size)
Get device ID (can be called only in TWR_WSSFM10R1AT_EVENT_READ_DEVICE_ID event)
void twr_wssfm10r1at_set_event_handler(twr_wssfm10r1at_t *self, void(*event_handler)(twr_wssfm10r1at_t *, twr_wssfm10r1at_event_t, void *), void *event_param)
Set callback function.
twr_wssfm10r1at_event_t
Callback events.
bool twr_wssfm10r1at_is_ready(twr_wssfm10r1at_t *self)
Check if modem is ready for commands.
bool twr_wssfm10r1at_send_rf_frame(twr_wssfm10r1at_t *self, const void *buffer, size_t length)
Send RF frame command.
bool twr_wssfm10r1at_read_device_id(twr_wssfm10r1at_t *self)
Read device ID command.
void twr_wssfm10r1at_init(twr_wssfm10r1at_t *self, twr_gpio_channel_t reset_signal, twr_uart_channel_t uart_channel)
Initialize WSSFM10R1AT.
struct twr_wssfm10r1at_t twr_wssfm10r1at_t
WSSFM10R1AT instance.
bool twr_wssfm10r1at_read_device_pac(twr_wssfm10r1at_t *self)
Read device PAC command.
bool twr_wssfm10r1at_get_device_pac(twr_wssfm10r1at_t *self, char *buffer, size_t buffer_size)
Get device PAC (can be called only in TWR_WSSFM10R1AT_EVENT_READ_DEVICE_PAC event)
bool twr_wssfm10r1at_continuous_wave(twr_wssfm10r1at_t *self)
Generate continuous wave command.
@ TWR_WSSFM10R1AT_EVENT_SEND_RF_FRAME_DONE
RF frame transmission finished event.
@ TWR_WSSFM10R1AT_EVENT_ERROR
Error event.
@ TWR_WSSFM10R1AT_EVENT_SEND_RF_FRAME_START
RF frame transmission started event.
@ TWR_WSSFM10R1AT_EVENT_READY
Ready event.
@ TWR_WSSFM10R1AT_EVENT_READ_DEVICE_PAC
Device PAC has been read event.
@ TWR_WSSFM10R1AT_EVENT_READ_DEVICE_ID
Device ID has been read event.
Structure of FIFO instance.