Reuse macros.h in nrf-connect/samples/soil_read_loop/src/main.c
This commit is contained in:
parent
89d2999bd8
commit
46a8285f59
1 changed files with 1 additions and 15 deletions
|
|
@ -2,25 +2,11 @@
|
|||
#include <drivers/gpio.h>
|
||||
#include <drivers/pwm.h>
|
||||
#include <logging/log.h>
|
||||
#include <prstlib/macros.h>
|
||||
#include <zephyr/zephyr.h>
|
||||
|
||||
LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);
|
||||
|
||||
#define PRST_STRINGIFY(x) #x
|
||||
#define PRST_TO_STRING(x) PRST_STRINGIFY(x)
|
||||
#define PRST_LOCATION __FILE__ ":" PRST_TO_STRING(__LINE__)
|
||||
|
||||
#define RET_IF_ERR_MSG(expr, msg) \
|
||||
{ \
|
||||
int err = (expr); \
|
||||
if (err) { \
|
||||
LOG_ERR("Error: " msg " in " PRST_LOCATION); \
|
||||
return err; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define RET_IF_ERR(expr) RET_IF_ERR_MSG(expr, "")
|
||||
|
||||
static const struct pwm_dt_spec soil_pwm_dt =
|
||||
PWM_DT_SPEC_GET(DT_NODELABEL(soil_pwm));
|
||||
static const uint32_t pulse = DT_PROP(DT_NODELABEL(soil_pwm), pulse);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue