wifi.h
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**********************************************************
*
* @file : wifi.h
* @author : HaewonSeo
*
* @note : ESP8266 WiFi Module
*
**********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "NuMicro.h"
#include "cssd_lib.h"
#ifndef __WIFI_H__
#define __WIFI_H__
#define WIFI_PORT UART3_NS // Used to connect to WIFI module
#define BYPASS_PORT UART0_NS // Used to byass WIFI module
//#define LED_Y PC11_NS // Yellow LED
//#define LED_G PC12_NS // Green LED
#define PWR_OFF PD7_NS
#define FW_UPDATE_OFF PD6_NS
#define IOCTL_INIT { \
PD_NS->MODE = (GPIO_MODE_OUTPUT << 6*2) | (GPIO_MODE_OUTPUT << 7*2); }\
//PC_NS->MODE = (GPIO_MODE_OUTPUT << 11*2) | (GPIO_MODE_OUTPUT << 12*2); } \
//PA->MODE = (GPIO_MODE_OUTPUT << 10*2) | (GPIO_MODE_OUTPUT << 11*2) ;}
typedef struct s_netData
{
char *data;
int len;
} t_netData;
void printNetworkData(t_netData *netData);
void WIFI_Init();
void WIFI_Connect();
void WIFI_Read(int);
void WIFI_Write(int, const char *, int);
int WIFI_ReceiveData(int, t_netData *);
int WIFI_SendData(int print, t_netData *netData, int port);
void WIFI_Send_BPM(int pulse);
void WIFI_Send_EncryptedMsg(uint8_t *encryptedMsg, int encryptedMsgBytes, uint32_t body);
void WIFI_Send_DigitallySignedData(t_digitallySignedData *dsd);
void WIFI_Send_EncryptedDigitallySignedData(t_digitallySignedData *dsd);
#endif /* __WIFI_H__ */