mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ledc: apply general check macro
Standardize LEDC_CHECK() and LEDC_ARG_CHECK() in ledc.c to ESP_RETURN_ON_FALSE() in esp_check.h.
This commit is contained in:
parent
9bee350a39
commit
31cdeb538d
@ -16,6 +16,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "esp_check.h"
|
||||||
#include "soc/gpio_periph.h"
|
#include "soc/gpio_periph.h"
|
||||||
#include "soc/ledc_periph.h"
|
#include "soc/ledc_periph.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
@ -29,12 +30,8 @@
|
|||||||
|
|
||||||
static const char* LEDC_TAG = "ledc";
|
static const char* LEDC_TAG = "ledc";
|
||||||
|
|
||||||
#define LEDC_CHECK(a, str, ret_val) \
|
#define LEDC_CHECK(a, str, ret_val) ESP_RETURN_ON_FALSE(a, ret_val, LEDC_TAG, "%s", str);
|
||||||
if (!(a)) { \
|
#define LEDC_ARG_CHECK(a, param) ESP_RETURN_ON_FALSE(a, ESP_ERR_INVALID_ARG, LEDC_TAG, param " argument is invalid");
|
||||||
ESP_LOGE(LEDC_TAG, "%s(%d): %s", __FUNCTION__, __LINE__, str); \
|
|
||||||
return (ret_val); \
|
|
||||||
}
|
|
||||||
#define LEDC_ARG_CHECK(a, param) LEDC_CHECK(a, param " argument is invalid", ESP_ERR_INVALID_ARG)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ledc_mode_t speed_mode;
|
ledc_mode_t speed_mode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user