-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathSTM32Ethernet.h
59 lines (48 loc) · 1.93 KB
/
STM32Ethernet.h
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
52
53
54
55
56
57
58
59
#ifndef ethernet_h
#define ethernet_h
#include <inttypes.h>
#include "IPAddress.h"
#include "EthernetClient.h"
#include "EthernetServer.h"
#include "Dhcp.h"
enum EthernetLinkStatus {
Unknown,
LinkON,
LinkOFF
};
class EthernetClass {
private:
IPAddress _dnsServerAddress;
DhcpClass *_dhcp;
public:
// Initialise the Ethernet with the internal provided MAC address and gain the rest of the
// configuration through DHCP.
// Returns 0 if the DHCP configuration failed, and 1 if it succeeded
int begin(unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
EthernetLinkStatus linkStatus();
void begin(IPAddress local_ip);
void begin(IPAddress local_ip, IPAddress subnet);
void begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway);
void begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server);
// Initialise the Ethernet shield to use the provided MAC address and gain the rest of the
// configuration through DHCP.
// Returns 0 if the DHCP configuration failed, and 1 if it succeeded
int begin(uint8_t *mac_address, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
void begin(uint8_t *mac_address, IPAddress local_ip);
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server);
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
int maintain();
void schedule(void);
void MACAddress(uint8_t *mac_address);
IPAddress localIP();
IPAddress subnetMask();
IPAddress gatewayIP();
IPAddress dnsServerIP();
void setMACAddress(const uint8_t *mac_address);
void setDnsServerIP(const IPAddress dns_server);
friend class EthernetClient;
friend class EthernetServer;
};
extern EthernetClass Ethernet;
#endif