config.h: move the CAN_INTERFACE and CAN_CLOCK_SPEED to the config.h

Move CAN_INTERFACE and CAN_CLOCK_SPEED to the config file as the CAN
clock can vary based on HW implementation.

Better to add it here than to keep adding defines into the
usbd_gs_can.h file.

CAN_INTERFACE can vary based on the number of channels you are using
so also makes sense to add here even though most chips use the same
interface ID.
This commit is contained in:
Ryan Edwards 2022-10-31 21:51:33 -04:00 committed by Marc Kleine-Budde
parent 8f9fa7788c
commit 8a9cdf1076
2 changed files with 29 additions and 8 deletions

View File

@ -52,6 +52,10 @@ THE SOFTWARE.
#define USBD_PRODUCT_STRING_FS (uint8_t*) "candleLight USB to CAN adapter"
#define USBD_MANUFACTURER_STRING (uint8_t*) "bytewerk"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "candleLight firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
#define CAN_S_Pin GPIO_PIN_13
#define CAN_S_GPIO_Port GPIOC
@ -70,6 +74,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "makerbase"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "CANable-MKS firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LEDRX_GPIO_Port GPIOA
@ -87,6 +94,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "cantact.io"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "cantact firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LEDRX_GPIO_Port GPIOB
@ -104,6 +114,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "canable.io"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "canable firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LEDRX_GPIO_Port GPIOB
@ -121,6 +134,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "Roboter Club Aachen"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "usb2can firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LED4_GPIO_Port GPIOA
@ -148,6 +164,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "STMicroelectronics"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "CANAlyze firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LEDRX_GPIO_Port GPIOB
@ -165,6 +184,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "chacaltech"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "cannette firmware upgrade interface"
#define CAN_INTERFACE CAN
#define CAN_CLOCK_SPEED 48000000
// SILENT pin not connected
#define LEDRX_GPIO_Port GPIOA
@ -192,6 +214,9 @@ THE SOFTWARE.
#define USBD_MANUFACTURER_STRING (uint8_t*) "misc"
#define DFU_INTERFACE_STRING_FS (uint8_t*) "STM32F4VE firmware upgrade interface"
#define CAN_INTERFACE CAN1
#define CAN_CLOCK_SPEED 42000000
#define CAN_S_Pin GPIO_PIN_10
#define CAN_S_GPIO_Port GPIOA

View File

@ -48,15 +48,11 @@ extern USBD_ClassTypeDef USBD_GS_CAN;
#if defined(STM32F0)
# define USB_INTERFACE USB
# define USB_INTERRUPT USB_IRQn
# define CAN_INTERFACE CAN
# define CAN_CLOCK_SPEED 48000000
# define USB_INTERFACE USB
# define USB_INTERRUPT USB_IRQn
#elif defined(STM32F4)
# define USB_INTERFACE USB_OTG_FS
# define USB_INTERRUPT OTG_FS_IRQn
# define CAN_INTERFACE CAN1
# define CAN_CLOCK_SPEED 42000000
# define USB_INTERFACE USB_OTG_FS
# define USB_INTERRUPT OTG_FS_IRQn
// RX FIFO is defined in words, so divide bytes by 4
// RX FIFO size chosen according to reference manual RM0368 which suggests