39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define WIRELESSSUN_CMD_HELP "help"
74#define WIRELESSSUN_CMD_VERS "vers"
75#define WIRELESSSUN_CMD_VERNUM "vernum"
76#define WIRELESSSUN_CMD_RESET "reset"
77#define WIRELESSSUN_CMD_SLEEP "sleep"
78#define WIRELESSSUN_CMD_ECHO "echo"
79#define WIRELESSSUN_CMD_JSON "json"
80#define WIRELESSSUN_CMD_MODE "mode"
81#define WIRELESSSUN_CMD_CHRATE "chrate"
82#define WIRELESSSUN_CMD_CHAN "chan"
83#define WIRELESSSUN_CMD_RCCAL "rccal"
84#define WIRELESSSUN_CMD_MAC "mac"
85#define WIRELESSSUN_CMD_MACF "macf"
86#define WIRELESSSUN_CMD_MTXCTL "mtxctl"
87#define WIRELESSSUN_CMD_PAN "pan"
88#define WIRELESSSUN_CMD_NETNAME "netname"
89#define WIRELESSSUN_CMD_IP "ip"
90#define WIRELESSSUN_CMD_INIT "init"
91#define WIRELESSSUN_CMD_ATSTART "atstart"
92#define WIRELESSSUN_CMD_TCPCON "tcpcon"
93#define WIRELESSSUN_CMD_TCPDIS "tcpdis"
94#define WIRELESSSUN_CMD_LEASEIP "leaseip"
95#define WIRELESSSUN_CMD_LEASERNG "leaserng"
96#define WIRELESSSUN_CMD_STAT "stat"
97#define WIRELESSSUN_CMD_RSTAT "rstat"
98#define WIRELESSSUN_CMD_MSTAT "mstat"
99#define WIRELESSSUN_CMD_FSTAT "fstat"
100#define WIRELESSSUN_CMD_CHCONFIG "chconfig"
101#define WIRELESSSUN_CMD_CHCUR "chcur"
102#define WIRELESSSUN_CMD_MTXAVL "mtxavl"
103#define WIRELESSSUN_CMD_FMSECKEY "fmseckey"
104#define WIRELESSSUN_CMD_NEBR "nebr"
105#define WIRELESSSUN_CMD_PARENT "parent"
106#define WIRELESSSUN_CMD_RPLINF "rplinf"
107#define WIRELESSSUN_CMD_TCPSTAT "tcpstat"
108#define WIRELESSSUN_CMD_RPLSR "rplsr"
109#define WIRELESSSUN_CMD_LEASED "leased"
110#define WIRELESSSUN_CMD_TCPS "tcps"
111#define WIRELESSSUN_CMD_UDPS "udps"
112#define WIRELESSSUN_CMD_UDPST "udpst"
113#define WIRELESSSUN_CMD_PING "ping"
114#define WIRELESSSUN_CMD_TCPOPTS "tcpopts"
115#define WIRELESSSUN_CMD_UDPOPTS "udpopts"
116#define WIRELESSSUN_CMD_RMTCMD "rmtcmd"
117#define WIRELESSSUN_CMD_RMTOPTS "rmtopts"
118#define WIRELESSSUN_CMD_RFEC "rfec"
119#define WIRELESSSUN_CMD_RANTSW "rantsw"
120#define WIRELESSSUN_CMD_FNODE "fnode"
121#define WIRELESSSUN_CMD_AUTH "auth"
122#define WIRELESSSUN_CMD_NODEF "nodef"
123#define WIRELESSSUN_CMD_PARAM "param"
124#define WIRELESSSUN_CMD_SAVE "save"
125#define WIRELESSSUN_CMD_CLEAR "clear"
126#define WIRELESSSUN_CMD_SVRST "svrst"
127#define WIRELESSSUN_CMD_CLRST "clrst"
128#define WIRELESSSUN_CMD_PROMPT_SIGN "\r\n>"
129#define WIRELESSSUN_CMD_DELIMITER " "
130#define WIRELESSSUN_RSP_UDPR "udpr"
136#define WIRELESSSUN_RSP_UDPR "udpr"
137#define WIRELESSSUN_RSP_TCPR "tcpr"
143#define WIRELESSSUN_DEVICE_ROLE_STOP "0"
144#define WIRELESSSUN_DEVICE_ROLE_BORDER "1"
145#define WIRELESSSUN_DEVICE_ROLE_ROUTER "2"
146#define WIRELESSSUN_DEVICE_ROLE_LEAF "3"
152#define WIRELESSSUN_DEFAULT_PORT "3610"
159#define TX_DRV_BUFFER_SIZE 100
160#define RX_DRV_BUFFER_SIZE 600
178#define WIRELESSSUN_MAP_MIKROBUS( cfg, mikrobus ) \
179 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
180 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
181 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
182 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
183 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT );
#define RX_DRV_BUFFER_SIZE
Definition wirelesssun.h:160
#define TX_DRV_BUFFER_SIZE
Wireless SUN driver buffer size.
Definition wirelesssun.h:159
void wirelesssun_set_cts_pin(wirelesssun_t *ctx, uint8_t state)
Wireless SUN set cts pin function.
void wirelesssun_reset_device(wirelesssun_t *ctx)
Wireless SUN reset device function.
void wirelesssun_cfg_setup(wirelesssun_cfg_t *cfg)
Wireless SUN configuration object setup function.
void wirelesssun_send_cmd_with_parameter(wirelesssun_t *ctx, char *cmd, char *param_buf)
Wireless SUN send cmd function.
uint8_t wirelesssun_get_rts_pin(wirelesssun_t *ctx)
Wireless SUN get rts pin function.
void wirelesssun_set_rst_pin(wirelesssun_t *ctx, uint8_t state)
Wireless SUN set rst pin function.
err_t wirelesssun_generic_write(wirelesssun_t *ctx, char *data_in, uint16_t len)
Wireless SUN data writing function.
void wirelesssun_send_cmd(wirelesssun_t *ctx, char *cmd)
Wireless SUN send cmd function.
err_t wirelesssun_generic_read(wirelesssun_t *ctx, char *data_out, uint16_t len)
Wireless SUN data reading function.
err_t wirelesssun_init(wirelesssun_t *ctx, wirelesssun_cfg_t *cfg)
Wireless SUN initialization function.
Wireless SUN Click configuration object.
Definition wirelesssun.h:215
pin_name_t rts
Definition wirelesssun.h:223
uint32_t baud_rate
Definition wirelesssun.h:226
pin_name_t cts
Definition wirelesssun.h:222
bool uart_blocking
Definition wirelesssun.h:227
uart_data_bits_t data_bit
Definition wirelesssun.h:228
pin_name_t tx_pin
Definition wirelesssun.h:218
pin_name_t rx_pin
Definition wirelesssun.h:217
uart_stop_bits_t stop_bit
Definition wirelesssun.h:230
uart_parity_t parity_bit
Definition wirelesssun.h:229
pin_name_t rst
Definition wirelesssun.h:221
Wireless SUN Click context object.
Definition wirelesssun.h:193
uart_t uart
Definition wirelesssun.h:202
digital_in_t rts
Definition wirelesssun.h:199
digital_out_t rst
Definition wirelesssun.h:195
digital_out_t cts
Definition wirelesssun.h:196
wirelesssun_return_value_t
Wireless SUN Click return value data.
Definition wirelesssun.h:239
@ WIRELESSSUN_ERROR
Definition wirelesssun.h:241
@ WIRELESSSUN_OK
Definition wirelesssun.h:240
@ WIRELESSSUN_ERROR_TIMEOUT
Definition wirelesssun.h:242