mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
fix wifiAP, ip_addr redeclaration and TFT SPI
This commit is contained in:
parent
9de2621b7b
commit
9bb29fc777
@ -173,6 +173,7 @@ void ESP8266WiFiClass::softAP(const char* ssid)
|
|||||||
|
|
||||||
void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int channel)
|
void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int channel)
|
||||||
{
|
{
|
||||||
|
_useApMode = true;
|
||||||
if(_useClientMode) {
|
if(_useClientMode) {
|
||||||
// turn on AP+STA mode
|
// turn on AP+STA mode
|
||||||
mode(WIFI_AP_STA);
|
mode(WIFI_AP_STA);
|
||||||
|
@ -41,9 +41,11 @@ extern "C" {
|
|||||||
|
|
||||||
/* This is the aligned version of ip_addr_t,
|
/* This is the aligned version of ip_addr_t,
|
||||||
used as local variable, on the stack, etc. */
|
used as local variable, on the stack, etc. */
|
||||||
|
#if !defined(IP2STR)
|
||||||
struct ip_addr {
|
struct ip_addr {
|
||||||
u32_t addr;
|
u32_t addr;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the packed version of ip_addr_t,
|
/* This is the packed version of ip_addr_t,
|
||||||
used in network headers that are itself packed */
|
used in network headers that are itself packed */
|
||||||
@ -61,7 +63,9 @@ PACK_STRUCT_END
|
|||||||
|
|
||||||
/** ip_addr_t uses a struct for convenience only, so that the same defines can
|
/** ip_addr_t uses a struct for convenience only, so that the same defines can
|
||||||
* operate both on ip_addr_t as well as on ip_addr_p_t. */
|
* operate both on ip_addr_t as well as on ip_addr_p_t. */
|
||||||
|
#if !defined(IP2STR)
|
||||||
typedef struct ip_addr ip_addr_t;
|
typedef struct ip_addr ip_addr_t;
|
||||||
|
#endif
|
||||||
typedef struct ip_addr_packed ip_addr_p_t;
|
typedef struct ip_addr_packed ip_addr_p_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,11 +97,15 @@ extern const ip_addr_t ip_addr_broadcast;
|
|||||||
#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast)
|
#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast)
|
||||||
|
|
||||||
/** 255.255.255.255 */
|
/** 255.255.255.255 */
|
||||||
|
#if !defined(IPADDR_NONE)
|
||||||
#define IPADDR_NONE ((u32_t)0xffffffffUL)
|
#define IPADDR_NONE ((u32_t)0xffffffffUL)
|
||||||
|
#endif
|
||||||
/** 127.0.0.1 */
|
/** 127.0.0.1 */
|
||||||
#define IPADDR_LOOPBACK ((u32_t)0x7f000001UL)
|
#define IPADDR_LOOPBACK ((u32_t)0x7f000001UL)
|
||||||
/** 0.0.0.0 */
|
/** 0.0.0.0 */
|
||||||
|
#if !defined(IPADDR_ANY)
|
||||||
#define IPADDR_ANY ((u32_t)0x00000000UL)
|
#define IPADDR_ANY ((u32_t)0x00000000UL)
|
||||||
|
#endif
|
||||||
/** 255.255.255.255 */
|
/** 255.255.255.255 */
|
||||||
#define IPADDR_BROADCAST ((u32_t)0xffffffffUL)
|
#define IPADDR_BROADCAST ((u32_t)0xffffffffUL)
|
||||||
|
|
||||||
@ -134,6 +142,7 @@ extern const ip_addr_t ip_addr_broadcast;
|
|||||||
#define IP_LOOPBACKNET 127 /* official! */
|
#define IP_LOOPBACKNET 127 /* official! */
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(IP4_ADDR)
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
/** Set an IP address given by the four byte-parts */
|
/** Set an IP address given by the four byte-parts */
|
||||||
#define IP4_ADDR(ipaddr, a,b,c,d) \
|
#define IP4_ADDR(ipaddr, a,b,c,d) \
|
||||||
@ -150,6 +159,7 @@ extern const ip_addr_t ip_addr_broadcast;
|
|||||||
((u32_t)((b) & 0xff) << 8) | \
|
((u32_t)((b) & 0xff) << 8) | \
|
||||||
(u32_t)((a) & 0xff)
|
(u32_t)((a) & 0xff)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/** MEMCPY-like copying of IP addresses where addresses are known to be
|
/** MEMCPY-like copying of IP addresses where addresses are known to be
|
||||||
* 16-bit-aligned if the port is correctly configured (so a port could define
|
* 16-bit-aligned if the port is correctly configured (so a port could define
|
||||||
@ -217,6 +227,7 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR;
|
|||||||
ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0))
|
ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0))
|
||||||
|
|
||||||
/* Get one byte from the 4-byte address */
|
/* Get one byte from the 4-byte address */
|
||||||
|
#if !defined(IP2STR)
|
||||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||||
@ -227,16 +238,20 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR;
|
|||||||
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
||||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||||
|
#endif
|
||||||
|
|
||||||
/** For backwards compatibility */
|
/** For backwards compatibility */
|
||||||
#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
|
#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
|
||||||
|
|
||||||
|
#if !defined(IP2STR)
|
||||||
u32_t ipaddr_addr(const char *cp)ICACHE_FLASH_ATTR;
|
u32_t ipaddr_addr(const char *cp)ICACHE_FLASH_ATTR;
|
||||||
|
#endif
|
||||||
int ipaddr_aton(const char *cp, ip_addr_t *addr)ICACHE_FLASH_ATTR;
|
int ipaddr_aton(const char *cp, ip_addr_t *addr)ICACHE_FLASH_ATTR;
|
||||||
/** returns ptr to static buffer; not reentrant! */
|
/** returns ptr to static buffer; not reentrant! */
|
||||||
char *ipaddr_ntoa(const ip_addr_t *addr)ICACHE_FLASH_ATTR;
|
char *ipaddr_ntoa(const ip_addr_t *addr)ICACHE_FLASH_ATTR;
|
||||||
char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)ICACHE_FLASH_ATTR;
|
char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
#if !defined(IP2STR)
|
||||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||||
ip4_addr2_16(ipaddr), \
|
ip4_addr2_16(ipaddr), \
|
||||||
ip4_addr3_16(ipaddr), \
|
ip4_addr3_16(ipaddr), \
|
||||||
@ -249,6 +264,7 @@ struct ip_info {
|
|||||||
struct ip_addr netmask;
|
struct ip_addr netmask;
|
||||||
struct ip_addr gw;
|
struct ip_addr gw;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@ void TFT::TFTinit (void)
|
|||||||
pinMode(4, OUTPUT);
|
pinMode(4, OUTPUT);
|
||||||
pinMode(15, OUTPUT);
|
pinMode(15, OUTPUT);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
SPI.setClockDivider(2);
|
SPI.setClockDivider(SPI_CLOCK_DIV2);
|
||||||
|
|
||||||
TFT_CS_HIGH;
|
TFT_CS_HIGH;
|
||||||
TFT_DC_HIGH;
|
TFT_DC_HIGH;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user