1 Commits

Author SHA1 Message Date
5832f00cbc Added macros for the most used chips at fasttube. 2023-03-31 17:07:15 +02:00
2 changed files with 2 additions and 16 deletions

View File

@ -260,7 +260,7 @@ uint8_t *ftcan_marshal_unsigned(uint8_t *data, uint64_t val, size_t num_bytes) {
num_bytes = 8; num_bytes = 8;
} }
for (int i = num_bytes - 1; i >= 0; i--) { for (size_t i = num_bytes - 1; i >= 0; i++) {
data[i] = val & 0xFF; data[i] = val & 0xFF;
val >>= 8; val >>= 8;
} }

View File

@ -1,27 +1,13 @@
#ifndef CAN_HALAL_H #ifndef CAN_HALAL_H
#define CAN_HALAL_H #define CAN_HALAL_H
// Define family macros if none are defined and we recognize a chip macro #if defined(STM32F302x8) || defined(STM32F302xB) || defined(STM32F302xC) || defined(STM32F3)
#if !defined(STM32F3) && !defined(STM32H7)
#if defined(STM32F302x6) || defined(STM32F302x8) || defined(STM32F302xB) || \
defined(STM32F302xC)
#define STM32F3
#endif
#if defined(STM32H7A3xx)
#define STM32H7
#endif
#endif
#if defined(STM32F3)
#include "stm32f3xx_hal.h" #include "stm32f3xx_hal.h"
#define FTCAN_IS_BXCAN #define FTCAN_IS_BXCAN
#define FTCAN_NUM_FILTERS 13 #define FTCAN_NUM_FILTERS 13
#elif defined(STM32H7) #elif defined(STM32H7)
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#define FTCAN_IS_FDCAN #define FTCAN_IS_FDCAN
#ifndef FTCAN_NUM_FILTERS
#error "Please configure the number of filters in CubeMX, and then add a compiler define for FTCAN_NUM_FILTERS"
#endif
#else #else
#error "Couldn't detect STM family" #error "Couldn't detect STM family"
#endif #endif