2017-06-27 20:27:24 -06:00
|
|
|
#ifndef PANDA_CONFIG_H
|
|
|
|
#define PANDA_CONFIG_H
|
|
|
|
|
|
|
|
//#define DEBUG
|
2019-10-04 14:28:56 -06:00
|
|
|
//#define DEBUG_UART
|
2017-06-27 20:27:24 -06:00
|
|
|
//#define DEBUG_USB
|
2017-07-24 13:31:47 -06:00
|
|
|
//#define DEBUG_SPI
|
2019-11-27 19:11:21 -07:00
|
|
|
//#define DEBUG_FAULTS
|
2017-06-27 20:27:24 -06:00
|
|
|
|
2017-07-12 12:25:10 -06:00
|
|
|
#ifdef STM32F4
|
|
|
|
#include "stm32f4xx.h"
|
2021-05-18 09:51:05 -06:00
|
|
|
#ifndef GATEWAY
|
|
|
|
#define PANDA
|
|
|
|
#endif
|
2017-07-12 12:25:10 -06:00
|
|
|
#else
|
|
|
|
#include "stm32f2xx.h"
|
|
|
|
#endif
|
2017-06-30 14:51:56 -06:00
|
|
|
|
2019-07-03 00:43:06 -06:00
|
|
|
#define USB_VID 0xbbaaU
|
2017-07-24 16:16:22 -06:00
|
|
|
|
|
|
|
#ifdef BOOTSTUB
|
2019-07-03 00:43:06 -06:00
|
|
|
#define USB_PID 0xddeeU
|
2017-07-24 16:16:22 -06:00
|
|
|
#else
|
2019-07-03 00:43:06 -06:00
|
|
|
#define USB_PID 0xddccU
|
2017-07-24 16:16:22 -06:00
|
|
|
#endif
|
2017-06-30 17:41:36 -06:00
|
|
|
|
2017-07-24 16:16:22 -06:00
|
|
|
#include <stdbool.h>
|
2017-07-21 00:42:19 -06:00
|
|
|
#define NULL ((void*)0)
|
2019-09-27 18:18:02 -06:00
|
|
|
#define COMPILE_TIME_ASSERT(pred) ((void)sizeof(char[1 - (2 * ((int)(!(pred))))]))
|
2017-07-21 00:42:19 -06:00
|
|
|
|
2019-06-17 14:48:14 -06:00
|
|
|
#define MIN(a,b) \
|
2017-07-21 12:48:03 -06:00
|
|
|
({ __typeof__ (a) _a = (a); \
|
|
|
|
__typeof__ (b) _b = (b); \
|
2019-06-17 19:39:17 -06:00
|
|
|
(_a < _b) ? _a : _b; })
|
2017-07-21 12:48:03 -06:00
|
|
|
|
2019-06-17 14:48:14 -06:00
|
|
|
#define MAX(a,b) \
|
2017-07-21 12:48:03 -06:00
|
|
|
({ __typeof__ (a) _a = (a); \
|
|
|
|
__typeof__ (b) _b = (b); \
|
2019-06-17 19:39:17 -06:00
|
|
|
(_a > _b) ? _a : _b; })
|
2017-07-21 12:48:03 -06:00
|
|
|
|
2020-03-11 18:30:30 -06:00
|
|
|
#define ABS(a) \
|
|
|
|
({ __typeof__ (a) _a = (a); \
|
|
|
|
(_a > 0) ? _a : (-_a); })
|
|
|
|
|
2019-07-04 02:04:58 -06:00
|
|
|
#define MAX_RESP_LEN 0x40U
|
2017-07-24 16:16:22 -06:00
|
|
|
|
2019-11-27 19:11:21 -07:00
|
|
|
// Around (1Mbps / 8 bits/byte / 12 bytes per message)
|
|
|
|
#define CAN_INTERRUPT_RATE 12000U
|
|
|
|
|
2017-06-27 20:27:24 -06:00
|
|
|
#endif
|
2017-07-24 16:16:22 -06:00
|
|
|
|