From 67ce304d08173a85eac110403b4dbd5281a8c315 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 24 Jan 2015 08:06:53 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/algo/io_pins.h | 13 ++------ firmware/hw_layer/board_test.cpp | 51 +++++++++++++++++++++++++---- firmware/iar/ch.ewp | 18 ++++++++++ firmware/rusefi.cpp | 2 +- 4 files changed, 67 insertions(+), 17 deletions(-) diff --git a/firmware/controllers/algo/io_pins.h b/firmware/controllers/algo/io_pins.h index d90d50a48c..55f9a1fdf9 100644 --- a/firmware/controllers/algo/io_pins.h +++ b/firmware/controllers/algo/io_pins.h @@ -5,8 +5,8 @@ * @author Andrey Belomutskiy, (c) 2012-2015 */ -#ifndef STATUS_LEDS_H_ -#define STATUS_LEDS_H_ +#ifndef IO_PINS_H_ +#define IO_PINS_H_ #include "rusefi_enums.h" @@ -66,17 +66,10 @@ typedef enum { void initPrimaryPins(void); void initOutputPins(void); -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #if EFI_GPIO void turnAllPinsOff(void); #else #define turnAllPinsOff() {} #endif -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* STATUS_LEDS_H_ */ +#endif /* IO_PINS_H_ */ diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp index 09b583aea6..f70698a971 100644 --- a/firmware/hw_layer/board_test.cpp +++ b/firmware/hw_layer/board_test.cpp @@ -106,8 +106,16 @@ static brain_pin_e BLINK_PINS[] = { GPIOE_8, // HIGH DRIVER 1 GPIOB_7, // OUT12 Frankenso }; +int pinsCount = sizeof(BLINK_PINS) / sizeof(brain_pin_e); + static THD_WORKING_AREA(btThreadStack, UTILITY_THREAD_STACK_SIZE); +static void setCurrentPinValue(bool value) { + GPIO_TypeDef *hwPort = getHwPort(currentPin); + uint32_t hwPin = getHwPin(currentPin); + palWritePad(hwPort, hwPin, value); +} + static msg_t ivThread(int param) { (void) param; chRegSetThreadName("board test blinking"); @@ -117,9 +125,7 @@ static msg_t ivThread(int param) { while (TRUE) { chThdSleepMilliseconds(250); value = 1 - value; - GPIO_TypeDef *hwPort = getHwPort(currentPin); - uint32_t hwPin = getHwPin(currentPin); - palWritePad(hwPort, hwPin, value); + setCurrentPinValue(value); } #if defined __GNUC__ return 0; @@ -144,13 +150,48 @@ void printBoardTestState(void) { } } +static void btInitOutputPins() { + for (int i = 0; i < pinsCount; i++) { + currentPin = BLINK_PINS[i]; + mySetPadMode2("test", currentPin, PAL_STM32_MODE_OUTPUT); + } +} + +static void blinkAllOutputPins() { + for (int k = 0; k < 6; k++) { + for (int i = 0; i < pinsCount; i++) { + currentPin = BLINK_PINS[i]; + setCurrentPinValue(k % 2); + } + chThdSleepMilliseconds(250); + } + currentPin = GPIO_UNASSIGNED; + /** + * Now let's blink all pins one by one + */ + for (int k = 0; k < 2; k++) { + for (int i = 0; i < pinsCount; i++) { + if (currentPin != GPIO_UNASSIGNED) + setCurrentPinValue(false); // turn off previous pin + + currentPin = BLINK_PINS[i]; + setCurrentPinValue(true); + chThdSleepMilliseconds(250); + } + } + setCurrentPinValue(false); + currentPin = GPIO_UNASSIGNED; +} + void initBoardTest(void) { is_board_test_mode = true; addConsoleAction("n", nextStep); addConsoleActionI("set", setIndex); - chThdCreateStatic(btThreadStack, sizeof(btThreadStack), NORMALPRIO, (tfunc_t) ivThread, NULL); + btInitOutputPins(); + blinkAllOutputPins(); + chThdCreateStatic(btThreadStack, sizeof(btThreadStack), NORMALPRIO, (tfunc_t) ivThread, NULL); // this code is ugly as hell, I had no time to think. Todo: refactor #if HAL_USE_ADC || defined(__DOXYGEN__) @@ -163,12 +204,10 @@ void initBoardTest(void) { currentIndex = 0; - int pinsCount = sizeof(BLINK_PINS) / sizeof(brain_pin_e); while (currentIndex < pinsCount) { currentPin = BLINK_PINS[currentIndex]; printBoardTestState(); - mySetPadMode2("test", currentPin, PAL_STM32_MODE_OUTPUT); currentIndex++; waitForKey(); diff --git a/firmware/iar/ch.ewp b/firmware/iar/ch.ewp index 5a849cbf0a..c46226e7b1 100644 --- a/firmware/iar/ch.ewp +++ b/firmware/iar/ch.ewp @@ -1904,6 +1904,12 @@ config engines + + $PROJ_DIR$\..\config\engines\acura_rsx.cpp + + + $PROJ_DIR$\..\config\engines\acura_rsx.h + $PROJ_DIR$\..\config\engines\audi_aan.cpp @@ -1922,6 +1928,12 @@ $PROJ_DIR$\..\config\engines\citroenBerlingoTU3JP.h + + $PROJ_DIR$\..\config\engines\custom_engine.cpp + + + $PROJ_DIR$\..\config\engines\custom_engine.h + $PROJ_DIR$\..\config\engines\dodge_neon.cpp @@ -1967,6 +1979,12 @@ $PROJ_DIR$\..\config\engines\mazda_323.h + + $PROJ_DIR$\..\config\engines\mazda_626.cpp + + + $PROJ_DIR$\..\config\engines\mazda_626.h + $PROJ_DIR$\..\config\engines\mazda_miata.cpp diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 9ea22d226c..2246ca6988 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -262,5 +262,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE == 0) return 1; // this is here to make the compiler happy about the unused array - return 20150123; + return 20150124; }