Răsfoiți Sursa

update: 整理luat/include头文件,part1,确保有ifndef+define组合

Wendal Chen 4 ani în urmă
părinte
comite
91642085b9

+ 2 - 2
luat/include/luat_adc.h

@@ -3,8 +3,8 @@
  *  @author wendal
  *  @author wendal
  *  @since 0.1.5
  *  @since 0.1.5
  *****************************************************************************/
  *****************************************************************************/
-#ifndef Luat_ADC
-#define Luat_ADC
+#ifndef Luat_ADC_H
+#define Luat_ADC_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 

+ 2 - 2
luat/include/luat_base.h

@@ -4,8 +4,8 @@
  *  @since 0.0.1
  *  @since 0.0.1
  *****************************************************************************/
  *****************************************************************************/
 
 
-#ifndef LUAT_BASE
-#define LUAT_BASE
+#ifndef LUAT_BASE_H
+#define LUAT_BASE_H
 /**LuatOS版本号*/
 /**LuatOS版本号*/
 #define LUAT_VERSION "V0007"
 #define LUAT_VERSION "V0007"
 #define LUAT_VERSION_BETA 1
 #define LUAT_VERSION_BETA 1

+ 2 - 3
luat/include/luat_cmux.h

@@ -1,9 +1,8 @@
 
 
+#ifndef LUAT_CMUX_H
+#define LUAT_CMUX_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
-#ifndef LUAT_CMUX
-#define LUAT_CMUX
-
 #define LUAT_CMUX_CH_MAIN 0
 #define LUAT_CMUX_CH_MAIN 0
 #define LUAT_CMUX_CH_SHELL 1
 #define LUAT_CMUX_CH_SHELL 1
 #define LUAT_CMUX_CH_LOG  2
 #define LUAT_CMUX_CH_LOG  2

+ 3 - 1
luat/include/luat_crypto.h

@@ -1,4 +1,5 @@
-
+#ifndef LUAT_CRYPTO_H
+#define LUAT_CRYPTO_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 #define LUAT_CRYPTO_AES_ECB 1
 #define LUAT_CRYPTO_AES_ECB 1
@@ -25,3 +26,4 @@ int luat_crypto_hmac_sha256_simple(const char* str, size_t str_size, const char*
 int luat_crypto_sha512_simple(const char* str, size_t str_size, void* out_ptr) ;
 int luat_crypto_sha512_simple(const char* str, size_t str_size, void* out_ptr) ;
 int luat_crypto_hmac_sha512_simple(const char* str, size_t str_size, const char* mac, size_t mac_size, void* out_ptr) ;
 int luat_crypto_hmac_sha512_simple(const char* str, size_t str_size, const char* mac, size_t mac_size, void* out_ptr) ;
 
 
+#endif

+ 2 - 2
luat/include/luat_dbg.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_DBG
-#define LUAT_DBG
+#ifndef LUAT_DBG_H
+#define LUAT_DBG_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 
 

+ 3 - 0
luat/include/luat_disp.h

@@ -1,4 +1,6 @@
 
 
+#ifndef LUAT_DISP_H
+#define LUAT_DISP_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 typedef struct luat_disp_conf
 typedef struct luat_disp_conf
@@ -22,3 +24,4 @@ int luat_disp_setup(luat_disp_conf_t *conf);
 
 
 int luat_disp_close(luat_disp_conf_t *conf);
 int luat_disp_close(luat_disp_conf_t *conf);
 
 
+#endif

+ 2 - 2
luat/include/luat_fs.h

@@ -3,8 +3,8 @@
  *  @author wendal
  *  @author wendal
  *  @since 0.1.5
  *  @since 0.1.5
  *****************************************************************************/
  *****************************************************************************/
-#ifndef Luat_FS
-#define Luat_FS
+#ifndef LUAT_FS_H
+#define LUAT_FS_H
 //#include "luat_base.h"
 //#include "luat_base.h"
 #include "stdio.h"
 #include "stdio.h"
 
 

+ 2 - 2
luat/include/luat_gpio.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_GPIO
-#define LUAT_GPIO
+#ifndef LUAT_GPIO_H
+#define LUAT_GPIO_H
 
 
 
 
 #include "lua.h"
 #include "lua.h"

+ 4 - 0
luat/include/luat_http.h

@@ -1,4 +1,6 @@
 
 
+#ifndef LUAT_HTTP_H
+#define LUAT_HTTP_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 #define LUAT_HTTP_GET 0
 #define LUAT_HTTP_GET 0
@@ -51,3 +53,5 @@ int luat_http_req(luat_lib_http_req_t *req);
 
 
 void luat_http_req_gc(luat_lib_http_req_t *req);
 void luat_http_req_gc(luat_lib_http_req_t *req);
 void luat_http_resp_gc(luat_lib_http_resp_t *req);
 void luat_http_resp_gc(luat_lib_http_resp_t *req);
+
+#endif

+ 5 - 0
luat/include/luat_hwtimer.h

@@ -1,3 +1,6 @@
+
+#ifndef LUAT_HWTIMER_H
+#define LUAT_HWTIMER_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 typedef struct luat_hwtimer_conf {
 typedef struct luat_hwtimer_conf {
@@ -12,3 +15,5 @@ int luat_hwtimer_stop(int id);
 int luat_hwtimer_read(int id);
 int luat_hwtimer_read(int id);
 int luat_hwtimer_change(int id, uint32_t newtimeout);
 int luat_hwtimer_change(int id, uint32_t newtimeout);
 int luat_hwtimer_destroy(int id);
 int luat_hwtimer_destroy(int id);
+
+#endif

+ 2 - 2
luat/include/luat_i2c.h

@@ -1,5 +1,5 @@
-#ifndef LUAT_I2C
-#define LUAT_I2C
+#ifndef LUAT_I2C_H
+#define LUAT_I2C_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 

+ 4 - 0
luat/include/luat_irq.h

@@ -1,3 +1,6 @@
+
+#ifndef LUAT_IRQ_H
+#define LUAT_IRQ_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 int luat_irq_fire(int tp, int arg, void* args);
 int luat_irq_fire(int tp, int arg, void* args);
@@ -8,3 +11,4 @@ int luat_irq_uart_cb(int uartid, void* args);
 
 
 int luat_irq_spi_cb(int id);
 int luat_irq_spi_cb(int id);
 
 
+#endif

+ 3 - 3
luat/include/luat_keyboard.h

@@ -1,6 +1,7 @@
+#ifndef LUAT_KEYBOARD_H
+#define LUAT_KEYBOARD_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
-
 typedef struct luat_keyboard_ctx
 typedef struct luat_keyboard_ctx
 {
 {
     uint16_t port;      // 为多keyboard预留,默认为0
     uint16_t port;      // 为多keyboard预留,默认为0
@@ -22,6 +23,5 @@ typedef struct luat_keyboard_conf {
 
 
 int luat_keyboard_init(luat_keyboard_conf_t *conf);
 int luat_keyboard_init(luat_keyboard_conf_t *conf);
 
 
-
-
 int luat_keyboard_deinit(luat_keyboard_conf_t *conf);
 int luat_keyboard_deinit(luat_keyboard_conf_t *conf);
+#endif

+ 4 - 1
luat/include/luat_lcdseg.h

@@ -1,3 +1,6 @@
+
+#ifndef LUAT_LCDSEG_H
+#define LUAT_LCDSEG_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 typedef struct luat_lcd_options
 typedef struct luat_lcd_options
@@ -24,4 +27,4 @@ int luat_lcdseg_power(uint8_t enable);
 
 
 int luat_lcdseg_seg_set(uint8_t com, uint32_t seg, uint8_t val);
 int luat_lcdseg_seg_set(uint8_t com, uint32_t seg, uint8_t val);
 
 
-
+#endif

+ 4 - 0
luat/include/luat_libs.h

@@ -1,4 +1,6 @@
 
 
+#ifndef LUAT_LIBS_H
+#define LUAT_LIBS_H
 #include "lua.h"
 #include "lua.h"
 #include "lauxlib.h"
 #include "lauxlib.h"
 
 
@@ -94,3 +96,5 @@ LUAMOD_API int luaopen_fdb( lua_State *L );
 
 
 LUAMOD_API int luaopen_keyboard( lua_State *L );
 LUAMOD_API int luaopen_keyboard( lua_State *L );
 LUAMOD_API int luaopen_coremark( lua_State *L );
 LUAMOD_API int luaopen_coremark( lua_State *L );
+
+#endif

+ 4 - 3
luat/include/luat_log.h

@@ -1,8 +1,9 @@
-#include "luat_base.h"
 
 
-#ifndef LUAT_LOG
-#define LUAT_LOG
 
 
+#ifndef LUAT_LOG_H
+#define LUAT_LOG_H
+
+#include "luat_base.h"
 #define LUAT_LOG_DEBUG 1
 #define LUAT_LOG_DEBUG 1
 #define LUAT_LOG_INFO  2
 #define LUAT_LOG_INFO  2
 #define LUAT_LOG_WARN  3
 #define LUAT_LOG_WARN  3

+ 4 - 0
luat/include/luat_lpmem.h

@@ -1,6 +1,10 @@
 
 
+#ifndef LUAT_LPMEM_H
+#define LUAT_LPMEM_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 int luat_lpmem_read(size_t offset, size_t size, void*buff);
 int luat_lpmem_read(size_t offset, size_t size, void*buff);
 int luat_lpmem_write(size_t offset, size_t size, void*buff);
 int luat_lpmem_write(size_t offset, size_t size, void*buff);
 int luat_lpmem_size(void);
 int luat_lpmem_size(void);
+
+#endif

+ 2 - 2
luat/include/luat_luadb.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_LUADB
-#define LUAT_LUADB
+#ifndef LUAT_LUADB_H
+#define LUAT_LUADB_H
 
 
 // LuaDB只读文件系统
 // LuaDB只读文件系统
 
 

+ 2 - 4
luat/include/luat_malloc.h

@@ -5,9 +5,8 @@
  * 
  * 
 */
 */
 
 
-#ifndef LUAT_MALLOC
-
-#define LUAT_MALLOC
+#ifndef LUAT_MALLOC_H
+#define LUAT_MALLOC_H
 
 
 //----------------
 //----------------
 // 这部分是使用系统内存
 // 这部分是使用系统内存
@@ -25,4 +24,3 @@ void luat_meminfo_luavm(size_t* total, size_t* used, size_t* max_used);
 void luat_meminfo_sys(size_t* total, size_t* used, size_t* max_used);
 void luat_meminfo_sys(size_t* total, size_t* used, size_t* max_used);
 
 
 #endif
 #endif
-

+ 4 - 0
luat/include/luat_mcu.h

@@ -1,3 +1,5 @@
+#ifndef LUAT_MCU_H
+#define LUAT_MCU_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 int luat_mcu_set_clk(size_t mhz);
 int luat_mcu_set_clk(size_t mhz);
@@ -6,3 +8,5 @@ int luat_mcu_get_clk(void);
 const char* luat_mcu_unique_id(size_t* t);
 const char* luat_mcu_unique_id(size_t* t);
 
 
 long luat_mcu_ticks(void);
 long luat_mcu_ticks(void);
+
+#endif

+ 2 - 2
luat/include/luat_msgbus.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_MSGBUS
-#define LUAT_MSGBUS
+#ifndef LUAT_MSGBUS_H
+#define LUAT_MSGBUS_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 

+ 2 - 2
luat/include/luat_ota.h

@@ -1,8 +1,8 @@
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 
-#ifndef LUAT_OTA
-#define LUAT_OTA
+#ifndef LUAT_OTA_H
+#define LUAT_OTA_H
 
 
 #define UPDATE_BIN_PATH "/update.bin"
 #define UPDATE_BIN_PATH "/update.bin"
 #define ROLLBACK_MARK_PATH "/rollback_mark"
 #define ROLLBACK_MARK_PATH "/rollback_mark"

+ 2 - 2
luat/include/luat_pack.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_PACK
-#define LUAT_PACK
+#ifndef LUAT_PACK_H
+#define LUAT_PACK_H
 
 
 #include "lua.h"
 #include "lua.h"
 
 

+ 3 - 0
luat/include/luat_pm.h

@@ -1,4 +1,6 @@
 
 
+#ifndef LUAT_PM_H
+#define LUAT_PM_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 #define LUAT_PM_SLEEP_MODE_NONE     0	//系统处于活跃状态,未采取任何的降低功耗状态
 #define LUAT_PM_SLEEP_MODE_NONE     0	//系统处于活跃状态,未采取任何的降低功耗状态
@@ -30,3 +32,4 @@ int luat_pm_dtimer_list(size_t* count, size_t* list);
 
 
 int luat_pm_dtimer_wakeup_id(int* id);
 int luat_pm_dtimer_wakeup_id(int* id);
 
 
+#endif

+ 2 - 2
luat/include/luat_pwm.h

@@ -1,6 +1,6 @@
 
 
-#ifndef Luat_PWM
-#define Luat_PWM
+#ifndef Luat_PWM_H
+#define Luat_PWM_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 

+ 4 - 1
luat/include/luat_rtc.h

@@ -1,4 +1,5 @@
-
+#ifndef LUAT_RTC_H
+#define LUAT_RTC_H
 #include "luat_base.h"
 #include "luat_base.h"
 #include "time.h"
 #include "time.h"
 
 
@@ -6,3 +7,5 @@ int luat_rtc_set(struct tm *tblock);
 int luat_rtc_get(struct tm *tblock);
 int luat_rtc_get(struct tm *tblock);
 int luat_rtc_timer_start(int id, struct tm *tblock);
 int luat_rtc_timer_start(int id, struct tm *tblock);
 int luat_rtc_timer_stop(int id);
 int luat_rtc_timer_stop(int id);
+
+#endif

+ 4 - 1
luat/include/luat_sdio.h

@@ -1,4 +1,5 @@
-
+#ifndef LUAT_SDIO_H
+#define LUAT_SDIO_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 typedef struct luat_sdio
 typedef struct luat_sdio
@@ -14,3 +15,5 @@ int luat_sdio_sd_write(int id, int rca, char* buff, size_t offset, size_t len);
 int luat_sdio_sd_mount(int id, int *rca, char* path,int auto_format);
 int luat_sdio_sd_mount(int id, int *rca, char* path,int auto_format);
 int luat_sdio_sd_unmount(int id, int rca);
 int luat_sdio_sd_unmount(int id, int rca);
 int luat_sdio_sd_format(int id, int rca);
 int luat_sdio_sd_format(int id, int rca);
+
+#endif

+ 2 - 2
luat/include/luat_sfd.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_SFD
-#define LUAT_SFD
+#ifndef LUAT_SFD_H
+#define LUAT_SFD_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 
 

+ 3 - 1
luat/include/luat_shell.h

@@ -1,4 +1,5 @@
-
+#ifndef LUAT_SHELL_H
+#define LUAT_SHELL_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 #define LUAT_CMUX_CMD_INIT "AT+CMUX=1,0,5"
 #define LUAT_CMUX_CMD_INIT "AT+CMUX=1,0,5"
@@ -9,3 +10,4 @@ char* luat_shell_read(size_t *len);
 void luat_shell_notify_recv(void);
 void luat_shell_notify_recv(void);
 void luat_shell_notify_read(void);
 void luat_shell_notify_read(void);
 
 
+#endif

+ 4 - 1
luat/include/luat_socket.h

@@ -1,7 +1,10 @@
-
+#ifndef LUAT_SOCKET_H
+#define LUAT_SOCKET_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 int luat_socket_ntp_sync(const char* ntpServer);
 int luat_socket_ntp_sync(const char* ntpServer);
 int luat_socket_tsend(const char* hostname, int port, void* buff, int len);
 int luat_socket_tsend(const char* hostname, int port, void* buff, int len);
 int luat_socket_is_ready(void);
 int luat_socket_is_ready(void);
 uint32_t luat_socket_selfip(void);
 uint32_t luat_socket_selfip(void);
+
+#endif

+ 2 - 2
luat/include/luat_spi.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_SPI
-#define LUAT_SPI
+#ifndef LUAT_SPI_H
+#define LUAT_SPI_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 typedef struct luat_spi
 typedef struct luat_spi

+ 5 - 0
luat/include/luat_str.h

@@ -1,3 +1,6 @@
+
+#ifndef LUAT_STR_H
+#define LUAT_STR_H
 #include "string.h"
 #include "string.h"
 
 
 void luat_str_tohex(char* str, size_t len, char* buff);
 void luat_str_tohex(char* str, size_t len, char* buff);
@@ -7,3 +10,5 @@ int luat_str_base64_encode( unsigned char *dst, size_t dlen, size_t *olen,
                    const unsigned char *src, size_t slen );
                    const unsigned char *src, size_t slen );
 int luat_str_base64_decode( unsigned char *dst, size_t dlen, size_t *olen,
 int luat_str_base64_decode( unsigned char *dst, size_t dlen, size_t *olen,
                    const unsigned char *src, size_t slen );
                    const unsigned char *src, size_t slen );
+
+#endif

+ 2 - 2
luat/include/luat_sys.h

@@ -1,6 +1,6 @@
 
 
-#ifndef LUAT_SYS
-#define LUAT_SYS
+#ifndef LUAT_SYS_H
+#define LUAT_SYS_H
 
 
 
 
 #include "lua.h"
 #include "lua.h"

+ 2 - 2
luat/include/luat_timer.h

@@ -1,5 +1,5 @@
-#ifndef LUAT_TIMER
-#define LUAT_TIMER
+#ifndef LUAT_TIMER_H
+#define LUAT_TIMER_H
 
 
 #include "luat_base.h"
 #include "luat_base.h"
 #include "luat_msgbus.h"
 #include "luat_msgbus.h"

+ 2 - 2
luat/include/luat_uart.h

@@ -1,5 +1,5 @@
-#ifndef LUAT_UART
-#define LUAT_UART
+#ifndef LUAT_UART_H
+#define LUAT_UART_H
 
 
 #include "luat_msgbus.h"
 #include "luat_msgbus.h"
 
 

+ 4 - 1
luat/include/luat_wdt.h

@@ -1,7 +1,10 @@
-
+#ifndef LUAT_WDT_H
+#define LUAT_WDT_H
 #include "luat_base.h"
 #include "luat_base.h"
 
 
 int luat_wdt_init(size_t timeout);
 int luat_wdt_init(size_t timeout);
 int luat_wdt_set_timeout(size_t timeout);
 int luat_wdt_set_timeout(size_t timeout);
 int luat_wdt_feed(void);
 int luat_wdt_feed(void);
 int luat_wdt_close(void);
 int luat_wdt_close(void);
+
+#endif

+ 2 - 2
luat/include/luat_zbuff.h

@@ -1,5 +1,5 @@
-#ifndef LUAT_ZBUFF
-#define LUAT_ZBUFF
+#ifndef LUAT_ZBUFF_H
+#define LUAT_ZBUFF_H
 
 
 #include "luat_msgbus.h"
 #include "luat_msgbus.h"