From a89135e23145cd538db501fd5c8b60bc2fcd4cb3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 20 Jan 2012 03:37:29 +0000 Subject: Leverage some bit timing logic from LPC17xx to the STM32 CAN driver git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4317 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/stm32/stm32_can.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'nuttx/arch/arm/src/stm32/stm32_can.h') diff --git a/nuttx/arch/arm/src/stm32/stm32_can.h b/nuttx/arch/arm/src/stm32/stm32_can.h index b842627b8..15203b5c9 100644 --- a/nuttx/arch/arm/src/stm32/stm32_can.h +++ b/nuttx/arch/arm/src/stm32/stm32_can.h @@ -73,6 +73,29 @@ # error "CONFIG_CAN2_BAUD is not defined" #endif +/* User-defined TSEG1 and TSEG2 settings may be used. + * + * CONFIG_CAN_TSEG1 = the number of CAN time quanta in segment 1 + * CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2 + * CAN_BIT_QUANTA = The number of CAN time quanta in on bit time + */ + +#ifndef CONFIG_CAN_TSEG1 +# define CONFIG_CAN_TSEG1 6 +#endif + +#if CONFIG_CAN_TSEG1 < 1 || CONFIG_CAN_TSEG1 > CAN_BTR_TSEG1_MAX +# errror "CONFIG_CAN_TSEG1 is out of range" +#endif + +#ifndef CONFIG_CAN_TSEG2 +# define CONFIG_CAN_TSEG2 7 +#endif + +#if CONFIG_CAN_TSEG2 < 1 || CONFIG_CAN_TSEG2 > CAN_BTR_TSEG2_MAX +# errror "CONFIG_CAN_TSEG2 is out of range" +#endif + /************************************************************************************ * Public Types ************************************************************************************/ -- cgit v1.2.3