Skip to content

Commit 0b82f74

Browse files
committed
fix adc knock
1 parent 80a0972 commit 0b82f74

11 files changed

Lines changed: 781 additions & 957 deletions

.DS_Store

0 Bytes
Binary file not shown.

board.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ include $(BOARD_DIR)/meta-info.env
1010
DDEFS += -DEFI_WIDEBAND_FIRMWARE_UPDATE=FALSE
1111
DDEFS += -DRAM_UNUSED_SIZE=100
1212

13+
DDEFS += -DSTM32_ADC_USE_ADC2=TRUE
14+
# todo: make knock pin software-selectable?
15+
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC2=TRUE
16+
DDEFS += -DKNOCK_SPECTROGRAM=TRUE
17+
1318
# assign critical LED to a non-existent pin if you do not have it on your board
1419
# good old PD14 is still the default value
1520
# DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::I15

board_configuration.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Gpio getWarningLedPin() {
1313
return Gpio::Unassigned;
1414
}
1515

16+
17+
1618
// board-specific configuration setup
1719
static void customBoardDefaultConfiguration() {
1820
// engineConfiguration->injectionPins[0] = Gpio::F13;
@@ -49,7 +51,8 @@ static void customBoardDefaultConfiguration() {
4951
engineConfiguration->spi3sckPin = Gpio::C10;
5052
engineConfiguration->is_enabled_spi_3 = true;
5153
engineConfiguration->sdCardCsPin = Gpio::D2;
52-
54+
engineConfiguration->canTxPin = Gpio::D1;
55+
engineConfiguration->canRxPin = Gpio::D0;
5356

5457

5558
}

ext/.DS_Store

0 Bytes
Binary file not shown.

firmware/pinouts.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@ static void setSdCardSpi3() {
1414
engineConfiguration->sdCardCsPin = Gpio::D2;
1515
}
1616

17+
static void setupEtb() {
18+
// TLE9201 driver
19+
// This chip has three control pins:
20+
// DIR - sets direction of the motor
21+
// PWM - pwm control (enable high, coast low)
22+
// DIS - disables motor (enable low)
23+
24+
// Throttle #1
25+
// PWM pin
26+
engineConfiguration->etbIo[0].controlPin = Gpio::A8;
27+
// DIR pin
28+
engineConfiguration->etbIo[0].directionPin1 = Gpio::B8;
29+
// Disable pin
30+
engineConfiguration->etbIo[0].disablePin = Gpio::B9;
31+
32+
// we only have pwm/dir, no dira/dirb
33+
engineConfiguration->etb_use_two_wires = false;
34+
}
35+
1736
static void setBoard_04_pinout() {
1837
engineConfiguration->injectionPins[0] = Gpio::B15;
1938
engineConfiguration->injectionPins[1] = Gpio::B14;
@@ -111,6 +130,7 @@ static void setBoard_mini_pinout() {
111130
engineConfiguration->clutchDownPin = Gpio::E12;
112131
engineConfiguration->clutchDownPinMode = PI_INVERTED_PULLUP;
113132
setSdCardSpi3();
133+
setupEtb();
114134
}
115135

116136

0 commit comments

Comments
 (0)