From 70883e1e33520bad5ffb9c969a15b9d4b8428c54 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Wed, 7 Aug 2024 17:11:50 +0100 Subject: [PATCH] Removed some legacy EXP1HCE support --- src/BoardType.cpp | 34 ++-------------------------------- src/Config/SAMC21config.h | 3 --- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/BoardType.cpp b/src/BoardType.cpp index ba6e96e..d564e93 100644 --- a/src/BoardType.cpp +++ b/src/BoardType.cpp @@ -325,7 +325,7 @@ constexpr bool LedActiveHigh[] = constexpr Pin CanResetPins[] = { CanResetPin_Tool1LC, - CanResetPin_Exp1HCE, + NoPin, // was CanResetPin_1HCE NoPin, CanResetPin_SZP, CanResetPin_Exp1XD, @@ -380,30 +380,6 @@ constexpr uint16_t BoardId2DecisionPoints[] = static_assert(ARRAY_SIZE(BoardId2DecisionPoints) + 1 == ARRAY_SIZE(BoardType2Fractions)); -// Buttons pin ADC handling for EXP1HCE board - -constexpr float BothButtonsDownRgnd = (4.7 * 10.0)/(4.7 + 10.0); - -constexpr float ButtonsExpectedFractions[] = -{ - BothButtonsDownRgnd/(BothButtonsDownRgnd + 10.0), - 4.7/(4.7 + 10.0), - 10.0/(1.00 + 10.0), - 1.0 -}; - -static_assert(IsIncreasing(ButtonsExpectedFractions, ARRAY_SIZE(ButtonsExpectedFractions))); - -// Table of halfway points that we use to decide what board type a reading corresponds to -constexpr uint16_t ButtonsDecisionPoints[] = -{ - (uint16_t)((ButtonsExpectedFractions[0] + ButtonsExpectedFractions[1]) * (AdcRange/2)), - (uint16_t)((ButtonsExpectedFractions[1] + ButtonsExpectedFractions[2]) * (AdcRange/2)), - (uint16_t)((ButtonsExpectedFractions[2] + ButtonsExpectedFractions[3]) * (AdcRange/2)) -}; - -static_assert(ARRAY_SIZE(ButtonsDecisionPoints) + 1 == ARRAY_SIZE(ButtonsExpectedFractions)); - // Function to read a pin and scan a table of decision points to find the corresponding index static unsigned int ReadAndQuantise(uint8_t chan, const uint16_t decisionPoints[], size_t numDecisionPoints) { @@ -462,14 +438,8 @@ bool IdentifyBoard(CanAddress& defaultAddress, bool& doHardwareReset, bool& useA defaultAddress = CanId::Exp1XDBoardDefaultAddress; break; - case BoardId::exp1hce_v0: + case BoardId::exp1hce_v0: // no longer supported defaultAddress = CanId::Exp1HCLBoardDefaultAddress; - - SetPinFunction(ButtonsPin_Exp1HCE, GpioPinFunction::B); // both buttons are on a single analog pin - { - const unsigned int buttonState = ReadAndQuantise(ButtonsAdcChannel_Exp1HCE, ButtonsDecisionPoints, ARRAY_SIZE(ButtonsDecisionPoints)); - doHardwareReset = (buttonState == 0); - } break; case BoardId::szp: diff --git a/src/Config/SAMC21config.h b/src/Config/SAMC21config.h index 1fe215c..c32e5e3 100644 --- a/src/Config/SAMC21config.h +++ b/src/Config/SAMC21config.h @@ -28,8 +28,6 @@ constexpr Pin BoardTypePin = PortAPin(5); constexpr uint8_t BoardTypeAdcChannel = 5; constexpr Pin BoardType2Pin = PortAPin(4); // second board type pin used on some boards constexpr uint8_t BoardType2AdcChannel = 4; -constexpr Pin ButtonsPin_Exp1HCE = PortAPin(9); -constexpr uint8_t ButtonsAdcChannel_Exp1HCE = 9; constexpr Pin GlobalTmc22xxEnablePin_Tool1LC = PortBPin(2); constexpr Pin OutPins_Tool1LC[] = { PortAPin(11), PortAPin(10), PortBPin(11) }; @@ -38,7 +36,6 @@ constexpr Pin ButtonPins_Tool1LC[] = { PortBPin(22), PortBPin(23) }; constexpr Pin CanResetPin_Tool1LC = PortBPin(22); // first button pin constexpr Pin CanResetPin_SZP = PortAPin(18); constexpr Pin CanResetPin_Exp1XD = PortAPin(27); -constexpr Pin CanResetPin_Exp1HCE = NoPin; constexpr Pin CanResetPin_AteCM = NoPin; // the CAN jumper on the ATECM is connected between AteCmJumperPin and AteCmZeroPin constexpr Pin CanResetPin_AteIO_v01 = PortAPin(16); constexpr Pin CanResetPin_AteIO_v02 = PortBPin(11);