auto-sync
This commit is contained in:
parent
23b33cc818
commit
284a984288
|
@ -270,6 +270,8 @@ struct context {
|
|||
*/
|
||||
#define PORT_FAST_IRQ_HANDLER(id) void id(void)
|
||||
|
||||
int getRemainingStack(Thread *otp);
|
||||
|
||||
/**
|
||||
* @brief Port-related initialization code.
|
||||
*/
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
/* disk I/O modules and attach it to FatFs module with common interface. */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "main.h"
|
||||
#include "ffconf.h"
|
||||
#include "diskio.h"
|
||||
|
||||
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||
|
||||
#if HAL_USE_MMC_SPI && HAL_USE_SDC
|
||||
#error "cannot specify both MMC_SPI and SDC drivers"
|
||||
#endif
|
||||
|
@ -250,5 +251,5 @@ DWORD get_fattime(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#ifndef _CHCONF_H_
|
||||
#define _CHCONF_H_
|
||||
|
||||
#define ON_LOCK_HOOK
|
||||
#define ON_UNLOCK_HOOK
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name Kernel parameters and options
|
||||
|
@ -357,7 +360,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
|
||||
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
|
||||
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -1 +1,47 @@
|
|||
/**
|
||||
* @file efifeatures.h
|
||||
*
|
||||
* @brief In this header we can configure which firmware modules are used.
|
||||
*
|
||||
* @date Dec 23, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
|
||||
#ifndef EFIFEATURES_H_
|
||||
#define EFIFEATURES_H_
|
||||
|
||||
#define DL_OUTPUT_BUFFER 128
|
||||
|
||||
#define hal_lld_get_counter_value() DWT_CYCCNT
|
||||
|
||||
#define EFI_USE_UART_FOR_CONSOLE TRUE
|
||||
|
||||
#define EFI_CONSOLE_UART_DEVICE (&SD1)
|
||||
|
||||
#define EFI_CONSOLE_TX_PORT GPIOC
|
||||
#define EFI_CONSOLE_TX_PIN 10
|
||||
#define EFI_CONSOLE_RX_PORT GPIOC
|
||||
#define EFI_CONSOLE_RX_PIN 11
|
||||
#define EFI_CONSOLE_AF 7
|
||||
|
||||
|
||||
#define LED_ERROR_PORT GPIOD
|
||||
#define LED_ERROR_PIN 3
|
||||
|
||||
#define LED_COMMUNICATION_PORT GPIOD
|
||||
#define LED_COMMUNICATION_PIN 4
|
||||
|
||||
#define SERIAL_SPEED 115200
|
||||
/**
|
||||
* This macros is used to hide pieces of the code from unit tests, so it only makes sense in folders exposed to the tests project.
|
||||
* This macros is NOT about taking out logging in general.
|
||||
*/
|
||||
#define EFI_PROD_CODE TRUE
|
||||
|
||||
#define CONSOLE_MODE_SWITCH_PORT GPIOB
|
||||
#define CONSOLE_MODE_SWITCH_PIN 1
|
||||
|
||||
#define CONFIG_RESET_SWITCH_PORT GPIOD
|
||||
#define CONFIG_RESET_SWITCH_PIN 6
|
||||
|
||||
#endif /* EFIFEATURES_H_ */
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
|
||||
#define EFI_MAX_31855 TRUE
|
||||
|
||||
#define EFI_MCP_3208 FALSE
|
||||
|
||||
#define EFI_HIP_9011 TRUE
|
||||
|
||||
#define EFI_INTERNAL_ADC TRUE
|
||||
|
@ -107,6 +109,8 @@
|
|||
*/
|
||||
#define EFI_FILE_LOGGING TRUE
|
||||
|
||||
#define EFI_USB_SERIAL TRUE
|
||||
|
||||
/**
|
||||
* While we embed multiple PnP configurations into the same firmware binary, these marcoses give us control
|
||||
* over which configurations go into the binary
|
||||
|
@ -292,6 +296,8 @@
|
|||
#define LED_COMMUNICATION_PORT GPIOD
|
||||
#define LED_COMMUNICATION_PIN GPIOD_LED6
|
||||
|
||||
#define EFI_WARNING_LED TRUE
|
||||
|
||||
// USART1 -> check defined STM32_SERIAL_USE_USART1
|
||||
// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX
|
||||
#define GPS_SERIAL_DEVICE &SD1
|
||||
|
@ -303,6 +309,4 @@
|
|||
#define CONFIG_RESET_SWITCH_PORT GPIOD
|
||||
#define CONFIG_RESET_SWITCH_PIN 6
|
||||
|
||||
|
||||
|
||||
#endif /* EFIFEATURES_H_ */
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#include "console_io.h"
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
|
||||
extern SerialUSBDriver SDU1;
|
||||
#endif
|
||||
#include "usbcfg.h"
|
||||
#include "usbconsole.h"
|
||||
#endif
|
||||
|
@ -125,11 +127,15 @@ bool isSerialOverUart(void) {
|
|||
static SerialConfig serialConfig = { SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
|
||||
|
||||
SerialDriver * getConsoleChannel(void) {
|
||||
#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
|
||||
if (isSerialOverUart()) {
|
||||
return (SerialDriver *) EFI_CONSOLE_UART_DEVICE;
|
||||
} else {
|
||||
return (SerialDriver *) &SDU1;
|
||||
}
|
||||
#else
|
||||
return (SerialDriver *) EFI_CONSOLE_UART_DEVICE;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isConsoleReady(void) {
|
||||
|
|
|
@ -77,6 +77,8 @@ static void sayHello(void) {
|
|||
printMsg(&logger, "STM32_ADCCLK=%d", STM32_ADCCLK);
|
||||
printMsg(&logger, "STM32_TIMCLK1=%d", STM32_TIMCLK1);
|
||||
printMsg(&logger, "STM32_TIMCLK2=%d", STM32_TIMCLK2);
|
||||
#endif
|
||||
#ifdef STM32_PCLK1
|
||||
printMsg(&logger, "STM32_PCLK1=%d", STM32_PCLK1);
|
||||
printMsg(&logger, "STM32_PCLK2=%d", STM32_PCLK2);
|
||||
#endif
|
||||
|
@ -106,8 +108,12 @@ static void sayHello(void) {
|
|||
printMsg(&logger, "EFI_SIGNAL_EXECUTOR_HW_TIMER=%d", EFI_SIGNAL_EXECUTOR_HW_TIMER);
|
||||
#endif
|
||||
|
||||
#ifdef EFI_SHAFT_POSITION_INPUT
|
||||
printMsg(&logger, "EFI_SHAFT_POSITION_INPUT=%d", EFI_SHAFT_POSITION_INPUT);
|
||||
#endif
|
||||
#ifdef EFI_INTERNAL_ADC
|
||||
printMsg(&logger, "EFI_INTERNAL_ADC=%d", EFI_INTERNAL_ADC);
|
||||
#endif
|
||||
|
||||
// printSimpleMsg(&logger, "", );
|
||||
// printSimpleMsg(&logger, "", );
|
||||
|
|
|
@ -231,8 +231,10 @@ static void printInfo(Engine *engine, systime_t nowSeconds) {
|
|||
#if EFI_PROD_CODE
|
||||
printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]);
|
||||
printOutPin(WC_CRANK2, boardConfiguration->triggerInputPins[1]);
|
||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||
printOutPin(WA_CHANNEL_1, boardConfiguration->logicAnalyzerPins[0]);
|
||||
printOutPin(WA_CHANNEL_2, boardConfiguration->logicAnalyzerPins[1]);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
// todo: extract method?
|
||||
|
@ -272,7 +274,7 @@ void updateDevConsoleState(Engine *engine) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
pokeAdcInputs();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -201,11 +201,15 @@ case GPIO_10:
|
|||
#include "rusefi_enums.h"
|
||||
const char *getEngine_type_e(engine_type_e value){
|
||||
switch(value) {
|
||||
case DEFAULT_ENGINE:
|
||||
return "DEFAULT_ENGINE";
|
||||
case SATURN_ION_2004:
|
||||
return "SATURN_ION_2004";
|
||||
case CITROEN_TU3JP:
|
||||
return "CITROEN_TU3JP";
|
||||
case FORD_FIESTA:
|
||||
#if EFI_SUPPORT_FORD_FIESTA
|
||||
case FORD_FIESTA:
|
||||
#endif
|
||||
return "FORD_FIESTA";
|
||||
case ET_UNUSED:
|
||||
return "ET_UNUSED";
|
||||
|
@ -213,8 +217,10 @@ case SUBARU_2003_WRX:
|
|||
return "SUBARU_2003_WRX";
|
||||
case HONDA_ACCORD_CD_DIP:
|
||||
return "HONDA_ACCORD_CD_DIP";
|
||||
#if EFI_SUPPORT_NISSAN_PRIMERA
|
||||
case NISSAN_PRIMERA:
|
||||
return "NISSAN_PRIMERA";
|
||||
#endif
|
||||
case FORD_ESCORT_GT:
|
||||
return "FORD_ESCORT_GT";
|
||||
case MAZDA_323:
|
||||
|
@ -227,12 +233,16 @@ case DODGE_NEON_2003:
|
|||
return "DODGE_NEON_2003";
|
||||
case HONDA_ACCORD_CD:
|
||||
return "HONDA_ACCORD_CD";
|
||||
case DODGE_NEON_1995:
|
||||
#if EFI_SUPPORT_DODGE_NEON
|
||||
case DODGE_NEON_1995:
|
||||
#endif
|
||||
return "DODGE_NEON_1995";
|
||||
case HONDA_ACCORD_CD_TWO_WIRES:
|
||||
return "HONDA_ACCORD_CD_TWO_WIRES";
|
||||
#if EFI_SUPPORT_FORD_ASPIRE
|
||||
case FORD_ASPIRE_1996:
|
||||
return "FORD_ASPIRE_1996";
|
||||
#endif
|
||||
case MINI_COOPER_R50:
|
||||
return "MINI_COOPER_R50";
|
||||
case AUDI_AAN:
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define LOGIC_ANALYZER_CHANNEL_COUNT 4
|
||||
|
||||
typedef enum {
|
||||
DEFAULT_ENGINE = 0,
|
||||
AUDI_AAN = 1,
|
||||
#if EFI_SUPPORT_DODGE_NEON
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
|
||||
void mapAveragingCallback(adcsample_t newValue);
|
||||
void initMapAveraging(Engine *engine);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ADC_AVERAGING_H_ */
|
||||
|
|
|
@ -303,7 +303,7 @@ static void printMAPInfo(void) {
|
|||
#endif
|
||||
|
||||
static void printTPSInfo(void) {
|
||||
#if EFI_PROD_CODE
|
||||
#if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
GPIO_TypeDef* port = getAdcChannelPort(engineConfiguration->tpsAdcChannel);
|
||||
int pin = getAdcChannelPin(engineConfiguration->tpsAdcChannel);
|
||||
|
||||
|
@ -574,6 +574,7 @@ static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) {
|
|||
boardConfiguration->triggerSimulatorPins[index] = pin;
|
||||
}
|
||||
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
static void setAnalogInputPin(const char *sensorStr, const char *pinName) {
|
||||
brain_pin_e pin = parseBrainPin(pinName);
|
||||
if (pin == GPIO_INVALID) {
|
||||
|
@ -599,6 +600,7 @@ static void setAnalogInputPin(const char *sensorStr, const char *pinName) {
|
|||
scheduleMsg(&logger, "setting TPS to %s/%d", pinName, channel);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void setLogicInputPin(const char *indexStr, const char *pinName) {
|
||||
int index = atoi(indexStr);
|
||||
|
@ -847,7 +849,9 @@ void initSettings(engine_configuration_s *engineConfiguration) {
|
|||
addConsoleActionS("set_idle_pin", setIdlePin);
|
||||
|
||||
addConsoleAction("mapinfo", printMAPInfo);
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
addConsoleActionSS("set_analog_input_pin", setAnalogInputPin);
|
||||
#endif
|
||||
addConsoleActionSS("set_logic_input_pin", setLogicInputPin);
|
||||
addConsoleActionI("set_pot_spi", setPotSpi);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
|
|
@ -267,5 +267,10 @@ void scheduleByAngle(int rpm, scheduling_s *timer, float angle, schfunc_t callba
|
|||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
RpmCalculator::RpmCalculator() {
|
||||
|
||||
}
|
||||
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@ static void emulatorApplyPinState(PwmConfig *state, int stateIndex) {
|
|||
helper.handleEmulatorCallback(state, stateIndex);
|
||||
}
|
||||
}
|
||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||
|
||||
static void setEmulatorAtIndex(int index, Engine *engine) {
|
||||
stopEmulationAtIndex = index;
|
||||
|
@ -147,5 +146,5 @@ void initTriggerEmulatorLogic(Engine *engine) {
|
|||
addConsoleActionIP("rpm", (VoidIntVoidPtr)setTriggerEmulatorRPM, engine);
|
||||
addConsoleActionIP("stop_stimulator_at_index", (VoidIntVoidPtr)setEmulatorAtIndex, engine);
|
||||
addConsoleActionP("resume_stimulator", (VoidPtr) resumeStimulator, engine);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
|
||||
#include "main.h"
|
||||
|
||||
int main_loop_started;
|
||||
|
||||
void firmwareError(const char *fmt, ...) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Blue LED blinker thread, times are in milliseconds.
|
||||
|
@ -67,4 +73,4 @@ void runRusEfi(void) {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "rpm_calculator.h"
|
||||
#include "wave_chart.h"
|
||||
|
||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
#define CHART_RESET_DELAY 1
|
||||
|
@ -257,3 +259,5 @@ void initWaveAnalyzer(void) {
|
|||
print("wave disabled\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,6 +44,8 @@ typedef unsigned int time_t;
|
|||
|
||||
#if EFI_USE_CCM && defined __GNUC__
|
||||
#define CCM_OPTIONAL __attribute__((section(".ccm")))
|
||||
#elif defined __GNUC__
|
||||
#define CCM_OPTIONAL
|
||||
#else
|
||||
#define CCM_OPTIONAL @ ".ccm"
|
||||
#endif
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#define ADC_INPUTS_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "adc_math.h"
|
||||
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
|
||||
#include "adc_math.h"
|
||||
|
||||
const char * getAdcMode(adc_channel_e hwChannel);
|
||||
int getAdcChannelPin(adc_channel_e hwChannel);
|
||||
|
@ -58,6 +58,8 @@ typedef struct {
|
|||
// todo: migrate to adcToVoltageInputDividerCoefficient
|
||||
#define adcToVoltsDivided(adc) (adcToVolts(adc) * engineConfiguration->analogInputDividerCoefficient)
|
||||
|
||||
#else
|
||||
#define getAdcValue(channel) 0
|
||||
#endif /* HAL_USE_ADC */
|
||||
|
||||
#endif /* ADC_INPUTS_H_ */
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "trigger_input.h"
|
||||
#include "eficonsole.h"
|
||||
#include "board_test.h"
|
||||
|
||||
#include "mcp3208.h"
|
||||
#include "HIP9011.h"
|
||||
#include "max31855.h"
|
||||
|
@ -43,6 +42,9 @@
|
|||
extern engine_configuration2_s * engineConfiguration2;
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
|
||||
static Mutex spiMtx;
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
static bool isSpiInitialized[5] = { false, false, false, false, false };
|
||||
|
||||
static void initSpiModule(SPIDriver *driver, ioportid_t sckPort, ioportmask_t sckPin, ioportid_t misoPort,
|
||||
|
@ -53,8 +55,6 @@ static void initSpiModule(SPIDriver *driver, ioportid_t sckPort, ioportmask_t sc
|
|||
mySetPadMode("SPI master in ", misoPort, misoPin, PAL_MODE_ALTERNATE(af));
|
||||
}
|
||||
|
||||
static Mutex spiMtx;
|
||||
|
||||
/**
|
||||
* Only one consumer can use SPI bus at a given time
|
||||
*/
|
||||
|
@ -112,6 +112,40 @@ static void initSpiModules(board_configuration_s *boardConfiguration) {
|
|||
}
|
||||
}
|
||||
|
||||
SPIDriver * getSpiDevice(spi_device_e spiDevice) {
|
||||
if (spiDevice == SPI_NONE) {
|
||||
return NULL;
|
||||
}
|
||||
#if STM32_SPI_USE_SPI1 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_1) {
|
||||
return &SPID1;
|
||||
}
|
||||
#endif
|
||||
#if STM32_SPI_USE_SPI2 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_2) {
|
||||
return &SPID2;
|
||||
}
|
||||
#endif
|
||||
#if STM32_SPI_USE_SPI3 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_3) {
|
||||
return &SPID3;
|
||||
}
|
||||
#endif
|
||||
firmwareError("Unexpected SPI device: %d", spiDevice);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) {
|
||||
spiConfig->end_cb = NULL;
|
||||
ioportid_t port = getHwPort(csPin);
|
||||
ioportmask_t pin = getHwPin(csPin);
|
||||
spiConfig->ssport = port;
|
||||
spiConfig->sspad = pin;
|
||||
mySetPadMode("chip select", port, pin, PAL_STM32_MODE_OUTPUT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAL_USE_I2C || defined(__DOXYGEN__)
|
||||
static I2CConfig i2cfg = { OPMODE_I2C, 100000, STD_DUTY_CYCLE, };
|
||||
|
||||
void initI2Cmodule(void) {
|
||||
|
@ -134,6 +168,9 @@ static void sendI2Cbyte(int addr, int data) {
|
|||
// i2cReleaseBus(&I2CD1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// this is all very lame code, just playing with EXTI for now. TODO: refactor it competely!
|
||||
static int joyTotal = 0;
|
||||
static int joyA = 0;
|
||||
|
@ -194,8 +231,8 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
readFromFlash();
|
||||
}
|
||||
#else
|
||||
engineConfiguration->engineType = FORD_ASPIRE_1996;
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType, engineConfiguration, engineConfiguration2, boardConfiguration);
|
||||
engineConfiguration->engineType = DEFAULT_ENGINE;
|
||||
resetConfigurationExt(logger, engineConfiguration->engineType, engine);
|
||||
#endif /* EFI_INTERNAL_FLASH */
|
||||
|
||||
if (hasFirmwareError()) {
|
||||
|
@ -205,7 +242,9 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin, PAL_MODE_INPUT_PULLUP);
|
||||
bool isBoardTestMode_b = GET_BOARD_TEST_MODE_VALUE();
|
||||
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
initAdcInputs(isBoardTestMode_b);
|
||||
#endif
|
||||
|
||||
if (isBoardTestMode_b) {
|
||||
// this method never returns
|
||||
|
@ -238,7 +277,9 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
initShaftPositionInputCapture();
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
initSpiModules(boardConfiguration);
|
||||
#endif
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
initMmcCard();
|
||||
|
@ -266,7 +307,9 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
#if HAL_USE_I2C || defined(__DOXYGEN__)
|
||||
addConsoleActionII("i2c", sendI2Cbyte);
|
||||
#endif
|
||||
|
||||
// while (true) {
|
||||
// for (int addr = 0x20; addr < 0x28; addr++) {
|
||||
|
@ -282,37 +325,8 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
printMsg(logger, "initHardware() OK!");
|
||||
}
|
||||
|
||||
SPIDriver * getSpiDevice(spi_device_e spiDevice) {
|
||||
if (spiDevice == SPI_NONE) {
|
||||
return NULL;
|
||||
}
|
||||
#if STM32_SPI_USE_SPI1 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_1) {
|
||||
return &SPID1;
|
||||
}
|
||||
#endif
|
||||
#if STM32_SPI_USE_SPI2 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_2) {
|
||||
return &SPID2;
|
||||
}
|
||||
#endif
|
||||
#if STM32_SPI_USE_SPI3 || defined(__DOXYGEN__)
|
||||
if (spiDevice == SPI_DEVICE_3) {
|
||||
return &SPID3;
|
||||
}
|
||||
#endif
|
||||
firmwareError("Unexpected SPI device: %d", spiDevice);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) {
|
||||
spiConfig->end_cb = NULL;
|
||||
ioportid_t port = getHwPort(csPin);
|
||||
ioportmask_t pin = getHwPin(csPin);
|
||||
spiConfig->ssport = port;
|
||||
spiConfig->sspad = pin;
|
||||
mySetPadMode("chip select", port, pin, PAL_STM32_MODE_OUTPUT);
|
||||
}
|
||||
#if HAL_USE_EXT || defined(__DOXYGEN__)
|
||||
|
||||
// {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1},
|
||||
|
||||
|
@ -365,3 +379,5 @@ void initExt(void) {
|
|||
mySetPadMode("joy A", GPIOD, 11, PAL_MODE_INPUT_PULLUP);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "main.h"
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
|
||||
// Peripherial Clock 42MHz SPI2 SPI3
|
||||
// Peripherial Clock 84MHz SPI1 SPI1 SPI2/3
|
||||
// 42 MHz 21 MHZ
|
||||
|
@ -45,6 +47,8 @@ void unlockSpi(void);
|
|||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* HAL_USE_SPI */
|
||||
|
||||
#define GET_BOARD_TEST_MODE_VALUE() (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "main.h"
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if (EFI_PROD_CODE && EFI_USB_SERIAL) || defined(__DOXYGEN__)
|
||||
|
||||
#include "usbconsole.h"
|
||||
#include "usbcfg.h"
|
||||
|
@ -45,4 +45,9 @@ bool is_usb_serial_ready(void) {
|
|||
return SDU1.config->usbp->state == USB_ACTIVE;
|
||||
}
|
||||
|
||||
#else
|
||||
bool is_usb_serial_ready(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue