ESP8266_RTOS_SDK  v1.4.0
esp_misc.h
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef __ESP_MISC_H__
26 #define __ESP_MISC_H__
27 
28 #include "lwip/ip_addr.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
42 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
43 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
44 
45 #define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
46  ip4_addr2_16(ipaddr), \
47  ip4_addr3_16(ipaddr), \
48  ip4_addr4_16(ipaddr)
49 
50 #define IPSTR "%d.%d.%d.%d"
51 
59 void os_delay_us(uint16 us);
60 
72 void os_install_putc1(void (*p)(char c));
73 
81 void os_putc(char c);
82 
86 };
87 
88 struct dhcps_lease {
89  bool enable;
90  struct ip_addr start_ip;
91  struct ip_addr end_ip;
92 };
93 
95  OFFER_START = 0x00,
96  OFFER_ROUTER = 0x01,
98 };
99 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif
void os_putc(char c)
Print a character. Start from from UART0 by default.
Definition: esp_misc.h:88
Definition: esp_misc.h:96
bool enable
Definition: esp_misc.h:89
Definition: esp_misc.h:97
Definition: esp_misc.h:84
struct ip_addr end_ip
Definition: esp_misc.h:91
struct ip_addr start_ip
Definition: esp_misc.h:90
dhcp_status
Definition: esp_misc.h:83
Definition: esp_misc.h:85
Definition: esp_misc.h:95
void os_delay_us(uint16 us)
Delay function, maximum value: 65535 us.
dhcps_offer_option
Definition: esp_misc.h:94
void os_install_putc1(void(*p)(char c))
Register the print output function.