Open FFBoard
Open source force feedback firmware
Loading...
Searching...
No Matches
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,17,0}; // 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#ifdef HIDAXISRES_USE_32B_DESC
35#define AXIS1_FFB_HID_DESC_32B
36#else
37#define AXIS1_FFB_HID_DESC
38#endif
39#else
40#ifdef HIDAXISRES_USE_32B_DESC
41#define AXIS2_FFB_HID_DESC_32B
42#else
43#define AXIS2_FFB_HID_DESC
44#endif
45#endif
46#endif
47
48#ifdef FFBJOYSTICK
49#define AXIS2_FFB_HID_DESC
50#endif
51
52#ifndef HSPIDRV
53#undef TMC4671DRIVER
54#endif
55
56#ifdef FFBHIDEXT
57#define FFB_HID_DESC_GAMEPAD
58#endif
59
60#ifndef ENCODER_SPI_PORT
61#define ENCODER_SPI_PORT ext3_spi // See cpp_target_config.cpp for ports
62#endif
63
64#ifdef SIMPLEMOTION
65#define GPIO_MOTOR // See cpp_target_config.cpp for pin
66#endif
67
68#if defined(I2C_PORT_EEPROM) && defined(I2C_EEPROM_ADR)
69#define USE_I2C_EEPROM
70#else
71#if defined(EEPROM_START_ADDRESS)
72#define USE_EEPROM_EMULATION
73#endif
74#endif
75
76#if defined(PCF8574BUTTONS) || defined(I2C_PORT)
77#define I2CBUS
78#endif
79
80
81#ifndef TEMPSENSOR_ADC_RES
82#define TEMPSENSOR_ADC_RES 0
83#endif
84
85// Assume vref is calibrated in full resolution. Check chip and __LL_ADC_CALC_VREFANALOG_VOLTAGE how to scale
86#ifndef VREF_ADC_RES
87#define VREF_ADC_RES 0
88#endif
89
90#ifndef VSENSE_ADC_RES
91#define VSENSE_ADC_RES 0
92#endif
93
94#ifndef ADC_INTREF_VOL
95 #ifndef ADC_INTREF_VAL
96 #define ADC_INTREF_VOL 3300
97 #else
98 #define ADC_INTREF_VOL ((ADC_INTREF_VAL > 0) ? __LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC_INTREF_VAL,VREF_ADC_RES) : 0)
99 #endif
100#endif
101
102#ifndef VOLTAGE_MULT_DEFAULT
103#define VOLTAGE_MULT_DEFAULT 30.67 // mV adc * scaler = voltage for 976k/33k divider and 3.3V vref
104#endif
105
106#if defined(TIM_MICROS_HALTICK) && defined(TIM_MICROS)
107#error "Only TIM_MICROS_HALTICK OR TIM_MICROS may be defined as a microsecond timebase"
108#endif
109
110#ifndef SIGNATURELEN
111#define SIGNATURELEN 8
112#define SIGNATURE
113#endif
114
115#if (defined(FLASH_OTP_BASE) && defined(FLASH_OTP_END)) || (defined(I2C_EEPROM_OTP_ADR) && defined(I2C_PORT_EEPROM))
116#define OTPMEMORY
117#endif
118
119
120#endif
static const uint8_t SW_VERSION_INT[3]
Definition constants.h:11