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
17typedef 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
21typedef 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
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
47bool Waps_prot_init(waps_request_receive_f cb, uint32_t baudrate, bool flow_ctrl);
48
53
58
62
63#endif /* WAPS_PROTOCOL_H_ */
waps_prot_t waps_prot
bool Waps_prot_init(waps_request_receive_f cb, uint32_t baudrate, bool flow_ctrl)
Initialize WAPS protocol layer and low level layer.
sl_list_head_t waps_ind_queue
void Waps_prot_updateIrqPin(void)
Update IRQ pin state depending on queued indications.
sl_list_head_t waps_reply_queue
void Waps_force_send_indication()
void(* waps_request_receive_f)(waps_item_t *item)
bool Waps_prot_hasIndication(void)
Check if protocol layer has indication stashed.