2022-12-01 06:15:09 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2017-06-28 10:27:24 +08:00
|
|
|
|
|
|
|
//#define DEBUG
|
2019-10-05 04:28:56 +08:00
|
|
|
//#define DEBUG_UART
|
2017-06-28 10:27:24 +08:00
|
|
|
//#define DEBUG_USB
|
2017-07-25 03:31:47 +08:00
|
|
|
//#define DEBUG_SPI
|
2019-11-28 10:11:21 +08:00
|
|
|
//#define DEBUG_FAULTS
|
2022-11-11 13:34:43 +08:00
|
|
|
//#define DEBUG_COMMS
|
2023-04-21 04:00:40 +08:00
|
|
|
//#define DEBUG_FAN
|
2017-06-28 10:27:24 +08:00
|
|
|
|
2022-12-01 06:15:09 +08:00
|
|
|
#define CAN_INIT_TIMEOUT_MS 500U
|
2022-03-08 06:24:04 +08:00
|
|
|
#define DEEPSLEEP_WAKEUP_DELAY 3U
|
2022-12-01 06:15:09 +08:00
|
|
|
#define USBPACKET_MAX_SIZE 0x40U
|
2023-05-20 13:43:34 +08:00
|
|
|
#define MAX_CAN_MSGS_PER_USB_BULK_TRANSFER 51U
|
|
|
|
#define MAX_CAN_MSGS_PER_SPI_BULK_TRANSFER 170U
|
2022-03-08 06:24:04 +08:00
|
|
|
|
2022-12-01 06:15:09 +08:00
|
|
|
// USB definitions
|
|
|
|
#define USB_VID 0xBBAAU
|
2017-07-22 02:48:03 +08:00
|
|
|
|
2023-08-04 14:55:13 +08:00
|
|
|
#ifdef PANDA_JUNGLE
|
|
|
|
#ifdef BOOTSTUB
|
|
|
|
#define USB_PID 0xDDEFU
|
|
|
|
#else
|
|
|
|
#define USB_PID 0xDDCFU
|
|
|
|
#endif
|
2022-12-01 06:15:09 +08:00
|
|
|
#else
|
2023-08-04 14:55:13 +08:00
|
|
|
#ifdef BOOTSTUB
|
|
|
|
#define USB_PID 0xDDEEU
|
|
|
|
#else
|
|
|
|
#define USB_PID 0xDDCCU
|
|
|
|
#endif
|
2022-12-01 06:15:09 +08:00
|
|
|
#endif
|
2020-03-12 08:30:30 +08:00
|
|
|
|
2022-12-01 06:15:09 +08:00
|
|
|
// platform includes
|
2021-08-03 11:26:15 +08:00
|
|
|
#ifdef STM32H7
|
|
|
|
#include "stm32h7/stm32h7_config.h"
|
2022-12-01 06:15:09 +08:00
|
|
|
#elif defined(STM32F2) || defined(STM32F4)
|
2021-08-03 11:26:15 +08:00
|
|
|
#include "stm32fx/stm32fx_config.h"
|
2022-12-01 06:15:09 +08:00
|
|
|
#else
|
|
|
|
// TODO: uncomment this, cppcheck complains
|
|
|
|
// building for tests
|
|
|
|
//#include "fake_stm.h"
|
2017-06-28 10:27:24 +08:00
|
|
|
#endif
|