PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Network
libwifi
replyStringIn.c
1
/*
2
@file replyStringIn.c
3
4
@author Andy Lindsay
5
6
@version 0.80 for firmware 1.0
7
8
@copyright
9
Copyright (C) Parallax, Inc. 2017. All Rights MIT Licensed.
10
11
@brief API for the Parallax WX Wi-Fi Module ESP8266-WROOM-02.
12
*/
13
14
15
#include "
simpletools.h
"
16
#include "
fdserial.h
"
17
#include "
wifi.h
"
18
19
20
int
wifi_replyStringIn(
int
maxByteCount);
21
void
wifi_replyStringDisplay(
char
*s);
22
void
wifi_simpletermSuspend(
void
);
23
void
wifi_simpletermResume(
void
);
24
25
26
fdserial
*wifi_fds;
27
int
wifi_pin_do;
28
int
wifi_pin_di;
29
int
wifi_baud;
30
int
wifi_comSelectPin;
31
32
int
simpleterm_toRxDi;
33
int
simpleterm_fromTxDo;
34
int
wifi_msReplyTimeout;
35
36
char
wifi_event;
37
char
wifi_status;
38
int
wifi_id;
39
int
wifi_handle;
40
41
int
wifi_timeoutFlag;
42
43
char
*wifi_buf;
44
int
wifi_buf_size;
45
46
47
int
wifi_replyStringIn(
int
maxByteCount)
48
{
49
wifi_timeoutFlag = 0;
50
int
n = 0;
51
wifi_buf[n] = 0;
52
53
volatile
int
dt =
CLKFREQ
;
54
volatile
int
t =
CNT
;
55
while
(1)
56
{
57
if
((
CNT
- t) > dt)
58
{
59
wifi_timeoutFlag = 1;
60
break
;
61
}
62
if
(
fdserial_rxCount
(wifi_fds) > 0)
63
{
64
wifi_buf[n] =
fdserial_rxChar
(wifi_fds);
65
n++;
66
wifi_buf[n] = 0;
67
if
((wifi_buf[n-1] ==
'\r'
) || (n == wifi_buf_size - 1) || (n == maxByteCount))
break
;
68
}
69
}
70
return
n;
71
}
72
73
wifi.h
API for the Parallax WX Wi-Fi Module ESP8266-WROOM-02 (Part #32420). This library has a preliminary A...
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition:
propeller.h:46
fdserial_rxCount
int fdserial_rxCount(fdserial *term)
Get number of bytes available in the receive buffer without receiving any. NOTE: This function is not...
Definition:
fdserial_utils.c:79
text_struct
Structure that contains data used by simple text device libraries.
Definition:
simpletext.h:81
CNT
#define CNT
The system clock count.
Definition:
propeller1.h:151
fdserial_rxChar
int fdserial_rxChar(fdserial *term)
Get a byte from the receive buffer, or if it's emtpy, wait until a byte is received.
Definition:
fdserial.c:164
fdserial.h
This library supports creating and managing one or more full duplex serial connections with periphera...
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17