From 06b4a0611d0816373e72b0bdca6562265f1d1b9e Mon Sep 17 00:00:00 2001 From: Willian Chan Date: Wed, 17 Jul 2019 09:26:40 +0800 Subject: [PATCH] [component][drivers][sensors]Fix compilation warnings Signed-off-by: Willian Chan --- components/drivers/sensors/sensor_cmd.c | 56 ++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/components/drivers/sensors/sensor_cmd.c b/components/drivers/sensors/sensor_cmd.c index ec9470386d..dd1aa1ef95 100755 --- a/components/drivers/sensors/sensor_cmd.c +++ b/components/drivers/sensors/sensor_cmd.c @@ -56,7 +56,7 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor } } -rt_err_t rx_callback(rt_device_t dev, rt_size_t size) +static rt_err_t rx_callback(rt_device_t dev, rt_size_t size) { rt_sem_release(sensor_rx_sem); return 0; @@ -64,15 +64,15 @@ rt_err_t rx_callback(rt_device_t dev, rt_size_t size) static void sensor_fifo_rx_entry(void *parameter) { - rt_device_t dev = parameter; - rt_sensor_t sensor = parameter; + rt_device_t dev = (rt_device_t)parameter; + rt_sensor_t sensor = (rt_sensor_t)parameter; struct rt_sensor_data *data = RT_NULL; struct rt_sensor_info info; rt_size_t res, i; rt_device_control(dev, RT_SENSOR_CTRL_GET_INFO, &info); - data = rt_malloc(sizeof(struct rt_sensor_data) * info.fifo_max); + data = (struct rt_sensor_data *)rt_malloc(sizeof(struct rt_sensor_data) * info.fifo_max); if (data == RT_NULL) { LOG_E("Memory allocation failed!"); @@ -138,8 +138,8 @@ MSH_CMD_EXPORT(sensor_fifo, Sensor fifo mode test function); static void sensor_irq_rx_entry(void *parameter) { - rt_device_t dev = parameter; - rt_sensor_t sensor = parameter; + rt_device_t dev = (rt_device_t)parameter; + rt_sensor_t sensor = (rt_sensor_t)parameter; struct rt_sensor_data data; rt_size_t res, i = 0; @@ -277,74 +277,74 @@ static void sensor(int argc, char **argv) rt_device_control(dev, RT_SENSOR_CTRL_GET_INFO, &info); switch (info.vendor) { - case 0: + case RT_SENSOR_VENDOR_UNKNOWN: rt_kprintf("vendor :unknown vendor\n"); break; - case 1: + case RT_SENSOR_VENDOR_STM: rt_kprintf("vendor :STMicroelectronics\n"); break; - case 2: + case RT_SENSOR_VENDOR_BOSCH: rt_kprintf("vendor :Bosch\n"); break; - case 3: + case RT_SENSOR_VENDOR_INVENSENSE: rt_kprintf("vendor :Invensense\n"); break; - case 4: + case RT_SENSOR_VENDOR_SEMTECH: rt_kprintf("vendor :Semtech\n"); break; - case 5: + case RT_SENSOR_VENDOR_GOERTEK: rt_kprintf("vendor :Goertek\n"); break; - case 6: + case RT_SENSOR_VENDOR_MIRAMEMS: rt_kprintf("vendor :MiraMEMS\n"); break; - case 7: + case RT_SENSOR_VENDOR_DALLAS: rt_kprintf("vendor :Dallas\n"); break; } rt_kprintf("model :%s\n", info.model); switch (info.unit) { - case 0: + case RT_SENSOR_UNIT_NONE: rt_kprintf("unit :none\n"); break; - case 1: + case RT_SENSOR_UNIT_MG: rt_kprintf("unit :mG\n"); break; - case 2: + case RT_SENSOR_UNIT_MDPS: rt_kprintf("unit :mdps\n"); break; - case 3: + case RT_SENSOR_UNIT_MGAUSS: rt_kprintf("unit :mGauss\n"); break; - case 4: + case RT_SENSOR_UNIT_LUX: rt_kprintf("unit :lux\n"); break; - case 5: + case RT_SENSOR_UNIT_CM: rt_kprintf("unit :cm\n"); break; - case 6: + case RT_SENSOR_UNIT_PA: rt_kprintf("unit :pa\n"); break; - case 7: + case RT_SENSOR_UNIT_PERMILLAGE: rt_kprintf("unit :permillage\n"); break; - case 8: + case RT_SENSOR_UNIT_DCELSIUS: rt_kprintf("unit :Celsius\n"); break; - case 9: + case RT_SENSOR_UNIT_HZ: rt_kprintf("unit :HZ\n"); break; - case 10: + case RT_SENSOR_UNIT_ONE: rt_kprintf("unit :1\n"); break; - case 11: + case RT_SENSOR_UNIT_BPM: rt_kprintf("unit :bpm\n"); break; - case 12: + case RT_SENSOR_UNIT_MM: rt_kprintf("unit :mm\n"); break; - case 13: + case RT_SENSOR_UNIT_MN: rt_kprintf("unit :mN\n"); break; }