drivers: led_strip: move to new logger
Move drivers to new logger and change samples enabling logging in prj.conf. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
ffb75da2ea
commit
ef46d11098
|
@ -14,20 +14,9 @@ menuconfig LED_STRIP
|
|||
|
||||
if LED_STRIP
|
||||
|
||||
config SYS_LOG_LED_STRIP_LEVEL
|
||||
int "LED strip system log level"
|
||||
depends on SYS_LOG
|
||||
default 0
|
||||
range 0 4
|
||||
help
|
||||
Sets the log level for LED strip drivers. You must have
|
||||
system logging enabled.
|
||||
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
|
||||
module = LED_STRIP
|
||||
module-str = LED strip
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
config LED_STRIP_INIT_PRIORITY
|
||||
int "LED strip initialization priority"
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_LED_STRIP_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
#define LOG_LEVEL CONFIG_LED_STRIP_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(lpd880x);
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
|
@ -72,7 +73,7 @@ static int lpd880x_update(struct device *dev, void *data, size_t size)
|
|||
|
||||
rc = spi_write(drv_data->spi, &drv_data->config, &tx);
|
||||
if (rc) {
|
||||
SYS_LOG_ERR("can't update strip: %d", rc);
|
||||
LOG_ERR("can't update strip: %d", rc);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -126,7 +127,7 @@ static int lpd880x_strip_init(struct device *dev)
|
|||
|
||||
data->spi = device_get_binding(CONFIG_LPD880X_STRIP_SPI_DEV_NAME);
|
||||
if (!data->spi) {
|
||||
SYS_LOG_ERR("SPI device %s not found",
|
||||
LOG_ERR("SPI device %s not found",
|
||||
CONFIG_LPD880X_STRIP_SPI_DEV_NAME);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_LED_STRIP_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
#define LOG_LEVEL CONFIG_LED_STRIP_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(ws2812);
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
|
@ -126,7 +127,7 @@ static int ws2812_strip_update_rgb(struct device *dev, struct led_rgb *pixels,
|
|||
* pixel.
|
||||
*/
|
||||
(void)ws2812_reset_strip(drv_data);
|
||||
SYS_LOG_ERR("can't set pixel %u: %d", i, rc);
|
||||
LOG_ERR("can't set pixel %u: %d", i, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ static int ws2812_strip_update_channels(struct device *dev, u8_t *channels,
|
|||
* pixel.
|
||||
*/
|
||||
(void)ws2812_reset_strip(drv_data);
|
||||
SYS_LOG_ERR("can't set channel %u: %d", i, rc);
|
||||
LOG_ERR("can't set channel %u: %d", i, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +177,7 @@ static int ws2812_strip_init(struct device *dev)
|
|||
|
||||
data->spi = device_get_binding(CONFIG_WS2812_STRIP_SPI_DEV_NAME);
|
||||
if (!data->spi) {
|
||||
SYS_LOG_ERR("SPI device %s not found",
|
||||
LOG_ERR("SPI device %s not found",
|
||||
CONFIG_WS2812_STRIP_SPI_DEV_NAME);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_LED_STRIP_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
#define LOG_LEVEL CONFIG_LED_STRIP_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(ws2812b_sw);
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <board.h>
|
||||
|
@ -33,7 +34,7 @@ static int send_buf(u8_t *buf, size_t len)
|
|||
|
||||
clock = device_get_binding(CONFIG_CLOCK_CONTROL_NRF5_M16SRC_DRV_NAME);
|
||||
if (!clock) {
|
||||
SYS_LOG_ERR("Unable to get HF clock");
|
||||
LOG_ERR("Unable to get HF clock");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -119,7 +120,7 @@ static int ws2812b_sw_update_rgb(struct device *dev, struct led_rgb *pixels,
|
|||
static int ws2812b_sw_update_channels(struct device *dev, u8_t *channels,
|
||||
size_t num_channels)
|
||||
{
|
||||
SYS_LOG_ERR("update_channels not implemented");
|
||||
LOG_ERR("update_channels not implemented");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ static int ws2812b_sw_init(struct device *dev)
|
|||
|
||||
gpio = device_get_binding(CONFIG_WS2812B_SW_GPIO_NAME);
|
||||
if (!gpio) {
|
||||
SYS_LOG_ERR("Unable to find %s", CONFIG_WS2812B_SW_GPIO_NAME);
|
||||
LOG_ERR("Unable to find %s", CONFIG_WS2812B_SW_GPIO_NAME);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue