From b3f0737a9994ae69fe630937de300b2e393df764 Mon Sep 17 00:00:00 2001 From: "Aubr.Cool" Date: Tue, 30 Jun 2015 14:12:30 +0800 Subject: correct can compiler error and warnings --- components/drivers/can/can.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'components/drivers') diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c index c31523c1a0..fc0d74877f 100644 --- a/components/drivers/can/can.c +++ b/components/drivers/can/can.c @@ -607,11 +607,15 @@ static rt_err_t rt_can_control(struct rt_device *dev, */ static void cantimeout(void* arg) { + #ifdef RT_CAN_USING_LED rt_uint32_t ledonflag = 0; + #endif /*RT_CAN_USING_LED*/ rt_can_t can = (rt_can_t)arg; rt_device_control((rt_device_t)can,RT_CAN_CMD_GET_STATUS,(void* )&can->status); if(can->timerinitflag == 1) { - ledonflag = 1; + #ifdef RT_CAN_USING_LED + ledonflag = 1; + #endif /*RT_CAN_USING_LED*/ can->timerinitflag = 0xFF; } #ifdef RT_CAN_USING_LED @@ -713,17 +717,12 @@ rt_err_t rt_hw_can_register(struct rt_can_device *can, device->user_data = data; can->timerinitflag = 0; - if(can->config.rcvled != RT_NULL || - can->config.sndled != RT_NULL || - can->config.errled != RT_NULL) - { - rt_timer_init(&can->timer, - name, - cantimeout, - (void*)can, - can->config.ticks, - RT_TIMER_FLAG_PERIODIC); - } + rt_timer_init(&can->timer, + name, + cantimeout, + (void*)can, + can->config.ticks, + RT_TIMER_FLAG_PERIODIC); /* register a character device */ return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR); } -- cgit v1.3.1 From 67b6b30e8837d6993a98f0e28b595bef1286cbad Mon Sep 17 00:00:00 2001 From: "Aubr.Cool" Date: Tue, 30 Jun 2015 14:48:07 +0800 Subject: add rtthread.h include for can.h --- components/drivers/include/drivers/can.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'components/drivers') diff --git a/components/drivers/include/drivers/can.h b/components/drivers/include/drivers/can.h index 3a24162f03..e3473bac5c 100644 --- a/components/drivers/include/drivers/can.h +++ b/components/drivers/include/drivers/can.h @@ -14,6 +14,8 @@ #ifndef CAN_H_ #define CAN_H_ +#include + #ifndef RT_CANMSG_BOX_SZ #define RT_CANMSG_BOX_SZ 16 #endif -- cgit v1.3.1 From 9cbf30a7675d6cd26963947d056365e0f167285b Mon Sep 17 00:00:00 2001 From: "Aubr.Cool" Date: Fri, 3 Jul 2015 16:10:33 +0800 Subject: correct can hdr defines --- components/drivers/include/drivers/can.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'components/drivers') diff --git a/components/drivers/include/drivers/can.h b/components/drivers/include/drivers/can.h index e3473bac5c..a6c60cd28e 100644 --- a/components/drivers/include/drivers/can.h +++ b/components/drivers/include/drivers/can.h @@ -60,8 +60,10 @@ struct rt_can_filter_item rt_uint32_t mode :1; rt_uint32_t mask; rt_int32_t hdr; +#ifdef RT_CAN_USING_HDR rt_err_t (*ind)(rt_device_t dev, void* args ,rt_int32_t hdr, rt_size_t size); - void* args; + void* args; +#endif /*RT_CAN_USING_HDR*/ }; #ifdef RT_CAN_USING_HDR #define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask,ind,args) \ @@ -88,7 +90,7 @@ struct rt_can_filter_item #define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id,ind,args) \ RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF,ind,args) #else -#define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask,args) \ +#define RT_CAN_FILTER_ITEM_INIT(id,ide,rtr,mode,mask) \ {\ id,\ ide,\ @@ -96,20 +98,19 @@ struct rt_can_filter_item mode,\ mask,\ -1,\ - args,\ } -#define RT_CAN_FILTER_STD_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF,args) -#define RT_CAN_FILTER_EXT_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF,args) -#define RT_CAN_STD_RMT_FILTER_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF,args) -#define RT_CAN_EXT_RMT_FILTER_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF,args) -#define RT_CAN_STD_RMT_DATA_FILTER_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF,args) -#define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id,args) \ - RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF,args) +#define RT_CAN_FILTER_STD_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,0,0,0,0xFFFFFFFF) +#define RT_CAN_FILTER_EXT_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,1,0,0,0xFFFFFFFF) +#define RT_CAN_STD_RMT_FILTER_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,0,1,0,0xFFFFFFFF) +#define RT_CAN_EXT_RMT_FILTER_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,1,1,0,0xFFFFFFFF) +#define RT_CAN_STD_RMT_DATA_FILTER_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,0,0,1,0xFFFFFFFF) +#define RT_CAN_EXT_RMT_DATA_FILTER_INIT(id) \ + RT_CAN_FILTER_ITEM_INIT(id,1,0,1,0xFFFFFFFF) #endif struct rt_can_filter_config -- cgit v1.3.1