Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
3b589e21
Commit
3b589e21
authored
Jan 22, 2016
by
Arnim Läuger
Browse files
Merge pull request #958 from DiUS/modules-gnu11
Enable -std=gnu11 for modules dir.
parents
aac98243
0cd287e6
Changes
29
Show whitespace changes
Inline
Side-by-side
Makefile
View file @
3b589e21
...
...
@@ -131,8 +131,8 @@ CCFLAGS += \
-mtext-section-literals
# -Wall
CFLAGS
=
$(CCFLAGS)
$(DEFINES)
$(EXTRA_CCFLAGS)
$(INCLUDES)
DFLAGS
=
$(CCFLAGS)
$(DDEFINES)
$(EXTRA_CCFLAGS)
$(INCLUDES)
CFLAGS
=
$(CCFLAGS)
$(DEFINES)
$(EXTRA_CCFLAGS)
$(STD_CFLAGS)
$(INCLUDES)
DFLAGS
=
$(CCFLAGS)
$(DDEFINES)
$(EXTRA_CCFLAGS)
$(STD_CFLAGS)
$(INCLUDES)
#############################################################
...
...
app/coap/coap.h
View file @
3b589e21
...
...
@@ -192,6 +192,11 @@ void coap_setup(void);
void
endpoint_setup
(
void
);
int
coap_buildOptionHeader
(
uint32_t
optDelta
,
size_t
length
,
uint8_t
*
buf
,
size_t
buflen
);
int
check_token
(
coap_packet_t
*
pkt
);
#include "uri.h"
int
coap_make_request
(
coap_rw_buffer_t
*
scratch
,
coap_packet_t
*
pkt
,
coap_msgtype_t
t
,
coap_method_t
m
,
coap_uri_t
*
uri
,
const
uint8_t
*
payload
,
size_t
payload_len
);
#ifdef __cplusplus
}
...
...
app/driver/key.c
View file @
3b589e21
...
...
@@ -17,7 +17,7 @@
#include "driver/key.h"
LOCAL
void
key_intr_handler
(
struct
keys_param
*
keys
);
LOCAL
void
ICACHE_RAM_ATTR
key_intr_handler
(
void
*
arg
);
/******************************************************************************
* FunctionName : key_init_single
...
...
@@ -130,8 +130,9 @@ key_50ms_cb(struct single_key_param *single_key)
* Returns : none
*******************************************************************************/
LOCAL
void
key_intr_handler
(
struct
keys_param
*
keys
)
key_intr_handler
(
void
*
arg
)
{
struct
keys_param
*
keys
=
arg
;
uint8
i
;
uint32
gpio_status
=
GPIO_REG_READ
(
GPIO_STATUS_ADDRESS
);
...
...
app/driver/pwm.c
View file @
3b589e21
...
...
@@ -306,8 +306,9 @@ pwm_get_freq(uint8 channel)
* Returns : NONE
*******************************************************************************/
LOCAL
void
ICACHE_RAM_ATTR
pwm_tim1_intr_handler
(
void
)
pwm_tim1_intr_handler
(
void
*
p
)
{
(
void
)
p
;
uint8
local_toggle
=
pwm_toggle
;
// pwm_toggle may change outside
RTC_CLR_REG_MASK
(
FRC1_INT_ADDRESS
,
FRC1_INT_CLR_MASK
);
...
...
app/include/driver/spi.h
View file @
3b589e21
...
...
@@ -2,7 +2,7 @@
#define SPI_APP_H
#include "spi_register.h"
#include "
ets_sys
.h"
#include "
rom
.h"
#include "osapi.h"
#include "uart.h"
#include "os_type.h"
...
...
app/include/lwipopts.h
View file @
3b589e21
...
...
@@ -789,7 +789,6 @@
#ifndef LWIP_MDNS
#define LWIP_MDNS 1
#endif
/*
/*
----------------------------------
---------- DNS options -----------
...
...
app/include/rom.h
View file @
3b589e21
...
...
@@ -4,6 +4,7 @@
#define _ROM_H_
#include "c_types.h"
#include "ets_sys.h"
// SHA1 is assumed to match the netbsd sha1.h headers
#define SHA1_DIGEST_LENGTH 20
...
...
@@ -44,7 +45,7 @@ extern unsigned char * base64_decode(const unsigned char *src, size_t len, size_
extern
void
mem_init
(
void
*
start_addr
);
// Interrupt Service Routine functions
typedef
void
(
*
ets_isr_fn
)
(
void
*
arg
,
uint32_t
sp
);
typedef
void
(
*
ets_isr_fn
)
(
void
*
arg
);
extern
int
ets_isr_attach
(
unsigned
int
interrupt
,
ets_isr_fn
,
void
*
arg
);
extern
void
ets_isr_mask
(
unsigned
intr
);
extern
void
ets_isr_unmask
(
unsigned
intr
);
...
...
@@ -108,4 +109,35 @@ typedef void (*exception_handler_fn) (struct exception_frame *ef, uint32_t cause
*/
exception_handler_fn
_xtos_set_exception_handler
(
uint32_t
cause
,
exception_handler_fn
handler
);
void
ets_update_cpu_frequency
(
uint32_t
mhz
);
uint32_t
ets_get_cpu_frequency
(
void
);
void
*
ets_memcpy
(
void
*
dst
,
const
void
*
src
,
size_t
n
);
void
*
ets_memmove
(
void
*
dst
,
const
void
*
src
,
size_t
n
);
void
*
ets_memset
(
void
*
dst
,
int
c
,
size_t
n
);
int
ets_memcmp
(
const
void
*
s1
,
const
void
*
s2
,
size_t
n
);
char
*
ets_strcpy
(
char
*
dst
,
const
char
*
src
);
size_t
ets_strlen
(
const
char
*
s
);
int
ets_strcmp
(
const
char
*
s1
,
const
char
*
s2
);
int
ets_strncmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
n
);
void
ets_delay_us
(
uint32_t
us
);
int
ets_printf
(
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
ets_sprintf
(
char
*
str
,
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
2
,
3
)));
void
ets_str2macaddr
(
uint8_t
*
dst
,
const
char
*
str
);
void
ets_timer_disarm
(
ETSTimer
*
a
);
void
ets_timer_setfn
(
ETSTimer
*
t
,
ETSTimerFunc
*
fn
,
void
*
parg
);
void
Cache_Read_Enable
(
uint32_t
b0
,
uint32_t
b1
,
uint32_t
use_40108000
);
void
Cache_Read_Disable
(
void
);
void
ets_intr_lock
(
void
);
void
ets_intr_unlock
(
void
);
#endif
app/include/rtc/rtctime_internal.h
View file @
3b589e21
...
...
@@ -126,6 +126,7 @@
#include <ets_sys.h>
#include "rom.h"
#include "rtcaccess.h"
#include "user_interface.h"
// Layout of the RTC storage space:
//
...
...
app/libc/c_stdio.c
View file @
3b589e21
...
...
@@ -272,7 +272,6 @@ strtoupper(char *p)
//#include <string.h>
//#include <pmon.h>
#include "c_string.h"
typedef
int
int32_t
;
typedef
unsigned
int
u_int32_t
;
typedef
unsigned
int
u_int
;
typedef
unsigned
long
u_long
;
...
...
app/modules/Makefile
View file @
3b589e21
...
...
@@ -15,6 +15,8 @@ ifndef PDIR
GEN_LIBS
=
libmodules.a
endif
STD_CFLAGS
=
-std
=
gnu11
-Wimplicit
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
...
...
app/modules/cjson.c
View file @
3b589e21
...
...
@@ -43,6 +43,7 @@
#include "c_limits.h"
#include "lauxlib.h"
#include "flash_api.h"
#include "ctype.h"
#include "strbuf.h"
#include "cjson_mem.h"
...
...
app/modules/coap.c
View file @
3b589e21
...
...
@@ -372,7 +372,7 @@ static int coap_request( lua_State* L, coap_method_t m )
if
(
!
pdu
){
if
(
uri
)
c_free
(
uri
);
return
;
return
luaL_error
(
L
,
"alloc fail"
)
;
}
const
char
*
payload
=
NULL
;
...
...
app/modules/enduser_setup.c
View file @
3b589e21
...
...
@@ -36,11 +36,11 @@
#include "platform.h"
#include "c_stdlib.h"
#include "c_string.h"
#include "ctype.h"
#include "user_interface.h"
#include "espconn.h"
#include "flash_fs.h"
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define ENDUSER_SETUP_ERR_FATAL (1 << 0)
...
...
@@ -96,7 +96,7 @@ static void enduser_setup_station_start(void);
static
void
enduser_setup_station_start
(
void
);
static
void
enduser_setup_ap_start
(
void
);
static
void
enduser_setup_ap_stop
(
void
);
static
void
enduser_setup_check_station
(
void
);
static
void
enduser_setup_check_station
(
void
*
p
);
static
void
enduser_setup_debug
(
lua_State
*
L
,
const
char
*
str
);
...
...
@@ -177,8 +177,9 @@ static void enduser_setup_check_station_stop(void)
*
* Check that we've successfully entered station mode.
*/
static
void
enduser_setup_check_station
(
void
)
static
void
enduser_setup_check_station
(
void
*
p
)
{
(
void
)
p
;
struct
ip_info
ip
;
c_memset
(
&
ip
,
0
,
sizeof
(
struct
ip_info
));
...
...
@@ -391,7 +392,7 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
err
=
wifi_station_disconnect
();
if
(
err
==
FALSE
)
{
ENDUSER_SETUP_ERROR
_VOID
(
"enduser_setup_station_start failed. wifi_station_disconnect failed."
,
ENDUSER_SETUP_ERR_UNKOWN_ERROR
,
ENDUSER_SETUP_ERR_NONFATAL
);
ENDUSER_SETUP_ERROR
(
"enduser_setup_station_start failed. wifi_station_disconnect failed."
,
ENDUSER_SETUP_ERR_UNKOWN_ERROR
,
ENDUSER_SETUP_ERR_NONFATAL
);
}
err
=
wifi_station_connect
();
if
(
err
==
FALSE
)
...
...
app/modules/gpio.c
View file @
3b589e21
...
...
@@ -3,6 +3,7 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "rom.h"
#include "c_types.h"
#include "c_string.h"
...
...
app/modules/mqtt.c
View file @
3b589e21
...
...
@@ -15,6 +15,8 @@
#include "mqtt_msg.h"
#include "msg_queue.h"
#include "user_interface.h"
#define MQTT_BUF_SIZE 1024
#define MQTT_DEFAULT_KEEPALIVE 60
#define MQTT_MAX_CLIENT_LEN 64
...
...
@@ -831,7 +833,7 @@ static void socket_connect(struct espconn *pesp_conn)
}
static
void
socket_dns_found
(
const
char
*
name
,
ip_addr_t
*
ipaddr
,
void
*
arg
);
static
dns_reconn_count
=
0
;
static
int
dns_reconn_count
=
0
;
static
ip_addr_t
host_ip
;
// for dns
static
void
socket_dns_found
(
const
char
*
name
,
ip_addr_t
*
ipaddr
,
void
*
arg
)
{
...
...
app/modules/net.c
View file @
3b589e21
...
...
@@ -610,7 +610,7 @@ static void socket_connect(struct espconn *pesp_conn)
}
static
void
socket_dns_found
(
const
char
*
name
,
ip_addr_t
*
ipaddr
,
void
*
arg
);
static
dns_reconn_count
=
0
;
static
int
dns_reconn_count
=
0
;
static
void
socket_dns_found
(
const
char
*
name
,
ip_addr_t
*
ipaddr
,
void
*
arg
)
{
NODE_DBG
(
"socket_dns_found is called.
\n
"
);
...
...
app/modules/node.c
View file @
3b589e21
...
...
@@ -25,6 +25,7 @@
#include "flash_api.h"
#include "flash_fs.h"
#include "user_version.h"
#include "rom.h"
#define CPU80MHZ 80
#define CPU160MHZ 160
...
...
@@ -49,7 +50,7 @@ static int node_deepsleep( lua_State* L )
if
(
option
<
0
||
option
>
4
)
return
luaL_error
(
L
,
"wrong arg range"
);
else
deep_sleep_set_option
(
option
);
system_
deep_sleep_set_option
(
option
);
}
// Set deleep time, skip if nil
if
(
lua_isnumber
(
L
,
1
)
)
...
...
app/modules/rc.c
View file @
3b589e21
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "rom.h"
//#include "driver/easygpio.h"
//static Ping_Data pingA;
#define defPulseLen 185
...
...
app/modules/rtctime.c
View file @
3b589e21
...
...
@@ -87,7 +87,7 @@ static void do_sleep_opt (lua_State *L, int idx)
uint32_t
opt
=
lua_tonumber
(
L
,
idx
);
if
(
opt
<
0
||
opt
>
4
)
luaL_error
(
L
,
"unknown sleep option"
);
deep_sleep_set_option
(
opt
);
system_
deep_sleep_set_option
(
opt
);
}
}
...
...
app/modules/tmr.c
View file @
3b589e21
...
...
@@ -52,6 +52,7 @@ tmr.softwd(int)
#include "lauxlib.h"
#include "platform.h"
#include "c_types.h"
#include "user_interface.h"
#define TIMER_MODE_OFF 3
#define TIMER_MODE_SINGLE 0
...
...
@@ -59,20 +60,6 @@ tmr.softwd(int)
#define TIMER_MODE_AUTO 1
#define TIMER_IDLE_FLAG (1<<7)
//well, the following are my assumptions
//why, oh why is there no good documentation
//chinese companies should learn from Atmel
extern
void
ets_timer_arm_new
(
os_timer_t
*
t
,
uint32_t
milliseconds
,
uint32_t
repeat_flag
,
uint32_t
isMstimer
);
extern
void
ets_timer_disarm
(
os_timer_t
*
t
);
extern
void
ets_timer_setfn
(
os_timer_t
*
t
,
os_timer_func_t
*
f
,
void
*
arg
);
extern
void
ets_delay_us
(
uint32_t
us
);
extern
uint32_t
system_get_time
();
extern
uint32_t
platform_tmr_exists
(
uint32_t
t
);
extern
uint32_t
system_rtc_clock_cali_proc
();
extern
uint32_t
system_get_rtc_time
();
extern
void
system_restart
();
extern
void
system_soft_wdt_feed
();
//in fact lua_State is constant, it's pointless to pass it around
//but hey, whatever, I'll just pass it, still we waste 28B here
typedef
struct
{
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment