trigger signal debug pins - logic level output #2959

This commit is contained in:
Andrey 2021-07-15 01:46:30 -04:00
parent 23be588af6
commit c513e976ed
6 changed files with 21 additions and 21 deletions

View File

@ -175,12 +175,12 @@ void turnOnTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void stopTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (int i = 0; i < TRIGGER_INPUT_PIN_COUNT; i++) {
if (isConfigurationChanged(triggerInputDebugPins[i])) {
efiSetPadUnused(CONFIG(triggerInputDebugPins[i]));
efiSetPadUnused(CONFIG(triggerInputDebugPins[i]) PASS_ENGINE_PARAMETER_SUFFIX);
}
}
for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
if (isConfigurationChanged(camInputsDebug[i])) {
efiSetPadUnused(CONFIG(camInputsDebug[i]));
efiSetPadUnused(CONFIG(camInputsDebug[i]) PASS_ENGINE_PARAMETER_SUFFIX);
}
}
}
@ -188,12 +188,12 @@ void stopTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void startTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (int i = 0; i < TRIGGER_INPUT_PIN_COUNT; i++) {
if (isConfigurationChanged(triggerInputDebugPins[i])) {
efiSetPadMode("trigger debug", CONFIG(triggerInputDebugPins[i]), PAL_MODE_OUTPUT_PUSHPULL PASS_CONFIG_PARAMETER_SUFFIX);
efiSetPadMode("trigger debug", CONFIG(triggerInputDebugPins[i]), PAL_MODE_OUTPUT_PUSHPULL PASS_ENGINE_PARAMETER_SUFFIX);
}
}
for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
if (isConfigurationChanged(camInputsDebug[i])) {
efiSetPadMode("cam debug", CONFIG(camInputsDebug[i]), PAL_MODE_OUTPUT_PUSHPULL PASS_CONFIG_PARAMETER_SUFFIX);
efiSetPadMode("cam debug", CONFIG(camInputsDebug[i]), PAL_MODE_OUTPUT_PUSHPULL PASS_ENGINE_PARAMETER_SUFFIX);
}
}
}

View File

@ -372,7 +372,7 @@ void applyNewHardwareSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* #if EFI_HD44780_LCD */
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode)) {
efiSetPadUnused(activeConfiguration.clutchUpPin);
efiSetPadUnused(activeConfiguration.clutchUpPin PASS_ENGINE_PARAMETER_SUFFIX);
}
stopTriggerDebugPins(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -24,7 +24,7 @@
EXTERN_ENGINE;
void efiSetPadUnused(brain_pin_e brainPin) {
void efiSetPadUnused(brain_pin_e brainPin DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE
/* input with pull up, is it safe? */
iomode_t mode = PAL_STM32_MODE_INPUT | PAL_STM32_PUPDR_PULLUP;
@ -46,19 +46,19 @@ void efiSetPadUnused(brain_pin_e brainPin) {
#endif
#endif /* EFI_PROD_CODE */
brain_pin_markUnused(brainPin);
brain_pin_markUnused(brainPin PASS_ENGINE_PARAMETER_SUFFIX);
}
/**
* This method would set an error condition if pin is already used
*/
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode DECLARE_CONFIG_PARAMETER_SUFFIX) {
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!isBrainPinValid(brainPin)) {
// No pin configured, nothing to do here.
return;
}
bool wasUsed = brain_pin_markUsed(brainPin, msg PASS_CONFIG_PARAMETER_SUFFIX);
bool wasUsed = brain_pin_markUsed(brainPin, msg PASS_ENGINE_PARAMETER_SUFFIX);
if (!wasUsed) {
efiSetPadModeWithoutOwnershipAcquisition(msg, brainPin, mode);

View File

@ -20,9 +20,9 @@
}
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode DECLARE_CONFIG_PARAMETER_SUFFIX);
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode DECLARE_ENGINE_PARAMETER_SUFFIX);
EXTERNC void efiSetPadModeWithoutOwnershipAcquisition(const char *msg, brain_pin_e brainPin, iomode_t mode);
EXTERNC void efiSetPadUnused(brain_pin_e brainPin);
EXTERNC void efiSetPadUnused(brain_pin_e brainPin DECLARE_ENGINE_PARAMETER_SUFFIX);
#if EFI_GPIO_HARDWARE
EXTERNC bool efiReadPin(brain_pin_e pin);

View File

@ -11,7 +11,7 @@
#include "pin_repository.h"
EXTERN_CONFIG;
EXTERN_ENGINE;
static PinRepository pinRepository;
@ -26,7 +26,7 @@ void initBrainUsedPins(void) {
memset(PIN_USED, 0, sizeof(PIN_USED));
}
const char* & getBrainUsedPin(unsigned int idx) {
const char* & getBrainUsedPin(unsigned int idx DECLARE_ENGINE_PARAMETER_SUFFIX) {
/*if (idx >= getBrainPinTotalNum())
return NULL;*/
return PIN_USED[idx];
@ -65,7 +65,7 @@ static int brainPin_to_index(brain_pin_e brainPin)
* @return true if this pin was already used, false otherwise
*/
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_CONFIG_PARAMETER_SUFFIX) {
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if ! EFI_BOOTLOADER
efiPrintf("%s on %s", msg, hwPortname(brainPin));
#endif
@ -74,17 +74,17 @@ bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_CONFIG_PAR
if (index < 0)
return true;
if (getBrainUsedPin(index) != NULL) {
if (getBrainUsedPin(index PASS_ENGINE_PARAMETER_SUFFIX) != NULL) {
/* TODO: get readable name of brainPin... */
firmwareError(CUSTOM_ERR_PIN_ALREADY_USED_1, "Pin \"%s\" required by \"%s\" but is used by \"%s\" %s",
hwPortname(brainPin),
msg,
getBrainUsedPin(index),
getBrainUsedPin(index PASS_ENGINE_PARAMETER_SUFFIX),
getEngine_type_e(engineConfiguration->engineType));
return true;
}
getBrainUsedPin(index) = msg;
getBrainUsedPin(index PASS_ENGINE_PARAMETER_SUFFIX) = msg;
pinRepository.totalPinsUsed++;
return false;
}
@ -93,7 +93,7 @@ bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_CONFIG_PAR
* See also brain_pin_markUsed()
*/
void brain_pin_markUnused(brain_pin_e brainPin) {
void brain_pin_markUnused(brain_pin_e brainPin DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE
int index = brainPin_to_index(brainPin);
if (index < 0)

View File

@ -36,11 +36,11 @@ EXTERNC bool brain_pin_is_ext(brain_pin_e brainPin);
/**
* Usually high-level code would invoke efiSetPadMode, not this method directly
*/
EXTERNC bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_CONFIG_PARAMETER_SUFFIX);
EXTERNC bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg DECLARE_ENGINE_PARAMETER_SUFFIX);
/**
* See also efiSetPadUnused
*/
EXTERNC void brain_pin_markUnused(brain_pin_e brainPin);
EXTERNC void brain_pin_markUnused(brain_pin_e brainPin DECLARE_ENGINE_PARAMETER_SUFFIX);
const char * getPinFunction(brain_input_pin_e brainPin);
#if EFI_PROD_CODE
@ -58,6 +58,6 @@ unsigned int getBrainPinTotalNum(void);
void initBrainUsedPins(void);
#ifdef __cplusplus
const char* & getBrainUsedPin(unsigned int idx);
const char* & getBrainUsedPin(unsigned int idx DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif