auto-sync

This commit is contained in:
rusEfi 2014-12-23 21:06:10 -06:00
parent a0cf609f51
commit 23b33cc818
17 changed files with 98 additions and 17 deletions

View File

@ -1,3 +0,0 @@
#define baseHardwareInit() {}

View File

@ -10,6 +10,9 @@
#define POTEN_H_
#include "main.h"
#if HAL_USE_SPI || defined(__DOXYGEN__)
#include "engine_configuration.h"
typedef struct {
@ -21,4 +24,6 @@ typedef struct {
void initPotentiometers(board_configuration_s *boardConfiguration);
void setPotResistance(Mcp42010Driver *driver, int channel, int resistance);
#endif
#endif /* POTEN_H_ */

View File

@ -10,6 +10,9 @@
#define WAVE_ANALYZER_H_
#include "main.h"
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
#include "datalogging.h"
#include "wave_analyzer_hw.h"
@ -57,5 +60,7 @@ public:
void initWaveAnalyzer(void);
void printWave(Logging *logging);
#endif
#endif /* WAVE_ANALYZER_H_ */

View File

@ -7,6 +7,8 @@
#ifndef ADCCONFIGURATION_H_
#define ADCCONFIGURATION_H_
#if HAL_USE_ADC || defined(__DOXYGEN__)
class AdcConfiguration {
public:
AdcConfiguration(ADCConversionGroup* hwConfig);
@ -31,5 +33,6 @@ private:
adc_channel_e hardwareIndexByIndernalAdcIndex[20];
};
#endif /* HAL_USE_ADC */
#endif /* ADCCONFIGURATION_H_ */

View File

@ -28,7 +28,7 @@
#include "rpm_calculator.h"
#include "trigger_central.h"
#if EFI_HIP_9011
#if EFI_HIP_9011 || defined(__DOXYGEN__)
extern pin_output_mode_e DEFAULT_OUTPUT;

View File

@ -7,6 +7,9 @@
*/
#include "main.h"
#if HAL_USE_ADC || defined(__DOXYGEN__)
#include "engine_configuration.h"
#include "adc_inputs.h"
#include "AdcConfiguration.h"
@ -546,3 +549,4 @@ void pokeAdcInputs() {
printFullAdcReport();
}
#endif /* HAL_USE_ADC */

View File

@ -10,6 +10,9 @@
#define ADC_INPUTS_H_
#include "main.h"
#if HAL_USE_ADC || defined(__DOXYGEN__)
#include "adc_math.h"
const char * getAdcMode(adc_channel_e hwChannel);
@ -55,4 +58,6 @@ typedef struct {
// todo: migrate to adcToVoltageInputDividerCoefficient
#define adcToVoltsDivided(adc) (adcToVolts(adc) * engineConfiguration->analogInputDividerCoefficient)
#endif /* HAL_USE_ADC */
#endif /* ADC_INPUTS_H_ */

View File

@ -32,13 +32,15 @@
static volatile int stepCoutner = 0;
static volatile brain_pin_e currentPin = GPIO_UNASSIGNED;
extern AdcConfiguration slowAdc;
extern AdcConfiguration fastAdc;
static bool isTimeForNextStep(int copy) {
return copy != stepCoutner;
}
#if HAL_USE_ADC || defined(__DOXYGEN__)
extern AdcConfiguration slowAdc;
extern AdcConfiguration fastAdc;
static void processAdcPin(AdcConfiguration *adc, int index, const char *prefix) {
adc_channel_e hwIndex = adc->getAdcHardwareIndexByInternalIndex(index);
GPIO_TypeDef* port = getAdcChannelPort(hwIndex);
@ -60,7 +62,7 @@ static void processAdcPin(AdcConfiguration *adc, int index, const char *prefix)
}
}
#endif
static volatile int currentIndex = 0;
static void waitForKey(void) {
@ -134,7 +136,9 @@ bool isBoardTestMode(void) {
void printBoardTestState(void) {
print("Current index=%d\r\n", currentIndex);
print("'n' for next step and 'set X' to return to step X\r\n");
#if HAL_USE_ADC || defined(__DOXYGEN__)
print("ADC count: slow %d/fast %d\r\n", slowAdc.size(), fastAdc.size());
#endif
if (currentPin != GPIO_UNASSIGNED) {
print("Blinking %s\r\n", hwPortname(currentPin));
@ -150,11 +154,13 @@ void initBoardTest(void) {
// this code is ugly as hell, I had no time to think. Todo: refactor
#if HAL_USE_ADC || defined(__DOXYGEN__)
processAdcPin(&fastAdc, 0, "fast");
while (currentIndex < slowAdc.size()) {
processAdcPin(&slowAdc, currentIndex, "slow");
currentIndex++;
}
#endif
currentIndex = 0;

View File

@ -28,7 +28,11 @@ static Logging logger;
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
extern OutputPin outputs[IO_PIN_COUNT];
#if defined(STM32F4XX)
static GPIO_TypeDef *PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH };
#else
static GPIO_TypeDef *PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOF};
#endif
pin_output_mode_e DEFAULT_OUTPUT = OM_DEFAULT;
@ -111,8 +115,11 @@ static void getPinValue(const char *name) {
void initOutputPins(void) {
initLogging(&logger, "io_pins");
#if EFI_WARNING_LED
outputPinRegister("warning", LED_WARNING, LED_WARNING_PORT, LED_WARNING_PIN);
outputPinRegister("is running status", LED_RUNNING, LED_RUNNING_STATUS_PORT, LED_RUNNING_STATUS_PIN);
#endif /* EFI_WARNING_LED */
outputPinRegister("communication status 1", LED_COMMUNICATION_1, LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN);
/**
@ -132,7 +139,9 @@ void initOutputPins(void) {
// outputPinRegister("spi CS2", SPI_CS_2, SPI_CS2_PORT, SPI_CS2_PIN);
// outputPinRegister("spi CS3", SPI_CS_3, SPI_CS3_PORT, SPI_CS3_PIN);
// outputPinRegister("spi CS4", SPI_CS_4, SPI_CS4_PORT, SPI_CS4_PIN);
#if HAL_USE_SPI || defined(__DOXYGEN__)
outputPinRegister("spi CS5", SPI_CS_SD_MODULE, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN);
#endif
// todo: should we move this code closer to the fuel pump logic?
outputPinRegisterExt2("fuel pump relay", FUEL_PUMP_RELAY, boardConfiguration->fuelPumpPin, &DEFAULT_OUTPUT);

View File

@ -6,11 +6,10 @@
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include <ch.h>
#include <hal.h>
#include "mcp3208.h"
#include "main.h"
#if EFI_MCP_3208 || defined(__DOXYGEN__)
#include "mcp3208.h"
#include "pin_repository.h"
McpAdcState *hack;
@ -138,3 +137,4 @@ void init_adc_mcp3208(McpAdcState *state, SPIDriver *driver) {
spiStart(driver, &spicfg);
}
#endif /* EFI_MCP_3208 */

View File

@ -16,6 +16,10 @@
#ifndef MCP3208_H_
#define MCP3208_H_
#include "main.h"
#if EFI_MCP_3208 || defined(__DOXYGEN__)
#define MCP3208_CS_PORT GPIOD
#define MCP3208_CS_PIN 11
@ -37,4 +41,6 @@ void adc_in_out(McpAdcState *state);
int getMcp3208adc(int channel);
#endif /* EFI_MCP_3208 */
#endif /* MCP3208_H_ */

View File

@ -18,7 +18,7 @@
// https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fInterrupt%20on%20CEN%20bit%20setting%20in%20TIM7&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=474
#if EFI_PROD_CODE
#if (EFI_PROD_CODE && HAL_USE_GPT) || defined(__DOXYGEN__)
#define GPTDEVICE GPTD5

View File

@ -35,12 +35,14 @@ char *portname(GPIO_TypeDef* GPIOx) {
return "PC";
if (GPIOx == GPIOD)
return "PD";
#if defined(STM32F4XX)
if (GPIOx == GPIOE)
return "PE";
if (GPIOx == GPIOF)
return "PF";
if (GPIOx == GPIOH)
return "PH";
#endif
if (GPIOx == GPIOF)
return "PF";
return "unknown";
}
@ -53,12 +55,14 @@ static int getPortIndex(GPIO_TypeDef* port) {
return 2;
if (port == GPIOD)
return 3;
#if defined(STM32F4XX)
if (port == GPIOE)
return 4;
if (port == GPIOF)
return 5;
if (port == GPIOH)
return 6;
#endif
if (port == GPIOF)
return 5;
firmwareError("portindex");
return -1;
}

View File

@ -0,0 +1,14 @@
/**
* @file mpu_util.cpp
*
* @date Dec 23, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "main.h"
int getRemainingStack(Thread *otp) {
return 9999;
}

View File

@ -0,0 +1,13 @@
/**
* @file mpu_util.h
*
* @date Dec 23, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef MPU_UTIL_H_
#define MPU_UTIL_H_
#define baseHardwareInit() {}
#endif /* MPU_UTIL_H_ */

View File

@ -7,6 +7,9 @@
*/
#include "wave_analyzer_hw.h"
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
#include "eficonsole.h"
#include "pin_repository.h"
@ -169,3 +172,5 @@ void setWaveReaderMode(WaveReaderHw *hw, bool mode) {
}
hw->started = TRUE;
}
#endif

View File

@ -9,6 +9,9 @@
#define WAVE_ANALYZER_HW_H_
#include "main.h"
#if HAL_USE_ICU || defined(__DOXYGEN__)
#include "listener_array.h"
typedef struct {
@ -36,4 +39,6 @@ ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
}
#endif /* __cplusplus */
#endif
#endif /* WAVE_ANALYZER_HW_H_ */