refactoring - reducing complexity

This commit is contained in:
rusefi 2017-04-21 12:31:17 -04:00
parent e201033eae
commit 7aa92862e8
2 changed files with 7 additions and 36 deletions

View File

@ -151,9 +151,9 @@ public:
#if EFI_PROD_CODE #if EFI_PROD_CODE
#define isPinAssigned(output) ((output)->port != GPIO_NULL) #define isPinAssigned(output) ((output)->port != GPIO_NULL)
#else #else /* EFI_PROD_CODE */
#define isPinAssigned(output) (true) #define isPinAssigned(output) (true)
#endif #endif /* EFI_PROD_CODE */
#define doSetOutputPinValue(pin, logicValue) doSetOutputPinValue2((&outputs[pin]), logicValue) #define doSetOutputPinValue(pin, logicValue) doSetOutputPinValue2((&outputs[pin]), logicValue)
@ -168,21 +168,24 @@ public:
setPinValue(output, eValue, logicValue); \ setPinValue(output, eValue, logicValue); \
} \ } \
} }
#else #else /* EFI_PROD_CODE */
#define doSetOutputPinValue2(output, logicValue) { \ #define doSetOutputPinValue2(output, logicValue) { \
pin_output_mode_e mode = OM_DEFAULT; \ pin_output_mode_e mode = OM_DEFAULT; \
int eValue = getElectricalValue(logicValue, mode); \ int eValue = getElectricalValue(logicValue, mode); \
setPinValue(output, eValue, logicValue); \ setPinValue(output, eValue, logicValue); \
} }
#endif #endif /* EFI_PROD_CODE */
void turnPinHigh(NamedOutputPin *output); void turnPinHigh(NamedOutputPin *output);
void turnPinLow(NamedOutputPin *output); void turnPinLow(NamedOutputPin *output);
#if EFI_PROD_CODE
void initOutputPin(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber); void initOutputPin(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber);
void initOutputPinExt(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber, iomode_t mode); void initOutputPinExt(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber, iomode_t mode);
#endif /* EFI_PROD_CODE */
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode); void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
#endif /* EFIGPIO_H_ */ #endif /* EFIGPIO_H_ */

View File

@ -1,32 +0,0 @@
/**
* @file gpio_helper.c
* @brief General I/O helper
*
* @date Aug 25, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPIO_HELPER_C_
#define GPIO_HELPER_C_
#include <hal.h>
#include "pin_repository.h"
#include "gpio_helper.h"
#include "engine.h"
#endif /* GPIO_HELPER_C_ */