Wirepas SDK
waps_protocol.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
7 #ifndef WAPS_PROTOCOL_H_
8 #define WAPS_PROTOCOL_H_
9 
10 #include <stdint.h>
11 #include <stdbool.h>
12 
13 #include "waps_item.h"
14 #include "sl_list.h"
15 
16 // Callback for incoming item
17 typedef void (*waps_request_receive_f)(waps_item_t * item);
18 
19 // Define lower layer directives as function pointers
20 // This way output can easily be selected on boot
21 typedef struct
22 {
23  void (*send_reply)(void);
24  bool (*write_hw)(const void *, uint32_t);
25  void (*frame_removed)(void);
26  bool (*process_response)(waps_item_t *);
27  void (*update_irq)(bool);
28  void (*flush_hw)(void);
30 
31 extern waps_prot_t waps_prot;
32 
33 // Handy access to lower layer via macros
34 #define Waps_prot_sendReply() waps_prot.send_reply()
35 #define Waps_hw_write(a,b) waps_prot.write_hw(a,b)
36 #define Waps_prot_frameRemoved() waps_prot.frame_removed()
37 #define Waps_prot_processResponse(x) waps_prot.process_response(item)
38 #define Waps_prot_updateIrq(x) waps_prot.update_irq(x)
39 #define Waps_prot_flush_hw() waps_prot.flush_hw();
40 
42 
47 bool Waps_prot_init(waps_request_receive_f cb, uint32_t baudrate, bool flow_ctrl);
48 
52 bool Waps_prot_hasIndication(void);
53 
57 void Waps_prot_updateIrqPin(void);
58 
62 
63 #endif /* WAPS_PROTOCOL_H_ */
sl_list_head_t
Definition: sl_list.h:55
waps_prot
waps_prot_t waps_prot
waps_request_receive_f
void(* waps_request_receive_f)(waps_item_t *item)
Definition: waps_protocol.h:17
Waps_prot_updateIrqPin
void Waps_prot_updateIrqPin(void)
Update IRQ pin state depending on queued indications.
waps_ind_queue
sl_list_head_t waps_ind_queue
waps_prot_t
Definition: waps_protocol.h:21
Waps_prot_hasIndication
bool Waps_prot_hasIndication(void)
Check if protocol layer has indication stashed.
Waps_prot_init
bool Waps_prot_init(waps_request_receive_f cb, uint32_t baudrate, bool flow_ctrl)
Initialize WAPS protocol layer and low level layer.
Waps_force_send_indication
void Waps_force_send_indication()
waps_reply_queue
sl_list_head_t waps_reply_queue
waps_item.h
sl_list.h
waps_item_t
Definition: waps_item.h:34