Open FFBoard
Open source force feedback firmware
constants.h
Go to the documentation of this file.
1#ifndef __CONSTANTS_H
2#define __CONSTANTS_H
3
4//#include "main.h"
5#include "target_constants.h" // To be defined in target include folder
6
7/*
8 * For more settings see target_constants.h in a target specific folder
9 */
10
11static const uint8_t SW_VERSION_INT[3] = {1,16,3}; // Version as array. 8 bit each!
12#ifndef MAX_AXIS
13#define MAX_AXIS 2 // ONLY USE 2 for now else screws HID Reports
14#endif
15#if !(MAX_AXIS > 0 && MAX_AXIS <= 3)
16#error "MAX_AXIS must be between 1 and 3"
17#endif
18
19#define FLASH_VERSION 0 // Counter to increase whenever a full flash erase is required.
20
21//#define DEBUGLOG // Uncomment to enable some debug printouts
22
23#ifndef CANBUS
24#undef ODRIVE
25#undef CANBUTTONS
26#undef VESC
27#undef CANBRIDGE
28#undef CANINPUTMAIN
29#endif
30
31
32#ifdef FFBWHEEL
33#ifdef FFBWHEEL_USE_1AXIS_DESC
34#define AXIS1_FFB_HID_DESC
35#else
36#define AXIS2_FFB_HID_DESC
37#endif
38#endif
39
40#ifdef FFBJOYSTICK
41#define AXIS2_FFB_HID_DESC
42#endif
43
44#ifndef HSPIDRV
45#undef TMC4671DRIVER
46#endif
47
48#ifdef FFBHIDEXT
49#define FFB_HID_DESC_GAMEPAD
50#endif
51
52#ifndef ENCODER_SPI_PORT
53#define ENCODER_SPI_PORT ext3_spi // See cpp_target_config.cpp for ports
54#endif
55
56#ifdef SIMPLEMOTION
57#define GPIO_MOTOR // See cpp_target_config.cpp for pin
58#endif
59
60#if defined(I2C_PORT_EEPROM) && defined(I2C_EEPROM_ADR)
61#define USE_I2C_EEPROM
62#else
63#if defined(EEPROM_START_ADDRESS)
64#define USE_EEPROM_EMULATION
65#endif
66#endif
67
68#if defined(PCF8574BUTTONS) || defined(I2C_PORT)
69#define I2CBUS
70#endif
71
72
73#ifndef TEMPSENSOR_ADC_RES
74#define TEMPSENSOR_ADC_RES 0
75#endif
76
77// Assume vref is calibrated in full resolution. Check chip and __LL_ADC_CALC_VREFANALOG_VOLTAGE how to scale
78#ifndef VREF_ADC_RES
79#define VREF_ADC_RES 0
80#endif
81
82#ifndef VSENSE_ADC_RES
83#define VSENSE_ADC_RES 0
84#endif
85
86#ifndef ADC_INTREF_VOL
87 #ifndef ADC_INTREF_VAL
88 #define ADC_INTREF_VOL 3300
89 #else
90 #define ADC_INTREF_VOL ((ADC_INTREF_VAL > 0) ? __LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC_INTREF_VAL,VREF_ADC_RES) : 0)
91 #endif
92#endif
93
94#ifndef VOLTAGE_MULT_DEFAULT
95#define VOLTAGE_MULT_DEFAULT 30.67 // mV adc * scaler = voltage for 976k/33k divider and 3.3V vref
96#endif
97
98#if defined(TIM_MICROS_HALTICK) && defined(TIM_MICROS)
99#error "Only TIM_MICROS_HALTICK OR TIM_MICROS may be defined as a microsecond timebase"
100#endif
101
102
103#endif
static const uint8_t SW_VERSION_INT[3]
Definition: constants.h:11