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,2}; // 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#endif
28
29
30#ifdef FFBWHEEL
31#ifdef FFBWHEEL_USE_1AXIS_DESC
32#define AXIS1_FFB_HID_DESC
33#else
34#define AXIS2_FFB_HID_DESC
35#endif
36#endif
37
38#ifdef FFBJOYSTICK
39#define AXIS2_FFB_HID_DESC
40#endif
41
42#ifndef HSPIDRV
43#undef TMC4671DRIVER
44#endif
45
46#ifdef FFBHIDEXT
47#define FFB_HID_DESC_GAMEPAD
48#endif
49
50#ifndef ENCODER_SPI_PORT
51#define ENCODER_SPI_PORT ext3_spi // See cpp_target_config.cpp for ports
52#endif
53
54#ifdef SIMPLEMOTION
55#define GPIO_MOTOR // See cpp_target_config.cpp for pin
56#endif
57
58#if defined(I2C_PORT_EEPROM) && defined(I2C_EEPROM_ADR)
59#define USE_I2C_EEPROM
60#else
61#if defined(EEPROM_START_ADDRESS)
62#define USE_EEPROM_EMULATION
63#endif
64#endif
65
66#if defined(PCF8574BUTTONS) || defined(I2C_PORT)
67#define I2CBUS
68#endif
69
70
71#ifndef TEMPSENSOR_ADC_RES
72#define TEMPSENSOR_ADC_RES 0
73#endif
74
75// Assume vref is calibrated in full resolution. Check chip and __LL_ADC_CALC_VREFANALOG_VOLTAGE how to scale
76#ifndef VREF_ADC_RES
77#define VREF_ADC_RES 0
78#endif
79
80#ifndef VSENSE_ADC_RES
81#define VSENSE_ADC_RES 0
82#endif
83
84#ifndef ADC_INTREF_VOL
85 #ifndef ADC_INTREF_VAL
86 #define ADC_INTREF_VOL 3300
87 #else
88 #define ADC_INTREF_VOL ((ADC_INTREF_VAL > 0) ? __LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC_INTREF_VAL,VREF_ADC_RES) : 0)
89 #endif
90#endif
91
92#ifndef VOLTAGE_MULT_DEFAULT
93#define VOLTAGE_MULT_DEFAULT 30.67 // mV adc * scaler = voltage for 976k/33k divider and 3.3V vref
94#endif
95
96#if defined(TIM_MICROS_HALTICK) && defined(TIM_MICROS)
97#error "Only TIM_MICROS_HALTICK OR TIM_MICROS may be defined as a microsecond timebase"
98#endif
99
100
101#endif
static const uint8_t SW_VERSION_INT[3]
Definition: constants.h:11