sensors: qdex_nrfx: move to new logger
Move to new logger and use sensor log level instead of our own. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
a19726ee1e
commit
04c85e64c1
2 changed files with 11 additions and 30 deletions
|
@ -10,20 +10,3 @@ menuconfig QDEC_NRFX
|
|||
select HAS_DTS_QDEC
|
||||
help
|
||||
Enable support for nrfx QDEC driver for nRF MCU series.
|
||||
|
||||
if QDEC_NRFX
|
||||
|
||||
config SYS_LOG_QDEC_NRFX_LEVEL
|
||||
int "QDEC log level"
|
||||
depends on SYS_LOG
|
||||
default 0
|
||||
help
|
||||
Sets log level for QDEC driver.
|
||||
Levels are:
|
||||
- 0 OFF, do not write
|
||||
- 1 ERROR, only write SYS_LOG_ERR
|
||||
- 2 WARNING, write SYS_LOG_WRN in addition to previous level
|
||||
- 3 INFO, write SYS_LOG_INF in addition to previous levels
|
||||
- 4 DEBUG, write SYS_LOG_DBG in addition to previous levels
|
||||
|
||||
endif
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <nrfx_qdec.h>
|
||||
#include <hal/nrf_gpio.h>
|
||||
|
||||
#define SYS_LOG_DOMAIN "qdec_nrfx"
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_QDEC_NRFX_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(qdec_nrfx)
|
||||
|
||||
|
||||
#define FULL_ANGLE 360
|
||||
|
@ -58,7 +58,7 @@ static int qdec_nrfx_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
if ((chan != SENSOR_CHAN_ALL) && (chan != SENSOR_CHAN_ROTATION)) {
|
||||
return -ENOTSUP;
|
||||
|
@ -80,8 +80,7 @@ static int qdec_nrfx_channel_get(struct device *dev,
|
|||
s32_t acc;
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
if (chan != SENSOR_CHAN_ROTATION) {
|
||||
return -ENOTSUP;
|
||||
|
@ -113,8 +112,7 @@ static int qdec_nrfx_trigger_set(struct device *dev,
|
|||
unsigned int key;
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
if (trig->type != SENSOR_TRIG_DATA_READY) {
|
||||
return -ENOTSUP;
|
||||
|
@ -156,7 +154,7 @@ static void qdec_nrfx_event_handler(nrfx_qdec_event_t event)
|
|||
break;
|
||||
|
||||
default:
|
||||
SYS_LOG_ERR("unhandled event (0x%x)", event.type);
|
||||
LOG_ERR("unhandled event (0x%x)", event.type);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
@ -192,17 +190,17 @@ static int qdec_nrfx_init(struct device *dev)
|
|||
|
||||
nrfx_err_t nerr;
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
IRQ_CONNECT(CONFIG_QDEC_IRQ, CONFIG_QDEC_IRQ_PRI,
|
||||
nrfx_isr, nrfx_qdec_irq_handler, 0);
|
||||
|
||||
nerr = nrfx_qdec_init(&config, qdec_nrfx_event_handler);
|
||||
if (nerr == NRFX_ERROR_INVALID_STATE) {
|
||||
SYS_LOG_ERR("qdec already in use");
|
||||
LOG_ERR("qdec already in use");
|
||||
return -EBUSY;
|
||||
} else if (nerr != NRFX_SUCCESS) {
|
||||
SYS_LOG_ERR("failed to initialize qdec");
|
||||
LOG_ERR("failed to initialize qdec");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
|
@ -276,7 +274,7 @@ static int qdec_nrfx_pm_control(struct device *dev,
|
|||
struct qdec_nrfx_data *data = &qdec_nrfx_data;
|
||||
int err;
|
||||
|
||||
SYS_LOG_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
switch (ctrl_command) {
|
||||
case DEVICE_PM_GET_POWER_STATE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue