ESP32 宏定义 解读

ESP32 宏定义

生肉原文

typedef int esp_err_t;
ESP_OK
//esp_err_t value indicating success (no error)
//表示执行成功 没有错误

ESP_FAIL
//Generic esp_err_t code indicating failure
//表示程序执行失败

ESP_ERR_NO_MEM
//Out of memory
//超出内存

ESP_ERR_INVALID_ARG
//Invalid argument
//参数不合法

ESP_ERR_INVALID_STATE
//Invalid state
//状态不合法

ESP_ERR_INVALID_SIZE
//Invalid size
//大小不合法

ESP_ERR_NOT_FOUND
//Requested resource not found
//请求资源没找到

ESP_ERR_NOT_SUPPORTED
//Operation or feature not supported
//不支持这个功能或者操作

ESP_ERR_TIMEOUT
//Operation timed out
//操作超时

ESP_ERR_INVALID_RESPONSE
//Received response was invalid
//响应不合法

ESP_ERR_INVALID_CRC
//CRC or checksum was invalid
//CRC或者checksum 校验不合法

ESP_ERR_INVALID_VERSION
//Version was invalid
//版本不合法

ESP_ERR_INVALID_MAC
//MAC address was invalid
//MAC 地址不合法

ESP_ERR_WIFI_BASE
//Starting number of WiFi error codes

ESP_ERR_MESH_BASE
//Starting number of MESH error codes

ESP_ERR_FLASH_BASE
//Starting number of flash error codes

ESP_ERR_HW_CRYPTO_BASE
//Starting number of HW cryptography module error codes

ESP_ERROR_CHECK(x)
//Macro which can be used to check the error code, and terminate the //program in case the code is not ESP_OK. Prints the error code, error //location, and the failed statement to serial output.
//
//Disabled if assertions are disabled.
//这个宏定义是个函数 
//可以进行异常检测,终止程序,并打印异常信息
//参数应该是个函数,函数的返回值如果不是ESP_OK 
//程序就会被中断并打印异常信息
//如果断言不可用,这个也不可用

ESP_ERROR_CHECK_WITHOUT_ABORT(x)
//Macro which can be used to check the error code. Prints the error //code, error location, and the failed statement to serial output. In //comparison with ESP_ERROR_CHECK(), this prints the same error message //but isn’t terminating the program.

//同样可以检查错误代码,但是这种方法并不会中断程序的执行,
//而只显示错误代码。
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值