Merge branch 'master' of ssh://rusefici.freeddns.org:21462/home/git/rusefi

This commit is contained in:
jharvey 2020-04-26 18:03:09 -04:00
commit dfa5cd370f
290 changed files with 82203 additions and 15999 deletions

28
.github/workflows/build-bootloader.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Bootloader CI
on: [push,pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
# Build machines don't have arm-none-eabi gcc, so let's download it and put it on the path
- name: Download & Install GCC
run: | # Compiler hosted on our other git repo - avoids having to download from the nice folks at ARM every time
wget 'https://github.com/rusefi/build_support/raw/master/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.xz' -O compiler.tar.xz
tar -xvf compiler.tar.xz
echo "::add-path::`pwd`/gcc-arm-none-eabi-9-2019-q4-major/bin"
# Make sure the compiler we just downloaded works - just print out the version
- name: Test Compiler
run: arm-none-eabi-gcc -v
# Build the bootloader!
- name: Build Bootloader
working-directory: ./firmware/bootloader/
run: make -j4 -f src/Makefile EXTRA_PARAMS="-DEFI_BOOTLOADER -DSTM32F405xx -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DBOARD_TLE8888_COUNT=0 -DBOARD_TLE6240_COUNT=0 -DBOARD_MC33972_COUNT=0"

View File

@ -22,8 +22,11 @@ include rusefi.mk
# for 'release' options see 'clean_compile_two_versions.bat' file
ifeq ($(DEBUG_LEVEL_OPT),)
# this value would be used by default. For 'release' configuration override with '-O2' or something along these lines
DEBUG_LEVEL_OPT = -O0 -ggdb -g3
# Default to a release build - but leave in debug info. It doesn't change the hex/bin output.
DEBUG_LEVEL_OPT = -O2 -ggdb -g3
# Comment the above and uncomment the line below if you want to debug the firmware (it's difficult-to-impossible
# to debug firmware with optimization enabled).
# DEBUG_LEVEL_OPT = -O0 -ggdb -g3
endif
@ -150,6 +153,8 @@ ifeq ($(USE_FATFS),yes)
include $(PROJECT_DIR)/ext/fatfs.mk
endif
BOARDS_DIR = $(PROJECT_DIR)/config/boards
include $(PROJECT_DIR)/config/boards/$(PROJECT_BOARD)/board.mk
include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/console/console.mk
@ -288,11 +293,11 @@ INCDIR = $(CHIBIOS)/os/license \
$(PROJECT_DIR)/console/fl_binary \
$(PROJECT_DIR)/hw_layer \
$(PROJECT_DIR)/mass_storage \
hw_layer/serial_over_usb \
hw_layer/algo \
hw_layer/lcd \
$(PROJECT_DIR)/hw_layer/serial_over_usb \
$(PROJECT_DIR)/hw_layer/algo \
$(PROJECT_DIR)/hw_layer/lcd \
$(PROJECT_DIR)/hw_layer/mass_storage \
$(HW_SENSORS_INC) \
hw_layer/mass_storage \
$(HW_INC) \
$(HW_LAYER_DRIVERS_INC) \
$(UTIL_INC) \

View File

@ -244,6 +244,8 @@ INCDIR = .. $(CHIBIOS)/os/license \
$(PROJECT_DIR)/hw_layer/lcd \
$(PROJECT_DIR)/hw_layer/sensors \
$(PROJECT_DIR)/hw_layer/mass_storage \
$(PROJECT_DIR)/hw_layer/ports \
$(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER) \
$(HW_INC) \
$(HW_LAYER_DRIVERS_INC) \
$(PROJECT_DIR)/development \

View File

@ -1,4 +1,4 @@
@echo off
echo clean_env_variables.bat: Cleaning up so that no one inherits any of these values
set DEBUG_LEVEL_OPT=
set EXTRA_PARAMS=

View File

@ -609,6 +609,8 @@ case BMW_M73_M:
return "BMW_M73_M";
case BMW_M73_PROTEUS:
return "BMW_M73_P";
case BMW_M73_MRE:
return "BMW_M73_MRE";
case MIATA_1996:
return "MIATA_1996";
case MIATA_NA6_MAP:
@ -661,6 +663,8 @@ case TOYOTA_JZS147:
return "TOYOTA_JZS147";
case VAG_18_TURBO:
return "VAG_18_TURBO";
case TEST_33816:
return "TEST_33816";
case VW_B6:
return "VW_B6";
case VW_ABA:

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Tue Feb 04 00:55:30 EST 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Fri Mar 20 19:55:09 EDT 2020
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -487,7 +487,7 @@ struct idle_hardware_s {
/**
* offset 4
*/
brain_pin_e solenoidPin;
output_pin_e solenoidPin;
/**
* offset 5
*/
@ -580,6 +580,7 @@ struct engine_configuration_s {
offset 76 bit 9 */
bool useBiQuadAnalogFiltering : 1;
/**
* Is your UA CJ125 output wired to MCU via resistor divider?
offset 76 bit 10 */
bool cj125isUaDivided : 1;
/**
@ -595,7 +596,8 @@ struct engine_configuration_s {
offset 76 bit 14 */
bool showSdCardWarning : 1;
/**
* looks like 3v range should be enough, divider not needed
* Is your UR CJ125 output wired to MCU via resistor divider?
* Looks like 3v range should be enough, divider generally not needed.
offset 76 bit 15 */
bool cj125isUrDivided : 1;
/**
@ -622,7 +624,7 @@ struct engine_configuration_s {
bool antiLagEnabled : 1;
/**
offset 76 bit 23 */
bool issue_294_24 : 1;
bool useRunningMathForCranking : 1;
/**
offset 76 bit 24 */
bool issue_294_25 : 1;
@ -818,7 +820,7 @@ struct engine_configuration_s {
*/
angle_t globalTriggerAngleOffset;
/**
* Coefficient of input voltage dividers on your PCB
* Ratio/coefficient of input voltage dividers on your PCB. For example, use '2' if your board divides 5v into 2.5v. Use '1.66' if your board divides 5v into 3v.
* offset 460
*/
float analogInputDividerCoefficient;
@ -1294,10 +1296,10 @@ struct engine_configuration_s {
bool useLcdScreen : 1;
/**
offset 744 bit 13 */
bool unusedAnotherOne : 1;
bool verboseTLE8888 : 1;
/**
offset 744 bit 14 */
bool unusedOldWarmupAfr : 1;
bool enableVerboseCanTx : 1;
/**
* +This will cause the alternator to be operated in a basic on or off mode, this is the simplest alternator control.
offset 744 bit 15 */
@ -1378,10 +1380,9 @@ struct engine_configuration_s {
*/
pin_output_mode_e hip9011IntHoldPinMode;
/**
* default or inverted input
* offset 756
*/
uint8_t logicAnalyzerMode[LOGIC_ANALYZER_CHANNEL_COUNT];
uint32_t verboseCanBaseAddress;
/**
* offset 760
*/
@ -1415,20 +1416,22 @@ struct engine_configuration_s {
/**
* offset 808
*/
brain_pin_e starterRelayPin;
output_pin_e starterRelayDisablePin;
/**
* On some vehicles we can disable starter once engine is already running
* offset 809
*/
pin_output_mode_e starterRelayPinMode;
pin_output_mode_e starterRelayDisableMode;
/**
* Some Subaru and some Mazda use double-solenoid idle air valve
* offset 810
*/
brain_pin_e secondSolenoidPin;
/**
* See also starterControlPin
* offset 811
*/
uint8_t unuseduartPadding1;
switch_input_pin_e startStopButtonPin;
/**
* offset 812
*/
@ -1445,12 +1448,12 @@ struct engine_configuration_s {
* This magic property is specific to Mazda Miata NB2
* offset 820
*/
float miataNb2VVTRatioFrom;
float unusedmiataNb2VVTRatioFrom;
/**
* This magic property is specific to Mazda Miata NB2
* offset 824
*/
float miataNb2VVTRatioTo;
float unusedmiataNb2VVTRatioTo;
/**
* This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
* offset 828
@ -1577,7 +1580,15 @@ struct engine_configuration_s {
/**
* offset 972
*/
float unused;
uint16_t multisparkMaxRpm;
/**
* offset 974
*/
uint8_t multisparkMaxSparkingAngle;
/**
* offset 975
*/
uint8_t multisparkMaxExtraSparkCount;
/**
offset 976 bit 0 */
bool todoClutchUpPinInverted : 1;
@ -1586,94 +1597,94 @@ struct engine_configuration_s {
bool todoClutchDownPinInverted : 1;
/**
offset 976 bit 2 */
bool unusedBit_250_2 : 1;
bool useHbridges : 1;
/**
offset 976 bit 3 */
bool unusedBit_250_3 : 1;
bool multisparkEnable : 1;
/**
offset 976 bit 4 */
bool unusedBit_250_4 : 1;
bool unusedBit_251_4 : 1;
/**
offset 976 bit 5 */
bool unusedBit_250_5 : 1;
bool unusedBit_251_5 : 1;
/**
offset 976 bit 6 */
bool unusedBit_250_6 : 1;
bool unusedBit_251_6 : 1;
/**
offset 976 bit 7 */
bool unusedBit_250_7 : 1;
bool unusedBit_251_7 : 1;
/**
offset 976 bit 8 */
bool unusedBit_250_8 : 1;
bool unusedBit_251_8 : 1;
/**
offset 976 bit 9 */
bool unusedBit_250_9 : 1;
bool unusedBit_251_9 : 1;
/**
offset 976 bit 10 */
bool unusedBit_250_10 : 1;
bool unusedBit_251_10 : 1;
/**
offset 976 bit 11 */
bool unusedBit_250_11 : 1;
bool unusedBit_251_11 : 1;
/**
offset 976 bit 12 */
bool unusedBit_250_12 : 1;
bool unusedBit_251_12 : 1;
/**
offset 976 bit 13 */
bool unusedBit_250_13 : 1;
bool unusedBit_251_13 : 1;
/**
offset 976 bit 14 */
bool unusedBit_250_14 : 1;
bool unusedBit_251_14 : 1;
/**
offset 976 bit 15 */
bool unusedBit_250_15 : 1;
bool unusedBit_251_15 : 1;
/**
offset 976 bit 16 */
bool unusedBit_250_16 : 1;
bool unusedBit_251_16 : 1;
/**
offset 976 bit 17 */
bool unusedBit_250_17 : 1;
bool unusedBit_251_17 : 1;
/**
offset 976 bit 18 */
bool unusedBit_250_18 : 1;
bool unusedBit_251_18 : 1;
/**
offset 976 bit 19 */
bool unusedBit_250_19 : 1;
bool unusedBit_251_19 : 1;
/**
offset 976 bit 20 */
bool unusedBit_250_20 : 1;
bool unusedBit_251_20 : 1;
/**
offset 976 bit 21 */
bool unusedBit_250_21 : 1;
bool unusedBit_251_21 : 1;
/**
offset 976 bit 22 */
bool unusedBit_250_22 : 1;
bool unusedBit_251_22 : 1;
/**
offset 976 bit 23 */
bool unusedBit_250_23 : 1;
bool unusedBit_251_23 : 1;
/**
offset 976 bit 24 */
bool unusedBit_250_24 : 1;
bool unusedBit_251_24 : 1;
/**
offset 976 bit 25 */
bool unusedBit_250_25 : 1;
bool unusedBit_251_25 : 1;
/**
offset 976 bit 26 */
bool unusedBit_250_26 : 1;
bool unusedBit_251_26 : 1;
/**
offset 976 bit 27 */
bool unusedBit_250_27 : 1;
bool unusedBit_251_27 : 1;
/**
offset 976 bit 28 */
bool unusedBit_250_28 : 1;
bool unusedBit_251_28 : 1;
/**
offset 976 bit 29 */
bool unusedBit_250_29 : 1;
bool unusedBit_251_29 : 1;
/**
offset 976 bit 30 */
bool unusedBit_250_30 : 1;
bool unusedBit_280_30 : 1;
/**
offset 976 bit 31 */
bool unusedBit_250_31 : 1;
bool unusedBit_280_31 : 1;
/**
* offset 980
*/
@ -2136,9 +2147,18 @@ struct engine_configuration_s {
*/
int16_t tps2Max;
/**
* See also startStopButton
* offset 1772
*/
uint8_t unusedFormerWarmupAfrPid[3];
output_pin_e starterControlPin;
/**
* offset 1773
*/
pin_input_mode_e startStopButtonMode;
/**
* offset 1774
*/
uint8_t unusedFormerWarmupAfrPid;
/**
* offset 1775
*/
@ -2156,7 +2176,11 @@ struct engine_configuration_s {
/**
* offset 1784
*/
uint8_t unusedSomething[4];
uint16_t multisparkSparkDuration;
/**
* offset 1786
*/
uint16_t multisparkDwell;
/**
* See cltIdleRpmBins
* offset 1788
@ -2400,7 +2424,7 @@ struct engine_configuration_s {
* This implementation makes a pulse every time one of the coils is charged, using coil dwell for pulse width. See also tachOutputPin
* offset 2226
*/
brain_pin_e dizzySparkOutputPin;
output_pin_e dizzySparkOutputPin;
/**
* offset 2227
*/
@ -2551,6 +2575,7 @@ struct engine_configuration_s {
*/
pin_mode_e spi1SckMode;
/**
* Modes count be used for 3v<>5v integration using pull-ups/pull-downs etc.
* offset 2597
*/
pin_mode_e spi1MosiMode;
@ -3217,4 +3242,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Tue Feb 04 00:55:30 EST 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Fri Mar 20 19:55:09 EDT 2020

View File

@ -535,6 +535,8 @@
#define enableAemXSeries_offset_hex 2e8
#define enabledStep1Limiter_offset 744
#define enabledStep1Limiter_offset_hex 2e8
#define enableVerboseCanTx_offset 744
#define enableVerboseCanTx_offset_hex 2e8
#define engine_load_mode_e_enum "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY", "MAF Air Charge"
#define ENGINE_NOISE_CURVE_SIZE 8
#define engineChartSize_offset 1480
@ -1359,8 +1361,6 @@
#define isMapAveragingEnabled_offset_hex 5c4
#define isSdCardEnabled_offset 744
#define isSdCardEnabled_offset_hex 2e8
#define issue_294_24_offset 76
#define issue_294_24_offset_hex 4c
#define issue_294_25_offset 76
#define issue_294_25_offset_hex 4c
#define issue_294_26_offset 76
@ -1463,8 +1463,6 @@
#define logFormat_offset 496
#define logFormat_offset_hex 1f0
#define LOGIC_ANALYZER_CHANNEL_COUNT 4
#define logicAnalyzerMode_offset 756
#define logicAnalyzerMode_offset_hex 2f4
#define logicAnalyzerPins1_offset 748
#define logicAnalyzerPins1_offset_hex 2ec
#define logicAnalyzerPins2_offset 749
@ -1577,10 +1575,6 @@
#define mc33972spiDevice_offset_hex fa8
#define measureMapOnlyInOneCylinder_offset 744
#define measureMapOnlyInOneCylinder_offset_hex 2e8
#define miataNb2VVTRatioFrom_offset 820
#define miataNb2VVTRatioFrom_offset_hex 334
#define miataNb2VVTRatioTo_offset 824
#define miataNb2VVTRatioTo_offset_hex 338
#define MOCK_AFR_COMMAND "mock_afr_voltage"
#define MOCK_CLT_COMMAND "mock_clt_voltage"
#define MOCK_IAT_COMMAND "mock_iat_voltage"
@ -1589,6 +1583,18 @@
#define MOCK_PPS_POSITION_COMMAND "mock_pps_position"
#define MOCK_PPS_VOLTAGE_COMMAND "mock_pps_voltage"
#define MOCK_TPS_COMMAND "mock_tps_voltage"
#define multisparkDwell_offset 1786
#define multisparkDwell_offset_hex 6fa
#define multisparkEnable_offset 976
#define multisparkEnable_offset_hex 3d0
#define multisparkMaxExtraSparkCount_offset 975
#define multisparkMaxExtraSparkCount_offset_hex 3cf
#define multisparkMaxRpm_offset 972
#define multisparkMaxRpm_offset_hex 3cc
#define multisparkMaxSparkingAngle_offset 974
#define multisparkMaxSparkingAngle_offset_hex 3ce
#define multisparkSparkDuration_offset 1784
#define multisparkSparkDuration_offset_hex 6f8
#define NARROW_BAND_WIDE_BAND_CONVERSION_SIZE 8
#define narrowToWideOxygen_offset 2296
#define narrowToWideOxygen_offset_hex 8f8
@ -1762,12 +1768,18 @@
#define spi3SckMode_offset_hex a2a
#define spi3sckPin_offset 936
#define spi3sckPin_offset_hex 3a8
#define starterRelayPin_offset 808
#define starterRelayPin_offset_hex 328
#define starterRelayPinMode_offset 809
#define starterRelayPinMode_offset_hex 329
#define starterControlPin_offset 1772
#define starterControlPin_offset_hex 6ec
#define starterRelayDisableMode_offset 809
#define starterRelayDisableMode_offset_hex 329
#define starterRelayDisablePin_offset 808
#define starterRelayDisablePin_offset_hex 328
#define startOfCrankingPrimingPulse_offset 2032
#define startOfCrankingPrimingPulse_offset_hex 7f0
#define startStopButtonMode_offset 1773
#define startStopButtonMode_offset_hex 6ed
#define startStopButtonPin_offset 811
#define startStopButtonPin_offset_hex 32b
#define startUpFuelPumpDuration_offset 1892
#define startUpFuelPumpDuration_offset_hex 764
#define stepperDirectionPinMode_offset 3102
@ -2028,8 +2040,9 @@
#define triggerSimulatorPins2_offset_hex 2e1
#define triggerSimulatorPins3_offset 738
#define triggerSimulatorPins3_offset_hex 2e2
#define TS_FILE_VERSION 20191221
#define TS_OUTPUT_SIZE 220
#define TS_FILE_VERSION 20200310
#define TS_OUTPUT_SIZE 240
#define ts_show_analog_divider true
#define ts_show_cj125 true
#define ts_show_egt true
#define ts_show_etb true
@ -2039,7 +2052,8 @@
#define ts_show_hip9011 true
#define ts_show_joystick true
#define ts_show_lcd true
#define TS_SIGNATURE "rusEFI v1.08"
#define ts_show_spi true
#define TS_SIGNATURE "rusEFI v1.2020.3"
#define tunerStudioSerialSpeed_offset 728
#define tunerStudioSerialSpeed_offset_hex 2d8
#define twoWireBatchIgnition_offset 1476
@ -2072,86 +2086,78 @@
#define unused_1484_bit_31_offset_hex 5c4
#define unused_former_warmup_target_afr_offset 2096
#define unused_former_warmup_target_afr_offset_hex 830
#define unused_offset 972
#define unused_offset_hex 3cc
#define unusedAnotherOne_offset 744
#define unusedAnotherOne_offset_hex 2e8
#define unusedAtOldBoardConfigurationEnd_offset 1052
#define unusedAtOldBoardConfigurationEnd_offset_hex 41c
#define unusedBit4_1476_offset 1476
#define unusedBit4_1476_offset_hex 5c4
#define unusedBit_250_10_offset 976
#define unusedBit_250_10_offset_hex 3d0
#define unusedBit_250_11_offset 976
#define unusedBit_250_11_offset_hex 3d0
#define unusedBit_250_12_offset 976
#define unusedBit_250_12_offset_hex 3d0
#define unusedBit_250_13_offset 976
#define unusedBit_250_13_offset_hex 3d0
#define unusedBit_250_14_offset 976
#define unusedBit_250_14_offset_hex 3d0
#define unusedBit_250_15_offset 976
#define unusedBit_250_15_offset_hex 3d0
#define unusedBit_250_16_offset 976
#define unusedBit_250_16_offset_hex 3d0
#define unusedBit_250_17_offset 976
#define unusedBit_250_17_offset_hex 3d0
#define unusedBit_250_18_offset 976
#define unusedBit_250_18_offset_hex 3d0
#define unusedBit_250_19_offset 976
#define unusedBit_250_19_offset_hex 3d0
#define unusedBit_250_20_offset 976
#define unusedBit_250_20_offset_hex 3d0
#define unusedBit_250_21_offset 976
#define unusedBit_250_21_offset_hex 3d0
#define unusedBit_250_22_offset 976
#define unusedBit_250_22_offset_hex 3d0
#define unusedBit_250_23_offset 976
#define unusedBit_250_23_offset_hex 3d0
#define unusedBit_250_24_offset 976
#define unusedBit_250_24_offset_hex 3d0
#define unusedBit_250_25_offset 976
#define unusedBit_250_25_offset_hex 3d0
#define unusedBit_250_26_offset 976
#define unusedBit_250_26_offset_hex 3d0
#define unusedBit_250_27_offset 976
#define unusedBit_250_27_offset_hex 3d0
#define unusedBit_250_28_offset 976
#define unusedBit_250_28_offset_hex 3d0
#define unusedBit_250_29_offset 976
#define unusedBit_250_29_offset_hex 3d0
#define unusedBit_250_2_offset 976
#define unusedBit_250_2_offset_hex 3d0
#define unusedBit_250_30_offset 976
#define unusedBit_250_30_offset_hex 3d0
#define unusedBit_250_31_offset 976
#define unusedBit_250_31_offset_hex 3d0
#define unusedBit_250_3_offset 976
#define unusedBit_250_3_offset_hex 3d0
#define unusedBit_250_4_offset 976
#define unusedBit_250_4_offset_hex 3d0
#define unusedBit_250_5_offset 976
#define unusedBit_250_5_offset_hex 3d0
#define unusedBit_250_6_offset 976
#define unusedBit_250_6_offset_hex 3d0
#define unusedBit_250_7_offset 976
#define unusedBit_250_7_offset_hex 3d0
#define unusedBit_250_8_offset 976
#define unusedBit_250_8_offset_hex 3d0
#define unusedBit_250_9_offset 976
#define unusedBit_250_9_offset_hex 3d0
#define unusedBit_251_10_offset 976
#define unusedBit_251_10_offset_hex 3d0
#define unusedBit_251_11_offset 976
#define unusedBit_251_11_offset_hex 3d0
#define unusedBit_251_12_offset 976
#define unusedBit_251_12_offset_hex 3d0
#define unusedBit_251_13_offset 976
#define unusedBit_251_13_offset_hex 3d0
#define unusedBit_251_14_offset 976
#define unusedBit_251_14_offset_hex 3d0
#define unusedBit_251_15_offset 976
#define unusedBit_251_15_offset_hex 3d0
#define unusedBit_251_16_offset 976
#define unusedBit_251_16_offset_hex 3d0
#define unusedBit_251_17_offset 976
#define unusedBit_251_17_offset_hex 3d0
#define unusedBit_251_18_offset 976
#define unusedBit_251_18_offset_hex 3d0
#define unusedBit_251_19_offset 976
#define unusedBit_251_19_offset_hex 3d0
#define unusedBit_251_20_offset 976
#define unusedBit_251_20_offset_hex 3d0
#define unusedBit_251_21_offset 976
#define unusedBit_251_21_offset_hex 3d0
#define unusedBit_251_22_offset 976
#define unusedBit_251_22_offset_hex 3d0
#define unusedBit_251_23_offset 976
#define unusedBit_251_23_offset_hex 3d0
#define unusedBit_251_24_offset 976
#define unusedBit_251_24_offset_hex 3d0
#define unusedBit_251_25_offset 976
#define unusedBit_251_25_offset_hex 3d0
#define unusedBit_251_26_offset 976
#define unusedBit_251_26_offset_hex 3d0
#define unusedBit_251_27_offset 976
#define unusedBit_251_27_offset_hex 3d0
#define unusedBit_251_28_offset 976
#define unusedBit_251_28_offset_hex 3d0
#define unusedBit_251_29_offset 976
#define unusedBit_251_29_offset_hex 3d0
#define unusedBit_251_4_offset 976
#define unusedBit_251_4_offset_hex 3d0
#define unusedBit_251_5_offset 976
#define unusedBit_251_5_offset_hex 3d0
#define unusedBit_251_6_offset 976
#define unusedBit_251_6_offset_hex 3d0
#define unusedBit_251_7_offset 976
#define unusedBit_251_7_offset_hex 3d0
#define unusedBit_251_8_offset 976
#define unusedBit_251_8_offset_hex 3d0
#define unusedBit_251_9_offset 976
#define unusedBit_251_9_offset_hex 3d0
#define unusedBit_280_30_offset 976
#define unusedBit_280_30_offset_hex 3d0
#define unusedBit_280_31_offset 976
#define unusedBit_280_31_offset_hex 3d0
#define unusedBit_34_31_offset 76
#define unusedBit_34_31_offset_hex 4c
#define unusedErrorPin_offset 2040
#define unusedErrorPin_offset_hex 7f8
#define unusedFlexFuelSensor_offset 3100
#define unusedFlexFuelSensor_offset_hex c1c
#define unusedFormerWarmupAfrPid_offset 1772
#define unusedFormerWarmupAfrPid_offset_hex 6ec
#define unusedOldWarmupAfr_offset 744
#define unusedOldWarmupAfr_offset_hex 2e8
#define unusedSomething_offset 1784
#define unusedSomething_offset_hex 6f8
#define unusedFormerWarmupAfrPid_offset 1774
#define unusedFormerWarmupAfrPid_offset_hex 6ee
#define unusedmiataNb2VVTRatioFrom_offset 820
#define unusedmiataNb2VVTRatioFrom_offset_hex 334
#define unusedmiataNb2VVTRatioTo_offset 824
#define unusedmiataNb2VVTRatioTo_offset_hex 338
#define unusedSpiPadding4_offset 2593
#define unusedSpiPadding4_offset_hex a21
#define unusedSpiPadding5_offset 2713
@ -2160,8 +2166,6 @@
#define unusedSpiPadding7_offset_hex fa5
#define unusedSpiPadding8_offset 4009
#define unusedSpiPadding8_offset_hex fa9
#define unuseduartPadding1_offset 811
#define unuseduartPadding1_offset_hex 32b
#define unusuedsw_offset 4020
#define unusuedsw_offset_hex fb4
#define unusuedvref_offset 4016
@ -2200,6 +2204,8 @@
#define useFSIO8ForServo1_offset_hex 5b8
#define useFSIO9ForServo2_offset 1464
#define useFSIO9ForServo2_offset_hex 5b8
#define useHbridges_offset 976
#define useHbridges_offset_hex 3d0
#define useIacPidMultTable_offset 1476
#define useIacPidMultTable_offset_hex 5c4
#define useIacTableForCoasting_offset 744
@ -2218,6 +2224,8 @@
#define useNoiselessTriggerDecoder_offset_hex 2e8
#define useOnlyRisingEdgeForTrigger_offset 1476
#define useOnlyRisingEdgeForTrigger_offset_hex 5c4
#define useRunningMathForCranking_offset 76
#define useRunningMathForCranking_offset_hex 4c
#define useSeparateAdvanceForCranking_offset 1476
#define useSeparateAdvanceForCranking_offset_hex 5c4
#define useSeparateAdvanceForIdle_offset 1476
@ -2249,6 +2257,10 @@
#define vehicleSpeedSensorInputPin_offset_hex 3c8
#define veLoadBins_offset 18464
#define veLoadBins_offset_hex 4820
#define verboseCanBaseAddress_offset 756
#define verboseCanBaseAddress_offset_hex 2f4
#define verboseTLE8888_offset 744
#define verboseTLE8888_offset_hex 2e8
#define verboseTriggerSynchDetails_offset 1476
#define verboseTriggerSynchDetails_offset_hex 5c4
#define veRpmBins_offset 18528

View File

@ -117,8 +117,6 @@
*/
#define EFI_ENGINE_CONTROL TRUE
#define EFI_SPEED_DENSITY TRUE
/**
* MCP42010 digital potentiometer support. This could be useful if you are stimulating some
* stock ECU
@ -208,14 +206,9 @@
#endif
/**
* While we embed multiple PnP configurations into the same firmware binary, these marcoses give us control
* over which configurations go into the binary
* Should PnP engine configurations be included in the binary?
*/
#define EFI_SUPPORT_DODGE_NEON FALSE
#define EFI_SUPPORT_FORD_ASPIRE FALSE
#define EFI_SUPPORT_FORD_FIESTA FALSE
#define EFI_SUPPORT_NISSAN_PRIMERA FALSE
#define EFI_SUPPORT_1995_FORD_INLINE_6 FALSE
#define EFI_INCLUDE_ENGINE_PRESETS FALSE
#ifndef EFI_ENGINE_SNIFFER
#define EFI_ENGINE_SNIFFER FALSE

View File

@ -1,7 +1,5 @@
# Combine the related files for a specific platform and MCU.
BOARDS_DIR = $(PROJECT_DIR)/config/boards
# Target ECU board design
BOARDSRC_CPP = $(BOARDS_DIR)/microrusefi/board_configuration.cpp

View File

@ -59,11 +59,18 @@ static void setLedPins() {
}
static void setupVbatt() {
/*
below 0.4
// 1k high side/1.5k low side = 1.6667 ratio divider
engineConfiguration->analogInputDividerCoefficient = 2.5f / 1.5f;
*/
// 39k high side/10k low side multiplied by above analogInputDividerCoefficient = 8.166666f
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
// 6.8k high side/10k low side = 1.6667 ratio divider
engineConfiguration->analogInputDividerCoefficient = 16.8f / 10.0f;
// set vbatt_divider 8.16
// R139=39k high side/R141=10k low side multiplied by above analogInputDividerCoefficient = 8.166666f
engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f);
engineConfiguration->vbattAdcChannel = EFI_ADC_11;
engineConfiguration->adcVcc = 3.29f;
@ -71,7 +78,7 @@ static void setupVbatt() {
static void setupTle8888() {
// Enable spi3
engineConfiguration->is_enabled_spi_3 = true;
CONFIG(is_enabled_spi_3) = true;
// Wire up spi3
engineConfiguration->spi3mosiPin = GPIOB_5;

View File

@ -1,3 +1,8 @@
#
# microRusEfi board
# https://github.com/rusefi/rusefi_documentation/wiki/Hardware_microRusEfi_wiring
#
outputs:
# TLE8888 injector channels
GPIOE_14: "37 - Injector 1"
@ -37,21 +42,33 @@ switch_inputs:
GPIOG_1: "Clutch Switch"
analog_inputs:
# PA0
EFI_ADC_0: "18 - AN temp 1"
# PA1
EFI_ADC_1: "23 - AN temp 2"
# PA2
EFI_ADC_2: "24 - AN temp 3"
# PA3
EFI_ADC_3: "22 - AN temp 4"
# PA4
EFI_ADC_4: "28 - AN volt 10"
# PA6 pull-down R31
EFI_ADC_6: "26 - AN volt 2"
# PA7
EFI_ADC_7: "31 - AN volt 3"
# PB0
EFI_ADC_8: "36 - AN volt 8"
# PB1
EFI_ADC_9: "40 - AN volt 9"
# PC0
EFI_ADC_10: "27 - AN volt 1"
# PC1
EFI_ADC_11: "Battery Sense"
# PC2 pull-down R131
EFI_ADC_12: "19 - AN volt 4"
# PC3
# PC3 TPS pull-down R41
EFI_ADC_13: "20 - AN volt 5"
# PC4
EFI_ADC_14: "32 - AN volt 6"
# PC5
EFI_ADC_15: "30 - AN volt 7"

View File

@ -6,3 +6,5 @@
#define ts_show_egt false
#define ts_show_gps false
#define ts_show_etb_pins false
#define ts_show_analog_divider false
#define ts_show_spi false

View File

@ -41,6 +41,9 @@
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12
// Ignore USB VBUS pin (we're never a host, only a device)
#define BOARD_OTG_NOVBUSSENS TRUE
/*
* Ethernet PHY type.
*/

View File

@ -41,6 +41,9 @@
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12
// Ignore USB VBUS pin (we're never a host, only a device)
#define BOARD_OTG_NOVBUSSENS TRUE
/*
* Ethernet PHY type.
*/

View File

@ -224,7 +224,7 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->is_enabled_spi_2 = false;
engineConfiguration->is_enabled_spi_3 = true;
CONFIG(is_enabled_spi_3) = true;
engineConfiguration->spi1mosiPin = GPIOB_5;
engineConfiguration->spi1MosiMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL

View File

@ -1,4 +1,5 @@
# TODO if anyone would be interested
# https://github.com/andreika-git/prometheus/raw/master/hardware/prometheus-wiring-diagram.pdf
outputs:
GPIOB_7: "Injector 3Z"

View File

@ -1,2 +1,4 @@
! https://github.com/andreika-git/prometheus/raw/master/hardware/prometheus-wiring-diagram.pdf
#define ts_show_hip9011 false
#define ts_show_etb false

View File

@ -0,0 +1,8 @@
cd ../../..
set PROJECT_BOARD=proteus
set PROJECT_CPU=ARCH_STM32F4
call config/boards/common_make.bat

View File

@ -42,7 +42,9 @@ adcsample_t vbattSampleProteus = 0;
void proteusAdcHack()
{
adcConvert(&ADCD3, &adcConvGroup, samples, 8);
#if defined(STM32F7XX)
SCB_InvalidateDCache_by_Addr(reinterpret_cast<uint32_t*>(samples), sizeof(samples));
#endif /* STM32F7XX */
uint32_t sum = 0;

View File

@ -3,10 +3,24 @@ BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDSRC_CPP = $(PROJECT_DIR)/config/boards/proteus/board_configuration.cpp \
$(PROJECT_DIR)/config/boards/proteus/adc_hack.cpp
# Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/nucleo_f767 $(PROJECT_DIR)/config/stm32f7ems
# Target processor details
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
MCU_DEFS = -DSTM32F407xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c
BOARDINC = $(BOARDS_DIR)/microrusefi
BOARDINC += $(PROJECT_DIR)/config/stm32f4ems # For board.h
BOARDINC += $(BOARDS_DIR)/st_stm32f4
LDSCRIPT= $(BOARDS_DIR)/prometheus/STM32F405xG.ld
else
MCU_DEFS = -DSTM32F767xx
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.c
BOARDINC = $(BOARDS_DIR)/nucleo_f767 # For board.h
BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h
LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld
endif
LDSCRIPT= $(PROJECT_DIR)/config/boards/nucleo_f767/STM32F76xxI.ld
# Override DEFAULT_ENGINE_TYPE
DDEFS += -DSTM32F767xx -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DUSE_ADC3_VBATT_HACK -DSTM32_ADC_USE_ADC3=TRUE
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DUSE_ADC3_VBATT_HACK -DSTM32_ADC_USE_ADC3=TRUE -DEFI_INCLUDE_ENGINE_PRESETS=FALSE

View File

@ -53,8 +53,12 @@ static void setIgnitionPins() {
engineConfiguration->ignitionPinMode = OM_DEFAULT;
}
void setSdCardConfigurationOverrides(void) {
}
static void setLedPins() {
engineConfiguration->communicationLedPin = GPIOE_4;
CONFIG(warningLedPin) = GPIOE_3;
CONFIG(communicationLedPin) = GPIOE_4;
engineConfiguration->runningLedPin = GPIOE_5;
engineConfiguration->triggerErrorPin = GPIOE_6;
}
@ -177,4 +181,11 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
// output 13
CONFIG(mainRelayPin) = GPIOB_9;
// output 15
CONFIG(fanPin) = GPIOE_1;
// output 16
CONFIG(fuelPumpPin) = GPIOE_2;
}

View File

@ -1,3 +1,8 @@
#
# proteus board
# https://github.com/mck1117/proteus/blob/master/readme_pinout.md
#
outputs:
GPIOD_7: "Lowside 1"
GPIOG_9: "Lowside 2"
@ -53,19 +58,35 @@ switch_inputs:
GPIOE_15: "Digital 6"
analog_inputs:
# PA0
EFI_ADC_0: "Analog Volt 5"
# PA1
EFI_ADC_1: "Analog Volt 6"
# PA2
EFI_ADC_2: "Analog Volt 7"
# PA3
EFI_ADC_3: "Analog Volt 8"
# PA4 - pin #17
EFI_ADC_4: "Analog Volt 9"
# PA5
EFI_ADC_5: "Analog Volt 10"
# PA6 - pin #18
EFI_ADC_6: "Analog Volt 11"
# PA7
EFI_ADC_7: "Analog Volt 12"
# CLT = Analog Temp 3 = PB0
EFI_ADC_8: "Analog Temp 3"
# PB1
EFI_ADC_9: "Analog Temp 4"
# MAP = Analog volt 1 = PC0
EFI_ADC_10: "Analog Volt 1"
# TPS = Analog volt 2 = PC1
EFI_ADC_11: "Analog Volt 2"
# PC2
EFI_ADC_12: "Analog Volt 3"
# PC3
EFI_ADC_13: "Analog Volt 4"
# PC4
EFI_ADC_14: "Analog Temp 1"
# IAT = Analog Temp 2 = PC5
EFI_ADC_15: "Analog Temp 2"

View File

@ -1 +1,8 @@
#define ts_show_hip9011 false
#define ts_show_cj125 false
#define ts_show_full_pinout false
#define ts_show_lcd false
#define ts_show_joystick false
#define ts_show_egt false
#define ts_show_gps false
#define ts_show_analog_divider false

View File

@ -1,7 +1,5 @@
# Combine the related files for a specific platform and MCU.
BOARDS_DIR = $(PROJECT_DIR)/config/boards
# Target ECU board design
BOARDSRC_CPP = $(BOARDS_DIR)/skeleton/board_configuration.cpp

View File

@ -42,7 +42,7 @@ EXTERN_ENGINE;
// This shows a SPI connected TLE8888.
static void setupTle8888() {
// Enable the SPI channel and set up the SPI pins
engineConfiguration->is_enabled_spi_3 = true;
CONFIG(is_enabled_spi_3) = true;
engineConfiguration->spi3mosiPin = GPIOB_5;
engineConfiguration->spi3misoPin = GPIOB_4;
engineConfiguration->spi3sckPin = GPIOB_3;

View File

@ -162,8 +162,6 @@
#define EFI_ENGINE_CONTROL TRUE
#define EFI_SPEED_DENSITY TRUE
#define EFI_ANALOG_SENSORS TRUE
@ -221,14 +219,10 @@
#define EFI_USB_SERIAL TRUE
// For now we can still embed all car configurations into the firmware binary.
// These give us control over which configurations go in.
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
/**
* Should PnP engine configurations be included in the binary?
*/
#define EFI_INCLUDE_ENGINE_PRESETS TRUE
#ifndef EFI_ENGINE_SNIFFER
#define EFI_ENGINE_SNIFFER TRUE

View File

@ -38,6 +38,8 @@
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12
// Ignore USB VBUS pin (we're never a host, only a device)
#define BOARD_OTG_NOVBUSSENS TRUE
/*
* input-floating is the default pin mode. input-output boards should provision appropriate pull-ups/pull-downs.

View File

@ -78,7 +78,7 @@ void setSdCardConfigurationOverrides(void) {
engineConfiguration->is_enabled_spi_1 = false;
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1;
engineConfiguration->sdCardCsPin = GPIOA_2;
engineConfiguration->isSdCardEnabled = false;
CONFIG(isSdCardEnabled) = false;
}
/**
@ -241,10 +241,6 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED;
engineConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED;
engineConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED;
engineConfiguration->logicAnalyzerMode[0] = OM_DEFAULT;
engineConfiguration->logicAnalyzerMode[1] = OM_DEFAULT;
engineConfiguration->logicAnalyzerMode[2] = OM_DEFAULT;
engineConfiguration->logicAnalyzerMode[3] = OM_DEFAULT;
//!!!!!!!!!!!!!!!!!!!
//engineConfiguration->silentTriggerError = true;

View File

@ -6,11 +6,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef GY6_139QMB_H_
#define GY6_139QMB_H_
#pragma once
#include "engine_configuration.h"
void setGy6139qmbDefaultEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* GY6_139QMB_H_ */

View File

@ -1,10 +1,12 @@
/*
* @file bmw_m73.cpp
*
*
* https://github.com/rusefi/rusefi_documentation/wiki/BMW_e38_750
*
* https://rusefi.com/wiki/index.php?title=Hardware:OEM_connectors#134_pin
* https://github.com/rusefi/rusefi_documentation/wiki/HOWTO_electronic_throttle_body
* Ignition module https://rusefi.com/forum/viewtopic.php?f=4&t=286
*
*
* 1/2 plugs black
* 2/2 plugs grey
@ -42,15 +44,15 @@
* Plug #4 40 pin
* ECU pin 6: IN start signal from ignition key
* ECU pin 17: OUT BLK engine speed output for gauge cluster
* ECU pin 26: IN GRN/BLK RED +12 hot in start & run
* ECU pin 26: IN GRN/BLK RED +12v hot in start & run
* ECU pin 40: OUT YEL/BRN BRN starter enable
*
*
* Plug #5 9 pin
* ECU pic 3: OUT BLK coil signal, low-side
* ECU pic 5: GND BRN ground
* ECU pic 6: OUT BLK coil signal, low-side
* ECU pic 9: OUT BLK RED coil signal, low-side
* ECU pin 3: OUT BLK coil signal, low-side
* ECU pin 5: GND BRN ground
* ECU pin 6: OUT BLK coil signal, low-side
* ECU pin 9: OUT BLK RED coil signal, low-side
*
* Frankenso
* set engine_type 40
@ -65,12 +67,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "engine_template.h"
#include "bmw_m73.h"
#include "custom_engine.h"
EXTERN_CONFIG;
static void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 13641435991 injector
engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info
@ -133,6 +135,7 @@ void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
// BMW_M73_M
// set engine_type 24
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
@ -175,7 +178,7 @@ GPIOA_6
// For example TLE7209 - two control wires:
// PWM on both wires - one to open, another to close
// ETB motor NEG pin # - white wire - OUT 1
// green input wire
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_6;
// set_analog_input_pin tps PA3
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; // PA3
@ -185,15 +188,18 @@ GPIOA_6
// PWM pin
engineConfiguration->etbIo[0].controlPin1 = GPIO_UNASSIGNED;
// DIR pin
engineConfiguration->etbIo[0].directionPin1 = GPIOC_9;
engineConfiguration->etbIo[0].directionPin2 = GPIOC_8;
engineConfiguration->etbIo[0].directionPin1 = GPIOC_8;
engineConfiguration->etbIo[0].directionPin2 = GPIOC_9;
CONFIG(etb_use_two_wires) = true;
// PWM pin
engineConfiguration->etbIo[1].controlPin1 = GPIO_UNASSIGNED;
// DIR pin
engineConfiguration->etbIo[1].directionPin1 = GPIOB_8;
engineConfiguration->etbIo[1].directionPin2 = GPIOB_9;
engineConfiguration->etbIo[1].directionPin1 = GPIOB_9;
engineConfiguration->etbIo[1].directionPin2 = GPIOB_8;
CONFIG(tps2Min) = CONFIG(tpsMin);
CONFIG(tps2Max) = CONFIG(tpsMax);
engineConfiguration->injectionPins[0] = GPIO_UNASSIGNED;
@ -213,6 +219,58 @@ GPIOA_6
}
/**
* set engine_type 63
*
* https://github.com/mck1117/proteus/blob/master/readme_pinout.md
*
* black#3 : orange : injector #1
* black#4 : blue : injector #3
* black#5 : white : injector #5
* black#6 : green : injector #6
* black#7 : orange : injector #7
* black#8 : blue : injector #9
* black#9 : white : injector #11
* black#15: blue : injector #2
* black#16: white : injector #4
* black#19: green : injector #8
* black#20: : injector #10
* black#21: : injector #12
*
*
* small#5 : : VR1 pos
* small#8 : blue : ETB1-
* small#13: blue : VR1 neg
* small#15: orange : ETB1+
* small#18: red : ignition power / ECU power source
* small#19: black : GND
* small#21: blue : ETB2-
* small#22: orange : ETB2+
* small#23: red : ETB/high-side power from main relay
*
*
*
* white#9 : orange : +5v
* white#17: green : PPS
* white#18: red
* white#23: black : Sensor Ground
* white#24: red : TPS#1
*
*/
void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
// 12 injectors defined in boards/proteus/board_configuration.cpp
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_4;
// set vbatt_divider 8.16
// engineConfiguration->vbattDividerCoeff = (49.0f / 10.0f) * 16.8f / 10.0f;
// todo: figure out exact values from TLE8888 breakout board used by Manhattan
engineConfiguration->vbattDividerCoeff = 7.6;
// TPS#2 = Analog volt
// engineConfiguration->tps2_1AdcChannel = EFI_ADC_;
}

View File

@ -1,5 +1,5 @@
/*
* @file engine_template.h
* @file bmw_m73.h
*
* @date Nov 1, 2019
* @author Andrey Belomutskiy, (c) 2012-2020
@ -9,6 +9,10 @@
#include "engine_configuration.h"
void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_Manhattan(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_Proteus(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -0,0 +1,100 @@
/*
* @file bmw_m73_mre.cpp
*
* https://github.com/rusefi/rusefi_documentation/wiki/BMW_e38_750
*
* https://rusefi.com/wiki/index.php?title=Hardware:OEM_connectors#134_pin
* https://github.com/rusefi/rusefi_documentation/wiki/HOWTO_electronic_throttle_body
* Ignition module https://rusefi.com/forum/viewtopic.php?f=4&t=286
* https://github.com/rusefi/rusefi_documentation/wiki/Hardware_microRusEfi_wiring
*
* 1/2 plugs black
* 2/2 plugs grey
*
*
* ********* | | OEM | rusEfi | function
*
* Plug #1 9 pin
* ECU pin 4: GND BRN/ORG BLK
* ECU pin 6: GND BRN BLK
* ECU pin 7: IN RED RED +12v hot at all times
* ECU pin 8: IN RED/BLU RED +12v from ECU relay
*
* Plug #2 24 pin
* ECU pin 23: OUT BRN/BLK BLK ECU relay control, low-side
*
*
*
*
* Plug #3 52 pin
* ECU pin 2: OUT ORG injector #4
* ECU pin 6: GND ECU
* ECU pin 15: OUT ORG injector #2
* ECU pin 27: OUT GRN injector #6
* ECU pin 28: OUT BLU injector #5
* ECU pin 32: IN WHT VR positive crankshaft sensor
* ECU pin 40: OUT BRN/BLK GRN injector #3
* ECU pin 41: OUT BRN/WHT BLU injector #1
* ECU pin 46: IN BLK BLU VR negative crankshaft sensor
*
* Plug #4 40 pin
* ECU pin 6: IN ORG start signal from ignition key. Custom wiring: pulled-up thermistor wire on MRE
* ECU pin 26: IN GRN/BLK RED +12v hot in start & run
* ECU pin 40: OUT YEL/BRN GRN starter enable
*
*
* Plug #5 9 pin
* ECU pin 3: OUT BLK ORG coil signal
* ECU pin 5: GND BRN ground
*
* BMW_M73_MRE
* set engine_type 104
*
*/
#include "bmw_m73.h"
#include "fsio_impl.h"
EXTERN_CONFIG;
void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 13641435991 injector
engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info
engineConfiguration->specs.cylindersCount = 6;
engineConfiguration->specs.displacement = 5.4 / 2;
engineConfiguration->specs.firingOrder = FO_1_5_3_6_2_4;
engineConfiguration->ignitionMode = IM_ONE_COIL;
engineConfiguration->injectionMode = IM_BATCH;
// set_analog_input_pin pps PA7
// EFI_ADC_7: "31 - AN volt 3" - PA7
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_7;
// enable ETB
// set_rpn_expression 8 "0"
setFsio(7, GPIOC_8, "0" PASS_CONFIG_PARAMETER_SUFFIX);
CONFIG(debugMode) = DBG_ELECTRONIC_THROTTLE_PID;
engineConfiguration->etb.pFactor = 2.00;
engineConfiguration->etb.iFactor = 0.35;
// AN Temp 4, orange wire
CONFIG(startStopButtonPin) = GPIOA_3;
#if (BOARD_TLE8888_COUNT > 0)
// "43 - GP Out 4"
CONFIG(starterControlPin) = TLE8888_PIN_24;
#endif /* BOARD_TLE8888_COUNT */
//set tps_min 891
CONFIG(tpsMin) = 891;
//set tps_max 177
CONFIG(tpsMax) = 177;
}

View File

@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_CHEVROLET_C20_1973_H_
#define CONFIG_ENGINES_CHEVROLET_C20_1973_H_
#pragma once
#include "engine_configuration.h"
void set1973c20(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_CHEVROLET_C20_1973_H_ */

View File

@ -5,11 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_CHEVROLET_CAMARO_4_H_
#define CONFIG_ENGINES_CHEVROLET_CAMARO_4_H_
#pragma once
#include "engine_configuration.h"
void setCamaro4(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_CHEVROLET_CAMARO_4_H_ */

View File

@ -5,11 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CITROENBERLINGOTU3JP_H_
#define CITROENBERLINGOTU3JP_H_
#pragma once
#include "engine_configuration.h"
void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CITROENBERLINGOTU3JP_H_ */

View File

@ -190,6 +190,9 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#endif /* EFI_CAN_SUPPORT */
}
/**
* set engine_type 49
*/
void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
@ -511,3 +514,35 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->injectionPins[2 - 1] = GPIOE_10;
#endif /* BOARD_TLE8888_COUNT */
}
/**
* set engine_type 103
*/
void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// grey
// default spi3mosiPin PB5
// white
// default spi3misoPin PB4
// violet
// default spi3sckPin PB3
// blue
CONFIG(mc33816_cs) = GPIOD_7;
// green
CONFIG(mc33816_rstb) = GPIOD_5;
// yellow
CONFIG(mc33816_driven) = GPIOD_6;
// enable_spi 3
CONFIG(is_enabled_spi_3) = true;
// Wire up spi3
engineConfiguration->spi3mosiPin = GPIOB_5;
engineConfiguration->spi3misoPin = GPIOB_4;
engineConfiguration->spi3sckPin = GPIOB_3;
CONFIG(isSdCardEnabled) = false;
CONFIG(mc33816spiDevice) = SPI_DEVICE_3;
}

View File

@ -21,3 +21,4 @@ void setIssue898(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "engine_configuration.h"
void setDaihatsu(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -14,8 +14,6 @@
#include "global.h"
#if EFI_SUPPORT_DODGE_NEON
#include "dodge_neon.h"
#include "engine_configuration.h"
#include "thermistors.h"
@ -502,6 +500,3 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// end of setDodgeNeonNGCEngineConfiguration
}
#endif /* EFI_SUPPORT_DODGE_NEON */

View File

@ -6,11 +6,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef DODGE_NEON_H_
#define DODGE_NEON_H_
#if EFI_SUPPORT_DODGE_NEON
#pragma once
#include "engine_configuration.h"
void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
@ -22,6 +18,3 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
*/
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_SUPPORT_DODGE_NEON */
#endif /* DODGE_NEON_H_ */

View File

@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_DODGE_RAM_H_
#define CONFIG_ENGINES_DODGE_RAM_H_
#pragma once
#include "engine_configuration.h"
void setDodgeRam1996(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_DODGE_RAM_H_ */

View File

@ -5,11 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_DODGE_STRATUS_H_
#define CONFIG_ENGINES_DODGE_STRATUS_H_
#pragma once
#include "engine_configuration.h"
void setDodgeStratus(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_DODGE_STRATUS_H_ */

View File

@ -5,6 +5,7 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/custom_engine.cpp \
$(PROJECT_DIR)/config/engines/bmw_e34.cpp \
$(PROJECT_DIR)/config/engines/bmw_m73.cpp \
$(PROJECT_DIR)/config/engines/bmw_m73_mre.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata_base_maps.cpp \
$(PROJECT_DIR)/config/engines/mazda_miata_1_6.cpp \

View File

@ -16,8 +16,6 @@
#include "engine_math.h"
#include "allsensors.h"
#if EFI_SUPPORT_1995_FORD_INLINE_6
EXTERN_CONFIG;
/**
@ -101,5 +99,3 @@ void setFordInline6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->logicAnalyzerPins[0] = GPIOC_6;
engineConfiguration->logicAnalyzerPins[1] = GPIOE_5;
}
#endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */

View File

@ -18,8 +18,6 @@
#include "advance_map.h"
#include "engine_configuration.h"
#if EFI_SUPPORT_FORD_ASPIRE
#if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT
/**
@ -161,5 +159,3 @@ void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->engineSnifferRpmThreshold = 13000;
engineConfiguration->sensorSnifferRpmThreshold = 13000;
}
#endif /* EFI_SUPPORT_FORD_ASPIRE */

View File

@ -5,11 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_FORD_FESTIVA_H_
#define CONFIG_ENGINES_FORD_FESTIVA_H_
#pragma once
#include "engine_configuration.h"
void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_FORD_FESTIVA_H_ */

View File

@ -11,8 +11,6 @@
#include "global.h"
#if EFI_SUPPORT_FORD_FIESTA
#include "ford_fiesta.h"
#include "engine_math.h"
@ -30,5 +28,3 @@ void setFordFiestaDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
engineConfiguration->mafAdcChannel = EFI_ADC_14;
// engineConfiguration->mafAdcChannel = EFI_ADC_NONE; this would kill functional tests
}
#endif /* EFI_SUPPORT_FORD_FIESTA */

View File

@ -5,13 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef FORD_FIESTA_H_
#define FORD_FIESTA_H_
#if EFI_SUPPORT_FORD_FIESTA
#pragma once
#include "engine_configuration.h"
void setFordFiestaDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_SUPPORT_FORD_FIESTA */
#endif /* FORD_FIESTA_H_ */

View File

@ -5,11 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_HONDA_600_H_
#define CONFIG_ENGINES_HONDA_600_H_
#pragma once
#include "engine_configuration.h"
void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_HONDA_600_H_ */

View File

@ -5,9 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef HONDA_ACCORD_H_
#define HONDA_ACCORD_H_
#pragma once
#include "engine_configuration.h"
void setHondaAccordConfigurationTwoWires(DECLARE_CONFIG_PARAMETER_SIGNATURE);
@ -18,4 +16,3 @@ void setHondaAccordConfiguration1_24_shifted(DECLARE_CONFIG_PARAMETER_SIGNATURE)
void setHondaCivic4_0_both(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setHondaCivic4_0_rise(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* HONDA_ACCORD_H_ */

View File

@ -5,11 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_LADA_KALINA_H_
#define CONFIG_ENGINES_LADA_KALINA_H_
#pragma once
#include "engine_configuration.h"
void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_LADA_KALINA_H_ */

View File

@ -6,11 +6,9 @@
* @date Jan 16, 2015
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_MAZDA_626_H_
#define CONFIG_ENGINES_MAZDA_626_H_
#pragma once
#include "engine_configuration.h"
void setMazda626EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_MAZDA_626_H_ */

View File

@ -203,7 +203,7 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->isHip9011Enabled = false;
engineConfiguration->isSdCardEnabled = false;
CONFIG(isSdCardEnabled) = false;
setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE);

View File

@ -1,6 +1,8 @@
/*
* @file mazda_miata_vvt.cpp
*
* Miata NB2, also known as MX-5 Mk2.5
*
* MAZDA_MIATA_2003
* set engine_type 47
*
@ -193,12 +195,6 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setCommonNTCSensor(&engineConfiguration->clt, 2700);
setCommonNTCSensor(&engineConfiguration->iat, 2700);
// 0.0825
// 0.1375
// 6.375
// 10.625
engineConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75;
engineConfiguration->miataNb2VVTRatioTo = 14;
engineConfiguration->nbVvtIndex = 0;
engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control
@ -527,6 +523,13 @@ static void setMiataNB2_MRE_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// TLE8888_PIN_23: "33 - GP Out 3"
engineConfiguration->malfunctionIndicatorPin = TLE8888_PIN_23;
// todo: alternator warn
// ?
// todo: AC fan
// TLE8888_PIN_24: "43 - GP Out 4"
engineConfiguration->isFasterEngineSpinUpEnabled = true;
// set_analog_input_pin pps PA7

View File

@ -10,7 +10,6 @@
#include "global.h"
#if EFI_SUPPORT_NISSAN_PRIMERA
#include "nissan_primera.h"
EXTERN_CONFIG;
@ -32,5 +31,3 @@ void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setNissanPrimeraEngineConfiguration_360(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_NISSAN_SR20VE_360;
}
#endif /* EFI_SUPPORT_NISSAN_PRIMERA */

View File

@ -7,11 +7,7 @@
#pragma once
#if EFI_SUPPORT_NISSAN_PRIMERA
#include "engine_configuration.h"
void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setNissanPrimeraEngineConfiguration_360(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_SUPPORT_NISSAN_PRIMERA */

View File

@ -5,11 +5,9 @@
* @date Oct 17, 2015
*/
#ifndef CONFIG_ENGINES_SUZUKI_VITARA_H_
#define CONFIG_ENGINES_SUZUKI_VITARA_H_
#pragma once
#include "engine_configuration.h"
void setSuzukiVitara(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_SUZUKI_VITARA_H_ */

View File

@ -4,8 +4,8 @@
* @date Nov 14, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef TEST_ENGINE_H_
#define TEST_ENGINE_H_
#pragma once
#include "engine_configuration.h"
@ -15,4 +15,3 @@ void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setTestEngineIssue366both(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setTestEngineIssue366rise(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* TEST_ENGINE_H_ */

View File

@ -5,12 +5,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef CONFIG_ENGINES_TOYOTA_JZS147_H_
#define CONFIG_ENGINES_TOYOTA_JZS147_H_
#pragma once
#include "engine_configuration.h"
void setToyota_jzs147EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* CONFIG_ENGINES_TOYOTA_JZS147_H_ */

View File

@ -60,7 +60,7 @@ void setVwAba(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFuelTablesLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX);
setTimingLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX);
engineConfiguration->isSdCardEnabled = false;
CONFIG(isSdCardEnabled) = false;
engineConfiguration->tpsMin = 740;
engineConfiguration->tpsMax = 135;
}

View File

@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef ZIL130_H_
#define ZIL130_H_
#pragma once
#include "engine_configuration.h"
void setZil130(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* ZIL130_H_ */

View File

@ -1,149 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* ST32F051x8 memory setup.
*/
__main_stack_size__ = 0x0400;
__process_stack_size__ = 0x0400;
MEMORY
{
flash : org = 0x08000000, len = 64k
ram : org = 0x20000000, len = 8k
}
__ram_start__ = ORIGIN(ram);
__ram_size__ = LENGTH(ram);
__ram_end__ = __ram_start__ + __ram_size__;
ENTRY(ResetHandler)
SECTIONS
{
. = 0;
_text = .;
startup : ALIGN(16) SUBALIGN(16)
{
KEEP(*(vectors))
} > flash
constructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE(__init_array_end = .);
} > flash
destructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__fini_array_start = .);
KEEP(*(.fini_array))
KEEP(*(SORT(.fini_array.*)))
PROVIDE(__fini_array_end = .);
} > flash
.text : ALIGN(16) SUBALIGN(16)
{
*(.text.startup.*)
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
*(.glue_7t)
*(.glue_7)
*(.gcc*)
} > flash
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > flash
.ARM.exidx : {
PROVIDE(__exidx_start = .);
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
PROVIDE(__exidx_end = .);
} > flash
.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > flash
.eh_frame : ONLY_IF_RO
{
*(.eh_frame)
} > flash
.textalign : ONLY_IF_RO
{
. = ALIGN(8);
} > flash
. = ALIGN(4);
_etext = .;
_textdata = _etext;
.stacks :
{
. = ALIGN(8);
__main_stack_base__ = .;
. += __main_stack_size__;
. = ALIGN(8);
__main_stack_end__ = .;
__process_stack_base__ = .;
__main_thread_stack_base__ = .;
. += __process_stack_size__;
. = ALIGN(8);
__process_stack_end__ = .;
__main_thread_stack_end__ = .;
} > ram
.data :
{
. = ALIGN(4);
PROVIDE(_data = .);
*(.data)
. = ALIGN(4);
*(.data.*)
. = ALIGN(4);
*(.ramtext)
. = ALIGN(4);
PROVIDE(_edata = .);
} > ram AT > flash
.bss :
{
. = ALIGN(4);
PROVIDE(_bss_start = .);
*(.bss)
. = ALIGN(4);
*(.bss.*)
. = ALIGN(4);
*(COMMON)
. = ALIGN(4);
PROVIDE(_bss_end = .);
} > ram
}
PROVIDE(end = .);
_end = .;
__heap_base__ = _end;
__heap_end__ = __ram_end__;

View File

@ -1,534 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file templates/chconf.h
* @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings.
*
* @addtogroup config
* @details Kernel related settings and hooks.
* @{
*/
#ifndef _CHCONF_H_
#define _CHCONF_H_
#define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK
/*===========================================================================*/
/**
* @name Kernel parameters and options
* @{
*/
/*===========================================================================*/
/**
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__)
#define CH_FREQUENCY 1000
#endif
/**
* @brief Round robin interval.
* @details This constant is the number of system ticks allowed for the
* threads before preemption occurs. Setting this value to zero
* disables the preemption for threads with equal priority and the
* round robin becomes cooperative. Note that higher priority
* threads can still preempt, the kernel is always preemptive.
*
* @note Disabling the round robin preemption makes the kernel more compact
* and generally faster.
*/
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__)
#define CH_TIME_QUANTUM 20
#endif
/**
* @brief Managed RAM size.
* @details Size of the RAM area to be managed by the OS. If set to zero
* then the whole available RAM is used. The core memory is made
* available to the heap allocator and/or can be used directly through
* the simplified core memory allocator.
*
* @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_USE_MEMCORE.
*/
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_MEMCORE_SIZE 0
#endif
/**
* @brief Idle thread automatic spawn suppression.
* @details When this option is activated the function @p chSysInit()
* does not spawn the idle thread automatically. The application has
* then the responsibility to do one of the following:
* - Spawn a custom idle thread at priority @p IDLEPRIO.
* - Change the main() thread priority to @p IDLEPRIO then enter
* an endless loop. In this scenario the @p main() thread acts as
* the idle thread.
* .
* @note Unless an idle thread is spawned the @p main() thread must not
* enter a sleep state.
*/
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
#define CH_NO_IDLE_THREAD FALSE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Performance options
* @{
*/
/*===========================================================================*/
/**
* @brief OS optimization.
* @details If enabled then time efficient rather than space efficient code
* is used when two possible implementations exist.
*
* @note This is not related to the compiler optimization options.
* @note The default is @p TRUE.
*/
#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
#define CH_OPTIMIZE_SPEED TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Subsystem options
* @{
*/
/*===========================================================================*/
/**
* @brief Threads registry APIs.
* @details If enabled then the registry APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
#define CH_USE_REGISTRY TRUE
#endif
/**
* @brief Threads synchronization APIs.
* @details If enabled then the @p chThdWait() function is included in
* the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__)
#define CH_USE_WAITEXIT TRUE
#endif
/**
* @brief Semaphores APIs.
* @details If enabled then the Semaphores APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES TRUE
#endif
/**
* @brief Semaphores queuing mode.
* @details If enabled then the threads are enqueued on semaphores by
* priority rather than in FIFO order.
*
* @note The default is @p FALSE. Enable this if you have special requirements.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES_PRIORITY FALSE
#endif
/**
* @brief Atomic semaphore API.
* @details If enabled then the semaphores the @p chSemSignalWait() API
* is included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
#define CH_USE_SEMSW TRUE
#endif
/**
* @brief Mutexes APIs.
* @details If enabled then the mutexes APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__)
#define CH_USE_MUTEXES TRUE
#endif
/**
* @brief Conditional Variables APIs.
* @details If enabled then the conditional variables APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_MUTEXES.
*/
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS TRUE
#endif
/**
* @brief Conditional Variables APIs with timeout.
* @details If enabled then the conditional variables APIs with timeout
* specification are included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_CONDVARS.
*/
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS_TIMEOUT TRUE
#endif
/**
* @brief Events Flags APIs.
* @details If enabled then the event flags APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__)
#define CH_USE_EVENTS TRUE
#endif
/**
* @brief Events Flags APIs with timeout.
* @details If enabled then the events APIs with timeout specification
* are included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_EVENTS.
*/
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_EVENTS_TIMEOUT TRUE
#endif
/**
* @brief Synchronous Messages APIs.
* @details If enabled then the synchronous messages APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES TRUE
#endif
/**
* @brief Synchronous Messages queuing mode.
* @details If enabled then messages are served by priority rather than in
* FIFO order.
*
* @note The default is @p FALSE. Enable this if you have special requirements.
* @note Requires @p CH_USE_MESSAGES.
*/
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES_PRIORITY FALSE
#endif
/**
* @brief Mailboxes APIs.
* @details If enabled then the asynchronous messages (mailboxes) APIs are
* included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__)
#define CH_USE_MAILBOXES TRUE
#endif
/**
* @brief I/O Queues APIs.
* @details If enabled then the I/O queues APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_USE_QUEUES TRUE
#endif
/**
* @brief Core Memory Manager APIs.
* @details If enabled then the core memory manager APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__)
#define CH_USE_MEMCORE TRUE
#endif
/**
* @brief Heap Allocator APIs.
* @details If enabled then the memory heap allocator APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
* @p CH_USE_SEMAPHORES.
* @note Mutexes are recommended.
*/
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__)
#define CH_USE_HEAP FALSE
#endif
/**
* @brief C-runtime allocator.
* @details If enabled the the heap allocator APIs just wrap the C-runtime
* @p malloc() and @p free() functions.
*
* @note The default is @p FALSE.
* @note Requires @p CH_USE_HEAP.
* @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the
* appropriate documentation.
*/
#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define CH_USE_MALLOC_HEAP FALSE
#endif
/**
* @brief Memory Pools Allocator APIs.
* @details If enabled then the memory pools allocator APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__)
#define CH_USE_MEMPOOLS TRUE
#endif
/**
* @brief Dynamic Threads APIs.
* @details If enabled then the dynamic threads creation APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_WAITEXIT.
* @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS.
*/
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__)
#define CH_USE_DYNAMIC TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Debug options
* @{
*/
/*===========================================================================*/
/**
* @brief Debug option, system state check.
* @details If enabled the correct call protocol for system APIs is checked
* at runtime.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
#endif
/**
* @brief Debug option, parameters checks.
* @details If enabled then the checks on the API functions input
* parameters are activated.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_CHECKS FALSE
#endif
/**
* @brief Debug option, consistency checks.
* @details If enabled then all the assertions in the kernel code are
* activated. This includes consistency checks inside the kernel,
* runtime anomalies and port-defined checks.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
* @brief Debug option, trace buffer.
* @details If enabled then the context switch circular trace buffer is
* activated.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_TRACE FALSE
#endif
/**
* @brief Debug option, stack checks.
* @details If enabled then a runtime stack check is performed.
*
* @note The default is @p FALSE.
* @note The stack check is performed in a architecture/port dependent way.
* It may not be implemented or some ports.
* @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
* @brief Debug option, stacks initialization.
* @details If enabled then the threads working area is filled with a byte
* value when a thread is created. This can be useful for the
* runtime measurement of the used stack.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
#define CH_DBG_FILL_THREADS FALSE
#endif
/**
* @brief Debug option, threads profiling.
* @details If enabled then a field is added to the @p Thread structure that
* counts the system ticks occurred while executing the thread.
*
* @note The default is @p TRUE.
* @note This debug option is defaulted to TRUE because it is required by
* some test cases into the test suite.
*/
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
#define CH_DBG_THREADS_PROFILING TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Kernel hooks
* @{
*/
/*===========================================================================*/
/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p Thread structure.
*/
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__)
#define THREAD_EXT_FIELDS \
/* Add threads custom fields here.*/
#endif
/**
* @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API.
*
* @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs.
*/
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
}
#endif
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
*
* @note It is inserted into lock zone.
* @note It is also invoked when the threads simply return in order to
* terminate.
*/
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
}
#endif
/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
*/
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* System halt code here.*/ \
}
#endif
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
#define IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \
}
#endif
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_TICK_EVENT_HOOK() { \
/* System tick event code here.*/ \
}
#endif
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_HALT_HOOK() { \
/* System halt code here.*/ \
}
#endif
/** @} */
/*===========================================================================*/
/* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/
#endif /* _CHCONF_H_ */
/** @} */

View File

@ -1,65 +0,0 @@
/**
* @file efifeatures.h
*
* @brief In this header we can configure which modules are used for EGT2CAN firmware.
*
* @date Dec 23, 2014
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#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_SERIAL_DEVICE (&SD1)
#define TS_SERIAL_DEVICE (&SD3)
#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 FALSE
#define CCM_OPTIONAL
#define EFI_EGT TRUE
#define EFI_UNIT_TEST FALSE
#define CONSOLE_MODE_SWITCH_PORT GPIOB
#define CONSOLE_MODE_SWITCH_PIN 1
#define EFI_MAX_31855 TRUE
#define CONSOLE_MAX_ACTIONS 32
#define CONFIG_RESET_SWITCH_PORT GPIOD
#define CONFIG_RESET_SWITCH_PIN 6
/**
* This is the size of the MemoryStream used by chvprintf
*/
#define INTERMEDIATE_LOGGING_BUFFER_SIZE 256
#endif /* EFIFEATURES_H_ */

View File

@ -1,9 +0,0 @@
#define EXTERN_ENGINE
// this stuff is about ChibiOS 2.6 > Migration
typedef VirtualTimer virtual_timer_t;
typedef EventListener event_listener_t;
typedef Thread thread_t;
#define THD_WORKING_AREA WORKING_AREA

View File

@ -1,312 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file templates/halconf.h
* @brief HAL configuration header.
* @details HAL configuration file, this file allows to enable or disable the
* various device drivers from your application. You may also use
* this file in order to override the device drivers default settings.
*
* @addtogroup HAL_CONF
* @{
*/
#ifndef _HALCONF_H_
#define _HALCONF_H_
#include "mcuconf.h"
/**
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
#define HAL_USE_TM FALSE
#endif
/**
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
#define HAL_USE_PAL TRUE
#endif
/**
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
#define HAL_USE_ADC FALSE
#endif
/**
* @brief Enables the CAN subsystem.
*/
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
#define HAL_USE_CAN FALSE
#endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/**
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
#define HAL_USE_GPT FALSE
#endif
/**
* @brief Enables the I2C subsystem.
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
#define HAL_USE_I2C FALSE
#endif
/**
* @brief Enables the ICU subsystem.
*/
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
#define HAL_USE_ICU FALSE
#endif
/**
* @brief Enables the MAC subsystem.
*/
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
#define HAL_USE_MAC FALSE
#endif
/**
* @brief Enables the MMC_SPI subsystem.
*/
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
#define HAL_USE_MMC_SPI FALSE
#endif
/**
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE
#endif
/**
* @brief Enables the RTC subsystem.
*/
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
#define HAL_USE_RTC FALSE
#endif
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
/**
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL TRUE
#endif
/**
* @brief Enables the SERIAL over USB subsystem.
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL_USB FALSE
#endif
/**
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
#define HAL_USE_SPI TRUE
#endif
/**
* @brief Enables the UART subsystem.
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
#define HAL_USE_UART FALSE
#endif
/**
* @brief Enables the USB subsystem.
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
#define HAL_USE_USB FALSE
#endif
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
#define ADC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define ADC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
/**
* @brief Sleep mode related APIs inclusion switch.
*/
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
#define CAN_USE_SLEEP_MODE TRUE
#endif
/*===========================================================================*/
/* I2C driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define I2C_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables an event sources for incoming packets.
*/
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE
#endif
/**
* @brief Enables an event sources for incoming packets.
*/
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
#define MAC_USE_EVENTS TRUE
#endif
/*===========================================================================*/
/* MMC_SPI driver related settings. */
/*===========================================================================*/
/**
* @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however.
* This option is recommended also if the SPI driver does not
* use a DMA channel and heavily loads the CPU.
*/
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE
#endif
/*===========================================================================*/
/* SDC driver related settings. */
/*===========================================================================*/
/**
* @brief Number of initialization attempts before rejecting the card.
* @note Attempts are performed at 10mS intervals.
*/
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
#define SDC_INIT_RETRY 100
#endif
/**
* @brief Include support for MMC cards.
* @note MMC support is not yet implemented so this option must be kept
* at @p FALSE.
*/
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
#define SDC_MMC_SUPPORT FALSE
#endif
/**
* @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however.
*/
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
#define SDC_NICE_WAITING TRUE
#endif
/*===========================================================================*/
/* SERIAL driver related settings. */
/*===========================================================================*/
/**
* @brief Default bit rate.
* @details Configuration parameter, this is the baud rate selected for the
* default configuration.
*/
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SERIAL_DEFAULT_BITRATE 38400
#endif
/**
* @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive
* buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 16
#endif
/*===========================================================================*/
/* SPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
#define SPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* _HALCONF_H_ */
/** @} */

View File

@ -1,149 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* STM32F0xx drivers configuration.
* The following settings override the default settings present in
* the various device driver implementation headers.
* Note that the settings for each driver only have effect if the whole
* driver is enabled in halconf.h.
*
* IRQ priorities:
* 3...0 Lowest...Highest.
*
* DMA priorities:
* 0...3 Lowest...Highest.
*/
#define STM32F0xx_MCUCONF
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_HSI14_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSI
#define STM32_PREDIV_VALUE 1
#define STM32_PLLMUL_VALUE 12
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE STM32_PPRE_DIV1
#define STM32_ADCSW STM32_ADCSW_HSI14
#define STM32_ADCPRE STM32_ADCPRE_DIV4
#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
#define STM32_ADCPRE STM32_ADCPRE_DIV4
#define STM32_ADCSW STM32_ADCSW_HSI14
#define STM32_CECSW STM32_CECSW_HSI
#define STM32_I2C1SW STM32_I2C1SW_HSI
#define STM32_USART1SW STM32_USART1SW_PCLK
#define STM32_RTCSEL STM32_RTCSEL_LSI
/*
* ADC driver system settings.
*/
#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_ADC1_DMA_PRIORITY 2
#define STM32_ADC_IRQ_PRIORITY 2
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 2
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_1_IRQ_PRIORITY 3
#define STM32_EXT_EXTI2_3_IRQ_PRIORITY 3
#define STM32_EXT_EXTI4_15_IRQ_PRIORITY 3
#define STM32_EXT_EXTI16_IRQ_PRIORITY 3
#define STM32_EXT_EXTI17_IRQ_PRIORITY 3
/*
* GPT driver system settings.
*/
#define STM32_GPT_USE_TIM1 FALSE
#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM14 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 2
#define STM32_GPT_TIM2_IRQ_PRIORITY 2
#define STM32_GPT_TIM3_IRQ_PRIORITY 2
#define STM32_GPT_TIM14_IRQ_PRIORITY 2
/*
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 FALSE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_I2C1_IRQ_PRIORITY 3
#define STM32_I2C_I2C2_IRQ_PRIORITY 3
#define STM32_I2C_I2C1_DMA_PRIORITY 1
#define STM32_I2C_I2C2_DMA_PRIORITY 1
#define STM32_I2C_DMA_ERROR_HOOK(i2cp) chSysHalt()
/*
* ICU driver system settings.
*/
#define STM32_ICU_USE_TIM1 FALSE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 3
#define STM32_ICU_TIM2_IRQ_PRIORITY 3
#define STM32_ICU_TIM3_IRQ_PRIORITY 3
/*
* PWM driver system settings.
*/
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 3
#define STM32_PWM_TIM2_IRQ_PRIORITY 3
#define STM32_PWM_TIM3_IRQ_PRIORITY 3
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 TRUE
#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USART1_PRIORITY 3
#define STM32_SERIAL_USART2_PRIORITY 3
/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 TRUE
#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
#define STM32_SPI_SPI1_IRQ_PRIORITY 2
#define STM32_SPI_SPI2_IRQ_PRIORITY 2
#define STM32_SPI_DMA_ERROR_HOOK(spip) chSysHalt()
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USART1_IRQ_PRIORITY 3
#define STM32_UART_USART2_IRQ_PRIORITY 3
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_DMA_ERROR_HOOK(uartp) chSysHalt()

View File

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

View File

@ -1,11 +0,0 @@
rem
rem STM32F103 version of the firmware
rem
cd ../..
set EXTRA_PARAMS="-DSTM32F1XX"
set PROJECT_CPU=ST_STM32F1
set LDSCRIPT=config/stm32f1egt/STM32F103xB.ld
set USE_FPU=no
make
rem call compile_and_program.bat -r

View File

@ -1,149 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* ST32F103xB memory setup.
*/
__main_stack_size__ = 0x0400;
__process_stack_size__ = 0x0400;
MEMORY
{
flash : org = 0x08000000, len = 128k
ram : org = 0x20000000, len = 20k
}
__ram_start__ = ORIGIN(ram);
__ram_size__ = LENGTH(ram);
__ram_end__ = __ram_start__ + __ram_size__;
ENTRY(ResetHandler)
SECTIONS
{
. = 0;
_text = .;
startup : ALIGN(16) SUBALIGN(16)
{
KEEP(*(vectors))
} > flash
constructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE(__init_array_end = .);
} > flash
destructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__fini_array_start = .);
KEEP(*(.fini_array))
KEEP(*(SORT(.fini_array.*)))
PROVIDE(__fini_array_end = .);
} > flash
.text : ALIGN(16) SUBALIGN(16)
{
*(.text.startup.*)
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
*(.glue_7t)
*(.glue_7)
*(.gcc*)
} > flash
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > flash
.ARM.exidx : {
PROVIDE(__exidx_start = .);
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
PROVIDE(__exidx_end = .);
} > flash
.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > flash
.eh_frame : ONLY_IF_RO
{
*(.eh_frame)
} > flash
.textalign : ONLY_IF_RO
{
. = ALIGN(8);
} > flash
. = ALIGN(4);
_etext = .;
_textdata = _etext;
.stacks :
{
. = ALIGN(8);
__main_stack_base__ = .;
. += __main_stack_size__;
. = ALIGN(8);
__main_stack_end__ = .;
__process_stack_base__ = .;
__main_thread_stack_base__ = .;
. += __process_stack_size__;
. = ALIGN(8);
__process_stack_end__ = .;
__main_thread_stack_end__ = .;
} > ram
.data :
{
. = ALIGN(4);
PROVIDE(_data = .);
*(.data)
. = ALIGN(4);
*(.data.*)
. = ALIGN(4);
*(.ramtext)
. = ALIGN(4);
PROVIDE(_edata = .);
} > ram AT > flash
.bss :
{
. = ALIGN(4);
PROVIDE(_bss_start = .);
*(.bss)
. = ALIGN(4);
*(.bss.*)
. = ALIGN(4);
*(COMMON)
. = ALIGN(4);
PROVIDE(_bss_end = .);
} > ram
}
PROVIDE(end = .);
_end = .;
__heap_base__ = _end;
__heap_end__ = __ram_end__;

View File

@ -1,534 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file templates/chconf.h
* @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings.
*
* @addtogroup config
* @details Kernel related settings and hooks.
* @{
*/
#ifndef _CHCONF_H_
#define _CHCONF_H_
#define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK
/*===========================================================================*/
/**
* @name Kernel parameters and options
* @{
*/
/*===========================================================================*/
/**
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__)
#define CH_FREQUENCY 1000
#endif
/**
* @brief Round robin interval.
* @details This constant is the number of system ticks allowed for the
* threads before preemption occurs. Setting this value to zero
* disables the preemption for threads with equal priority and the
* round robin becomes cooperative. Note that higher priority
* threads can still preempt, the kernel is always preemptive.
*
* @note Disabling the round robin preemption makes the kernel more compact
* and generally faster.
*/
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__)
#define CH_TIME_QUANTUM 20
#endif
/**
* @brief Managed RAM size.
* @details Size of the RAM area to be managed by the OS. If set to zero
* then the whole available RAM is used. The core memory is made
* available to the heap allocator and/or can be used directly through
* the simplified core memory allocator.
*
* @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_USE_MEMCORE.
*/
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_MEMCORE_SIZE 0
#endif
/**
* @brief Idle thread automatic spawn suppression.
* @details When this option is activated the function @p chSysInit()
* does not spawn the idle thread automatically. The application has
* then the responsibility to do one of the following:
* - Spawn a custom idle thread at priority @p IDLEPRIO.
* - Change the main() thread priority to @p IDLEPRIO then enter
* an endless loop. In this scenario the @p main() thread acts as
* the idle thread.
* .
* @note Unless an idle thread is spawned the @p main() thread must not
* enter a sleep state.
*/
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
#define CH_NO_IDLE_THREAD FALSE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Performance options
* @{
*/
/*===========================================================================*/
/**
* @brief OS optimization.
* @details If enabled then time efficient rather than space efficient code
* is used when two possible implementations exist.
*
* @note This is not related to the compiler optimization options.
* @note The default is @p TRUE.
*/
#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
#define CH_OPTIMIZE_SPEED TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Subsystem options
* @{
*/
/*===========================================================================*/
/**
* @brief Threads registry APIs.
* @details If enabled then the registry APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
#define CH_USE_REGISTRY TRUE
#endif
/**
* @brief Threads synchronization APIs.
* @details If enabled then the @p chThdWait() function is included in
* the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__)
#define CH_USE_WAITEXIT TRUE
#endif
/**
* @brief Semaphores APIs.
* @details If enabled then the Semaphores APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES TRUE
#endif
/**
* @brief Semaphores queuing mode.
* @details If enabled then the threads are enqueued on semaphores by
* priority rather than in FIFO order.
*
* @note The default is @p FALSE. Enable this if you have special requirements.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES_PRIORITY FALSE
#endif
/**
* @brief Atomic semaphore API.
* @details If enabled then the semaphores the @p chSemSignalWait() API
* is included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
#define CH_USE_SEMSW TRUE
#endif
/**
* @brief Mutexes APIs.
* @details If enabled then the mutexes APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__)
#define CH_USE_MUTEXES TRUE
#endif
/**
* @brief Conditional Variables APIs.
* @details If enabled then the conditional variables APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_MUTEXES.
*/
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS TRUE
#endif
/**
* @brief Conditional Variables APIs with timeout.
* @details If enabled then the conditional variables APIs with timeout
* specification are included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_CONDVARS.
*/
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS_TIMEOUT TRUE
#endif
/**
* @brief Events Flags APIs.
* @details If enabled then the event flags APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__)
#define CH_USE_EVENTS TRUE
#endif
/**
* @brief Events Flags APIs with timeout.
* @details If enabled then the events APIs with timeout specification
* are included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_EVENTS.
*/
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_EVENTS_TIMEOUT TRUE
#endif
/**
* @brief Synchronous Messages APIs.
* @details If enabled then the synchronous messages APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES TRUE
#endif
/**
* @brief Synchronous Messages queuing mode.
* @details If enabled then messages are served by priority rather than in
* FIFO order.
*
* @note The default is @p FALSE. Enable this if you have special requirements.
* @note Requires @p CH_USE_MESSAGES.
*/
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES_PRIORITY FALSE
#endif
/**
* @brief Mailboxes APIs.
* @details If enabled then the asynchronous messages (mailboxes) APIs are
* included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__)
#define CH_USE_MAILBOXES TRUE
#endif
/**
* @brief I/O Queues APIs.
* @details If enabled then the I/O queues APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_USE_QUEUES TRUE
#endif
/**
* @brief Core Memory Manager APIs.
* @details If enabled then the core memory manager APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__)
#define CH_USE_MEMCORE TRUE
#endif
/**
* @brief Heap Allocator APIs.
* @details If enabled then the memory heap allocator APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
* @p CH_USE_SEMAPHORES.
* @note Mutexes are recommended.
*/
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__)
#define CH_USE_HEAP TRUE
#endif
/**
* @brief C-runtime allocator.
* @details If enabled the the heap allocator APIs just wrap the C-runtime
* @p malloc() and @p free() functions.
*
* @note The default is @p FALSE.
* @note Requires @p CH_USE_HEAP.
* @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the
* appropriate documentation.
*/
#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define CH_USE_MALLOC_HEAP FALSE
#endif
/**
* @brief Memory Pools Allocator APIs.
* @details If enabled then the memory pools allocator APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__)
#define CH_USE_MEMPOOLS TRUE
#endif
/**
* @brief Dynamic Threads APIs.
* @details If enabled then the dynamic threads creation APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_WAITEXIT.
* @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS.
*/
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__)
#define CH_USE_DYNAMIC TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Debug options
* @{
*/
/*===========================================================================*/
/**
* @brief Debug option, system state check.
* @details If enabled the correct call protocol for system APIs is checked
* at runtime.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
#endif
/**
* @brief Debug option, parameters checks.
* @details If enabled then the checks on the API functions input
* parameters are activated.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_CHECKS FALSE
#endif
/**
* @brief Debug option, consistency checks.
* @details If enabled then all the assertions in the kernel code are
* activated. This includes consistency checks inside the kernel,
* runtime anomalies and port-defined checks.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
* @brief Debug option, trace buffer.
* @details If enabled then the context switch circular trace buffer is
* activated.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_TRACE FALSE
#endif
/**
* @brief Debug option, stack checks.
* @details If enabled then a runtime stack check is performed.
*
* @note The default is @p FALSE.
* @note The stack check is performed in a architecture/port dependent way.
* It may not be implemented or some ports.
* @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
* @brief Debug option, stacks initialization.
* @details If enabled then the threads working area is filled with a byte
* value when a thread is created. This can be useful for the
* runtime measurement of the used stack.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
#define CH_DBG_FILL_THREADS FALSE
#endif
/**
* @brief Debug option, threads profiling.
* @details If enabled then a field is added to the @p Thread structure that
* counts the system ticks occurred while executing the thread.
*
* @note The default is @p TRUE.
* @note This debug option is defaulted to TRUE because it is required by
* some test cases into the test suite.
*/
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
#define CH_DBG_THREADS_PROFILING TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Kernel hooks
* @{
*/
/*===========================================================================*/
/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p Thread structure.
*/
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__)
#define THREAD_EXT_FIELDS \
/* Add threads custom fields here.*/
#endif
/**
* @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API.
*
* @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs.
*/
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
}
#endif
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
*
* @note It is inserted into lock zone.
* @note It is also invoked when the threads simply return in order to
* terminate.
*/
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
}
#endif
/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
*/
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* System halt code here.*/ \
}
#endif
/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
#define IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \
}
#endif
/**
* @brief System tick event hook.
* @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue.
*/
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_TICK_EVENT_HOOK() { \
/* System tick event code here.*/ \
}
#endif
/**
* @brief System halt hook.
* @details This hook is invoked in case to a system halting error before
* the system is halted.
*/
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_HALT_HOOK() { \
/* System halt code here.*/ \
}
#endif
/** @} */
/*===========================================================================*/
/* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/
#endif /* _CHCONF_H_ */
/** @} */

View File

@ -1,61 +0,0 @@
/**
* @file efifeatures.h
*
* @brief In this header we can configure which modules are used for EGT2CAN firmware.
*
* @date Dec 23, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef EFIFEATURES_H_
#define EFIFEATURES_H_
#define DL_OUTPUT_BUFFER 128
#define EFI_USB_SERIAL TRUE
#define hal_lld_get_counter_value() DWT_CYCCNT
#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 FALSE
#define CCM_OPTIONAL
#define EFI_EGT TRUE
#define EFI_UNIT_TEST FALSE
#define EFI_MAX_31855 TRUE
#define CONSOLE_MAX_ACTIONS 32
#ifndef CONFIG_RESET_SWITCH_PORT
#define CONFIG_RESET_SWITCH_PORT GPIOD
#endif
#define CONFIG_RESET_SWITCH_PIN 6
/**
* This is the size of the MemoryStream used by chvprintf
*/
#define INTERMEDIATE_LOGGING_BUFFER_SIZE 256
#endif /* EFIFEATURES_H_ */

View File

@ -1,312 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @file templates/halconf.h
* @brief HAL configuration header.
* @details HAL configuration file, this file allows to enable or disable the
* various device drivers from your application. You may also use
* this file in order to override the device drivers default settings.
*
* @addtogroup HAL_CONF
* @{
*/
#ifndef _HALCONF_H_
#define _HALCONF_H_
#include "mcuconf.h"
/**
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
#define HAL_USE_TM TRUE
#endif
/**
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
#define HAL_USE_PAL TRUE
#endif
/**
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
#define HAL_USE_ADC FALSE
#endif
/**
* @brief Enables the CAN subsystem.
*/
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
#define HAL_USE_CAN FALSE
#endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/**
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
#define HAL_USE_GPT FALSE
#endif
/**
* @brief Enables the I2C subsystem.
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
#define HAL_USE_I2C FALSE
#endif
/**
* @brief Enables the ICU subsystem.
*/
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
#define HAL_USE_ICU FALSE
#endif
/**
* @brief Enables the MAC subsystem.
*/
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
#define HAL_USE_MAC FALSE
#endif
/**
* @brief Enables the MMC_SPI subsystem.
*/
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
#define HAL_USE_MMC_SPI FALSE
#endif
/**
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE
#endif
/**
* @brief Enables the RTC subsystem.
*/
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
#define HAL_USE_RTC FALSE
#endif
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
/**
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL TRUE
#endif
/**
* @brief Enables the SERIAL over USB subsystem.
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL_USB TRUE
#endif
/**
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
#define HAL_USE_SPI TRUE
#endif
/**
* @brief Enables the UART subsystem.
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
#define HAL_USE_UART FALSE
#endif
/**
* @brief Enables the USB subsystem.
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
#define HAL_USE_USB TRUE
#endif
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
#define ADC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define ADC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
/* CAN driver related settings. */
/*===========================================================================*/
/**
* @brief Sleep mode related APIs inclusion switch.
*/
#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
#define CAN_USE_SLEEP_MODE TRUE
#endif
/*===========================================================================*/
/* I2C driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the mutual exclusion APIs on the I2C bus.
*/
#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define I2C_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/
/* MAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables an event sources for incoming packets.
*/
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE
#endif
/**
* @brief Enables an event sources for incoming packets.
*/
#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
#define MAC_USE_EVENTS TRUE
#endif
/*===========================================================================*/
/* MMC_SPI driver related settings. */
/*===========================================================================*/
/**
* @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however.
* This option is recommended also if the SPI driver does not
* use a DMA channel and heavily loads the CPU.
*/
#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
#define MMC_NICE_WAITING TRUE
#endif
/*===========================================================================*/
/* SDC driver related settings. */
/*===========================================================================*/
/**
* @brief Number of initialization attempts before rejecting the card.
* @note Attempts are performed at 10mS intervals.
*/
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
#define SDC_INIT_RETRY 100
#endif
/**
* @brief Include support for MMC cards.
* @note MMC support is not yet implemented so this option must be kept
* at @p FALSE.
*/
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
#define SDC_MMC_SUPPORT FALSE
#endif
/**
* @brief Delays insertions.
* @details If enabled this options inserts delays into the MMC waiting
* routines releasing some extra CPU time for the threads with
* lower priority, this may slow down the driver a bit however.
*/
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
#define SDC_NICE_WAITING TRUE
#endif
/*===========================================================================*/
/* SERIAL driver related settings. */
/*===========================================================================*/
/**
* @brief Default bit rate.
* @details Configuration parameter, this is the baud rate selected for the
* default configuration.
*/
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
#define SERIAL_DEFAULT_BITRATE 38400
#endif
/**
* @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive
* buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 16
#endif
/*===========================================================================*/
/* SPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
#define SPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* _HALCONF_H_ */
/** @} */

View File

@ -1,199 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#define STM32F103_MCUCONF
/*
* STM32F103 drivers configuration.
* The following settings override the default settings present in
* the various device driver implementation headers.
* Note that the settings for each driver only have effect if the whole
* driver is enabled in halconf.h.
*
* IRQ priorities:
* 15...0 Lowest...Highest.
*
* DMA priorities:
* 0...3 Lowest...Highest.
*/
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED FALSE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSI
#define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1
#define STM32_PLLMUL_VALUE 12
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV2
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_ADCPRE STM32_ADCPRE_DIV4
#define STM32_USB_CLOCK_REQUIRED TRUE
#define STM32_USBPRE STM32_USBPRE_DIV1
#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
#define STM32_RTCSEL STM32_RTCSEL_NOCLOCK
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
/*
* ADC driver system settings.
*/
#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_ADC1_DMA_PRIORITY 2
#define STM32_ADC_ADC1_IRQ_PRIORITY 6
/*
* CAN driver system settings.
*/
#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
/*
* GPT driver system settings.
*/
#define STM32_GPT_USE_TIM1 FALSE
#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM5 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7
#define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 7
#define STM32_GPT_TIM4_IRQ_PRIORITY 7
#define STM32_GPT_TIM5_IRQ_PRIORITY 7
#define STM32_GPT_TIM8_IRQ_PRIORITY 7
/*
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 FALSE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_I2C1_IRQ_PRIORITY 5
#define STM32_I2C_I2C2_IRQ_PRIORITY 5
#define STM32_I2C_I2C1_DMA_PRIORITY 3
#define STM32_I2C_I2C2_DMA_PRIORITY 3
#define STM32_I2C_I2C1_DMA_ERROR_HOOK() chSysHalt()
#define STM32_I2C_I2C2_DMA_ERROR_HOOK() chSysHalt()
/*
* ICU driver system settings.
*/
#define STM32_ICU_USE_TIM1 FALSE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM5 FALSE
#define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7
#define STM32_ICU_TIM3_IRQ_PRIORITY 7
#define STM32_ICU_TIM4_IRQ_PRIORITY 7
#define STM32_ICU_TIM5_IRQ_PRIORITY 7
#define STM32_ICU_TIM8_IRQ_PRIORITY 7
/*
* PWM driver system settings.
*/
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7
#define STM32_PWM_TIM5_IRQ_PRIORITY 7
#define STM32_PWM_TIM8_IRQ_PRIORITY 7
/*
* RTC driver system settings.
*/
#define STM32_RTC_IRQ_PRIORITY 15
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 TRUE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USART1_PRIORITY 12
#define STM32_SERIAL_USART2_PRIORITY 12
#define STM32_SERIAL_USART3_PRIORITY 12
#define STM32_SERIAL_UART4_PRIORITY 12
#define STM32_SERIAL_UART5_PRIORITY 12
/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 TRUE
#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
#define STM32_SPI_SPI3_DMA_PRIORITY 1
#define STM32_SPI_SPI1_IRQ_PRIORITY 10
#define STM32_SPI_SPI2_IRQ_PRIORITY 10
#define STM32_SPI_SPI3_IRQ_PRIORITY 10
#define STM32_SPI_DMA_ERROR_HOOK(spip) chSysHalt()
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USE_USART3 FALSE
#define STM32_UART_USART1_IRQ_PRIORITY 12
#define STM32_UART_USART2_IRQ_PRIORITY 12
#define STM32_UART_USART3_IRQ_PRIORITY 12
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_USART3_DMA_PRIORITY 0
#define STM32_UART_DMA_ERROR_HOOK(uartp) chSysHalt()
/*
* USB driver system settings.
*/
#define STM32_USB_USE_USB1 TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14

View File

@ -124,8 +124,6 @@
*/
#define EFI_ENGINE_CONTROL TRUE
#define EFI_SPEED_DENSITY TRUE
/**
* MCP42010 digital potentiometer support. This could be useful if you are stimulating some
* stock ECU
@ -244,14 +242,11 @@
#endif
/**
* While we embed multiple PnP configurations into the same firmware binary, these marcoses give us control
* over which configurations go into the binary
* Should PnP engine configurations be included in the binary?
*/
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#ifndef EFI_INCLUDE_ENGINE_PRESETS
#define EFI_INCLUDE_ENGINE_PRESETS TRUE
#endif
#ifndef EFI_ENGINE_SNIFFER
#define EFI_ENGINE_SNIFFER TRUE

View File

@ -276,7 +276,6 @@
// todo: https://github.com/rusefi/rusefi/issues/630 ?
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM5 FALSE
// todo: https://github.com/rusefi/rusefi/issues/630 ?
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7

View File

@ -305,7 +305,7 @@ static void handleGetStructContent(ts_channel_s *tsChannel, int structId, int si
// Returns true if an overrun would occur.
static bool validateOffsetCount(size_t offset, size_t count, ts_channel_s *tsChannel) {
if (offset + count > getTunerStudioPageSize()) {
scheduleMsg(&tsLogger, "ERROR invalid offset %d count %d", offset, count);
scheduleMsg(&tsLogger, "TS: Project mismatch? Too much data requested %d/%d", offset, count);
tunerStudioError("ERROR: out of range");
sendErrorCode(tsChannel);
return true;
@ -631,7 +631,7 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode) {
*/
void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) {
if (offset + count > sizeof(TunerStudioOutputChannels)) {
scheduleMsg(&tsLogger, "ERROR invalid offset %d count %d", offset, count);
scheduleMsg(&tsLogger, "TS: Version Mismatch? Too much data requested %d+%d", offset, count);
sendErrorCode(tsChannel);
return;
}
@ -801,8 +801,8 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
tsOutputChannels.debugIntField3 = index;
}
#if EFI_PROD_CODE
executeTSCommand(subsystem, index);
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
executeTSCommand(subsystem, index);
#endif /* EFI_PROD_CODE */
sendOkResponse(tsChannel, TS_CRC);
}

View File

@ -8,54 +8,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#ifndef TUNERSTUDIO_CONFIGURATION_H_
#define TUNERSTUDIO_CONFIGURATION_H_
#pragma once
#include "rusefi_types.h"
#include "rusefi_generated.h"
#include "scaled_channel.h"
#include "tunerstudio_debug_struct.h"
// This class lets us transparently store something at a ratio inside an integer type
// Just use it like a float - you can read and write to it, like this:
// scaled_channel<uint8_t, 10> myVar;
// myVar = 2.4f; // converts to an int, stores 24
// float x = myVar; // converts back to float, returns 2.4f
template <typename T, int mult = 1>
class scaled_channel {
public:
scaled_channel() : m_value(static_cast<T>(0)) { }
scaled_channel(float val)
: m_value(val * mult)
{
}
// Allow reading back out as a float (note: this may be lossy!)
operator float() const {
return m_value / (float)mult;
}
private:
T m_value;
};
// We need to guarantee that scaled values containing some type are the same size
// as that underlying type. We rely on the class only having a single member for
// this trick to work.
static_assert(sizeof(scaled_channel<uint8_t>) == 1);
static_assert(sizeof(scaled_channel<uint16_t>) == 2);
static_assert(sizeof(scaled_channel<uint32_t>) == 4);
static_assert(sizeof(scaled_channel<float>) == 4);
// Common scaling options - use these if you can!
using scaled_temperature = scaled_channel<int16_t, PACK_MULT_TEMPERATURE>; // +-327 deg C at 0.01 deg resolution
using scaled_ms = scaled_channel<int16_t, PACK_MULT_MS>; // +- 100ms at 0.003ms precision
using scaled_percent = scaled_channel<int16_t, PACK_MULT_PERCENT>; // +-327% at 0.01% resolution
using scaled_pressure = scaled_channel<uint16_t, PACK_MULT_PRESSURE>; // 0-2000kPa (~300psi) at 0.03kPa resolution
using scaled_angle = scaled_channel<int16_t, PACK_MULT_ANGLE>; // +-655 degrees at 0.02 degree resolution
using scaled_voltage = scaled_channel<uint16_t, PACK_MULT_VOLTAGE>; // 0-65v at 1mV resolution
using scaled_afr = scaled_channel<uint16_t, PACK_MULT_AFR>; // 0-65afr at 0.001 resolution
typedef struct {
uint16_t values[EGT_CHANNEL_COUNT];
} egt_values_s;
@ -220,6 +178,9 @@ typedef struct {
// EGT
egt_values_s egtValues; // 204
scaled_percent throttle2Position; // 220
uint8_t unusedAtTheEnd[18]; // we have some unused bytes to allow compatible TS changes
// Temporary - will remove soon
TsDebugChannels* getDebugChannels() {
@ -230,5 +191,3 @@ typedef struct {
} TunerStudioOutputChannels;
extern TunerStudioOutputChannels tsOutputChannels;
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */

View File

@ -75,8 +75,8 @@ extern bool main_loop_started;
#include "vehicle_speed.h"
#include "single_timer_executor.h"
#include "periodic_task.h"
extern int icuWidthCallbackCounter;
extern int icuWidthPeriodCounter;
extern int icuRisingCallbackCounter;
extern int icuFallingCallbackCounter;
#endif /* EFI_PROD_CODE */
#if EFI_CJ125
@ -310,7 +310,10 @@ static void printSensors(Logging *log) {
if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
reportSensorF(log, GAUGE_NAME_FUEL_VE, "%", engine->engineState.currentBaroCorrectedVE * PERCENT_MULT, 2);
}
#if EFI_SHAFT_POSITION_INPUT
reportSensorF(log, GAUGE_NAME_VVT, "deg", engine->triggerCentral.getVVTPosition(), 1);
#endif
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
reportSensorF(log, GAUGE_NAME_ENGINE_LOAD, "x", engineLoad, 2);
@ -721,11 +724,15 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// offset 8
tsOutputChannels->intakeAirTemperature = intake;
SensorResult tps = Sensor::get(SensorType::Tps1);
tsOutputChannels->throttlePosition = tps.Value;
tsOutputChannels->isTpsError = !tps.Valid;
SensorResult tps1 = Sensor::get(SensorType::Tps1);
tsOutputChannels->throttlePosition = tps1.Value;
tsOutputChannels->isTpsError = !tps1.Valid;
tsOutputChannels->tpsADC = convertVoltageTo10bitADC(Sensor::getRaw(SensorType::Tps1));
SensorResult tps2 = Sensor::get(SensorType::Tps2);
tsOutputChannels->throttle2Position = tps2.Value;
// offset 16
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMafVoltage(PASS_ENGINE_PARAMETER_SIGNATURE) : 0;
@ -767,7 +774,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// 136
tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE) ? getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE) : 0;
// 140
#if EFI_ENGINE_CONTROL
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX);
#endif
// 148
tsOutputChannels->fuelTankLevel = engine->sensors.fuelTankLevel;
// 160
@ -785,8 +794,12 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// 224
efitimesec_t timeSeconds = getTimeNowSeconds();
tsOutputChannels->timeSeconds = timeSeconds;
#if EFI_SHAFT_POSITION_INPUT
// 248
tsOutputChannels->vvtPosition = engine->triggerCentral.getVVTPosition();
#endif
// 252
tsOutputChannels->engineMode = packEngineMode(PASS_ENGINE_PARAMETER_SIGNATURE);
// 120
@ -817,9 +830,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->hasFatalError = hasFirmwareError();
tsOutputChannels->coilDutyCycle = getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX);
tsOutputChannels->isWarnNow = engine->engineState.warnings.isWarningNow(timeSeconds, true);
#if EFI_HIP_9011
tsOutputChannels->isKnockChipOk = (instance.invalidHip9011ResponsesCount == 0);
@ -894,6 +904,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->brakePedalState = engine->brakePedalState;
tsOutputChannels->acSwitchState = engine->acSwitchState;
#if EFI_ENGINE_CONTROL
// tCharge depends on the previous state, so we should use the stored value.
tsOutputChannels->tCharge = ENGINE(engineState.sd.tCharge);
float timing = engine->engineState.timingAdvance;
@ -903,6 +914,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->crankingFuelMs = engine->isCylinderCleanupMode ? 0 : getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE);
tsOutputChannels->chargeAirMass = engine->engineState.sd.airMassInOneCylinder;
tsOutputChannels->coilDutyCycle = getCoilDutyCycle(rpm PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_ENGINE_CONTROL
switch (engineConfiguration->debugMode) {
case DBG_AUX_TEMPERATURE:
@ -941,7 +954,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
#if EFI_PROD_CODE && HAL_USE_ICU == TRUE
tsOutputChannels->debugIntField4 = engine->triggerCentral.vvtEventRiseCounter;
tsOutputChannels->debugIntField5 = engine->triggerCentral.vvtEventFallCounter;
tsOutputChannels->debugFloatField5 = icuWidthCallbackCounter + icuWidthPeriodCounter;
tsOutputChannels->debugFloatField5 = icuRisingCallbackCounter + icuFallingCallbackCounter;
#endif /* EFI_PROD_CODE */
tsOutputChannels->debugFloatField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING);

View File

@ -0,0 +1,129 @@
/**
* @file dc_motors.cpp
*
* @date March 3, 2020
* @author Matthew Kennedy (c) 2020
*/
#include "engine.h"
#include "io_pins.h"
#include "engine_configuration.h"
#include "engine_controller.h"
#include "periodic_task.h"
#include "dc_motors.h"
#include "dc_motor.h"
#include "efi_gpio.h"
#include "pwm_generator.h"
EXTERN_ENGINE;
class EtbHardware {
private:
OutputPin m_pinEnable;
OutputPin m_pinDir1;
OutputPin m_pinDir2;
SimplePwm m_pwmEnable;
SimplePwm m_pwmDir1;
SimplePwm m_pwmDir2;
SimplePwm etbPwmUp;
public:
EtbHardware() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2) {}
TwoPinDcMotor dcMotor;
void setFrequency(int frequency) {
m_pwmEnable.setFrequency(frequency);
m_pwmDir1.setFrequency(frequency);
m_pwmDir2.setFrequency(frequency);
}
void start(bool useTwoWires,
brain_pin_e pinEnable,
// since we have pointer magic here we cannot simply have value parameter
const pin_output_mode_e *pinEnableMode,
brain_pin_e pinDir1,
brain_pin_e pinDir2,
ExecutorInterface* executor,
int frequency) {
dcMotor.setType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
m_pinEnable.initPin("ETB Enable", pinEnable, pinEnableMode);
m_pinDir1.initPin("ETB Dir 1", pinDir1);
m_pinDir2.initPin("ETB Dir 2", pinDir2);
// Clamp to >100hz
int clampedFrequency = maxI(100, frequency);
// no need to complicate event queue with ETB PWM in unit tests
#if ! EFI_UNIT_TEST
startSimplePwm(&m_pwmEnable, "ETB Enable",
executor,
&m_pinEnable,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
);
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
executor,
&m_pinDir1,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
);
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
executor,
&m_pinDir2,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState
);
#endif /* EFI_UNIT_TEST */
}
};
static EtbHardware etbHardware[ETB_COUNT];
DcMotor* initDcMotor(size_t index DECLARE_ENGINE_PARAMETER_SUFFIX)
{
const auto& io = engineConfiguration->etbIo[index];
auto& hw = etbHardware[index];
// controlPinMode is a strange feature - it's simply because I am short on 5v I/O on Frankenso with Miata NB2 test mule
hw.start(
CONFIG(etb_use_two_wires),
io.controlPin1,
&io.controlPinMode,
io.directionPin1,
io.directionPin2,
&ENGINE(executor),
CONFIG(etbFreq)
);
return &hw.dcMotor;
}
void setDcMotorFrequency(size_t index, int hz) {
etbHardware[index].setFrequency(hz);
}
void setDcMotorDuty(size_t index, float duty) {
etbHardware[index].dcMotor.set(duty);
}
#if EFI_PROD_CODE
void showDcMotorInfo(Logging* logger) {
for (int i = 0 ; i < engine->etbActualCount; i++) {
EtbHardware *etb = &etbHardware[i];
scheduleMsg(logger, "ETB %d", i);
scheduleMsg(logger, "Motor: dir=%d DC=%f", etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
}
}
#endif

View File

@ -0,0 +1,24 @@
/**
* @file dc_motors.h
*
* @date March 3, 2020
* @author Matthew Kennedy (c) 2020
*/
#pragma once
#include <cstddef>
#include "global.h"
class DcMotor;
class Logger;
DcMotor* initDcMotor(size_t index DECLARE_ENGINE_PARAMETER_SUFFIX);
// Manual control of motors for use by console commands
void setDcMotorFrequency(size_t index, int hz);
void setDcMotorDuty(size_t index, float duty);
#if EFI_PROD_CODE
void showDcMotorInfo(Logging* logger);
#endif

View File

@ -2,6 +2,8 @@
* @file electronic_throttle.cpp
* @brief Electronic Throttle driver
*
* @see test test_etb.cpp
*
*
* Limited user documentation at https://github.com/rusefi/rusefi_documentation/wiki/HOWTO_electronic_throttle_body
*
@ -81,8 +83,8 @@
#include "engine_controller.h"
#include "periodic_task.h"
#include "pin_repository.h"
#include "pwm_generator.h"
#include "dc_motor.h"
#include "dc_motors.h"
#include "pid_auto_tune.h"
#if defined(HAS_OS_ACCESS)
@ -106,74 +108,6 @@ static bool startupPositionError = false;
#define STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD 5
class EtbHardware {
private:
OutputPin m_pinEnable;
OutputPin m_pinDir1;
OutputPin m_pinDir2;
SimplePwm m_pwmEnable;
SimplePwm m_pwmDir1;
SimplePwm m_pwmDir2;
SimplePwm etbPwmUp;
public:
EtbHardware() : etbPwmUp("etbUp"), dcMotor(&m_pwmEnable, &m_pwmDir1, &m_pwmDir2) {}
TwoPinDcMotor dcMotor;
void setFrequency(int frequency) {
m_pwmEnable.setFrequency(frequency);
m_pwmDir1.setFrequency(frequency);
m_pwmDir2.setFrequency(frequency);
}
void start(bool useTwoWires,
brain_pin_e pinEnable,
// since we have pointer magic here we cannot simply have value parameter
pin_output_mode_e *pinEnableMode,
brain_pin_e pinDir1,
brain_pin_e pinDir2,
ExecutorInterface* executor,
int frequency) {
dcMotor.setType(useTwoWires ? TwoPinDcMotor::ControlType::PwmDirectionPins : TwoPinDcMotor::ControlType::PwmEnablePin);
m_pinEnable.initPin("ETB Enable", pinEnable, pinEnableMode);
m_pinDir1.initPin("ETB Dir 1", pinDir1);
m_pinDir2.initPin("ETB Dir 2", pinDir2);
// Clamp to >100hz
int clampedFrequency = maxI(100, frequency);
// no need to complicate event queue with ETB PWM in unit tests
#if ! EFI_UNIT_TEST
startSimplePwm(&m_pwmEnable, "ETB Enable",
executor,
&m_pinEnable,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState);
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
executor,
&m_pinDir1,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState);
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
executor,
&m_pinDir2,
clampedFrequency,
0,
(pwm_gen_callback*)applyPinState);
#endif /* EFI_UNIT_TEST */
}
};
extern percent_t mockPedalPosition;
static percent_t directPwmValue = NAN;
@ -194,7 +128,7 @@ void EtbController::reset() {
}
void EtbController::onConfigurationChange(pid_s* previousConfiguration) {
if (m_pid.isSame(previousConfiguration)) {
if (m_motor && m_pid.isSame(previousConfiguration)) {
m_shouldResetPid = true;
}
}
@ -357,7 +291,6 @@ DISPLAY(DISPLAY_IF(hasEtbPedalPositionSensor))
}
}
static EtbHardware etbHardware[ETB_COUNT];
// real implementation (we mock for some unit tests)
EtbController etbControllers[ETB_COUNT];
@ -388,13 +321,7 @@ static void showEthInfo(void) {
scheduleMsg(&logger, "dir1=%s", hwPortname(CONFIG(etbIo[0].directionPin1)));
scheduleMsg(&logger, "dir2=%s", hwPortname(CONFIG(etbIo[0].directionPin2)));
for (int i = 0 ; i < engine->etbActualCount; i++) {
EtbHardware *etb = &etbHardware[i];
scheduleMsg(&logger, "ETB %d", i);
scheduleMsg(&logger, "Motor: dir=%d DC=%f", etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
etbControllers[i].showStatus(&logger);
}
showDcMotorInfo(&logger);
#endif /* EFI_PROD_CODE */
}
@ -423,7 +350,7 @@ void setThrottleDutyCycle(percent_t level) {
float dc = ETB_PERCENT_TO_DUTY(level);
directPwmValue = dc;
for (int i = 0 ; i < engine->etbActualCount; i++) {
etbHardware[i].dcMotor.set(dc);
setDcMotorDuty(i, dc);
}
scheduleMsg(&logger, "duty ETB duty=%f", dc);
}
@ -432,7 +359,7 @@ static void setEtbFrequency(int frequency) {
engineConfiguration->etbFreq = frequency;
for (int i = 0 ; i < engine->etbActualCount; i++) {
etbHardware[i].setFrequency(frequency);
setDcMotorFrequency(i, frequency);
}
}
@ -440,7 +367,7 @@ static void etbReset() {
scheduleMsg(&logger, "etbReset");
for (int i = 0 ; i < engine->etbActualCount; i++) {
etbHardware[i].dcMotor.set(0);
setDcMotorDuty(i, 0);
}
etbPidReset();
@ -547,63 +474,12 @@ void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->etb.maxValue = 200;
}
static bool isEtbPinsChanged(etb_io *current, etb_io *active) {
return current->controlPin1 != active->controlPin1 ||
current->controlPinMode != active->controlPinMode ||
current->directionPin1 != active->directionPin1 ||
current->directionPin2 != active->directionPin2;
}
#if EFI_PROD_CODE
bool isETBRestartNeeded(void) {
for (int i = 0 ; i < ETB_COUNT; i++) {
/**
* We do not want any interruption in HW pin while adjusting other properties
*/
bool changed = isEtbPinsChanged(&engineConfiguration->etbIo[i], &activeConfiguration.etbIo[i]);
if (changed) {
return changed;
}
}
return false;
}
void stopETBPins(void) {
for (int i = 0 ; i < ETB_COUNT; i++) {
etb_io *activeIo = &activeConfiguration.etbIo[i];
brain_pin_markUnused(activeIo->controlPin1);
brain_pin_markUnused(activeIo->directionPin1);
brain_pin_markUnused(activeIo->directionPin2);
}
}
#endif /* EFI_PROD_CODE */
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration) {
for (int i = 0; i < ETB_COUNT; i++) {
etbControllers[i].onConfigurationChange(&previousConfiguration->etb);
}
}
void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/**
* safer to start 2nd ETB even if 2nd TPS is not configured by mistake
*/
for (int i = 0 ; i < ETB_COUNT; i++) {
etb_io *io = &engineConfiguration->etbIo[i];
// controlPinMode is a strange feature - it's simply because I am short on 5v I/O on Frankenso with Miata NB2 test mule
etbHardware[i].start(
CONFIG(etb_use_two_wires),
io->controlPin1,
&io->controlPinMode,
io->directionPin1,
io->directionPin2,
&ENGINE(executor),
CONFIG(etbFreq)
);
}
}
#if EFI_PROD_CODE && 0
static void setTempOutput(float value) {
autoTune.output = value;
@ -677,20 +553,28 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
addConsoleActionI("etb_freq", setEtbFrequency);
#endif /* EFI_PROD_CODE */
for (int i = 0 ; i < ETB_COUNT; i++) {
engine->etbControllers[i]->init(&etbHardware[i].dcMotor, i, &engineConfiguration->etb);
INJECT_ENGINE_REFERENCE(engine->etbControllers[i]);
}
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
engine->engineState.hasEtbPedalPositionSensor = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
if (!engine->engineState.hasEtbPedalPositionSensor) {
#if EFI_PROD_CODE
// TODO: Once switched to new sensor model for pedal, we don't need this to be test-guarded.
return;
#endif
}
engine->etbActualCount = hasSecondThrottleBody(PASS_ENGINE_PARAMETER_SIGNATURE) ? 2 : 1;
for (int i = 0 ; i < engine->etbActualCount; i++) {
auto motor = initDcMotor(i PASS_ENGINE_PARAMETER_SUFFIX);
// If this motor is actually set up, init the etb
if (motor)
{
engine->etbControllers[i]->init(motor, i, &engineConfiguration->etb);
INJECT_ENGINE_REFERENCE(engine->etbControllers[i]);
}
}
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
#if 0
// not alive code
autoTune.SetOutputStep(0.1);
@ -709,24 +593,19 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
#endif /* EFI_UNIT_TEST */
startETBPins(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_PROD_CODE
if (engineConfiguration->etbCalibrationOnStart) {
for (int i = 0 ; i < engine->etbActualCount; i++) {
EtbHardware *etb = &etbHardware[i];
etb->dcMotor.set(70);
setDcMotorDuty(i, 70);
chThdSleep(600);
// todo: grab with proper index
grabTPSIsWideOpen();
etb->dcMotor.set(-70);
setDcMotorDuty(i, -70);
chThdSleep(600);
// todo: grab with proper index
grabTPSIsClosed();
}
}
// manual duty cycle control without PID. Percent value from 0 to 100

View File

@ -61,8 +61,5 @@ void setEtbIFactor(float value);
void setEtbDFactor(float value);
void setEtbOffset(int value);
void setThrottleDutyCycle(percent_t level);
bool isETBRestartNeeded(void);
void stopETBPins(void);
void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
void unregisterEtbPins();

View File

@ -42,8 +42,10 @@
#if ! EFI_UNIT_TEST
#include "stepper.h"
#include "dc_motors.h"
#include "pin_repository.h"
static StepDirectionStepper iacStepperHw;
static DualHBridgeStepper iacHbridgeHw;
static StepperMotor iacMotor;
#endif /* EFI_UNIT_TEST */
@ -558,16 +560,35 @@ void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIG(useStepperIdle)) {
iacStepperHw.initialize(
CONFIG(idle).stepperStepPin,
CONFIG(idle).stepperDirectionPin,
CONFIG(stepperDirectionPinMode),
CONFIG(idleStepperReactionTime),
CONFIG(stepperEnablePin),
CONFIG(stepperEnablePinMode)
);
StepperHw* hw;
iacMotor.initialize(&iacStepperHw, CONFIG(idleStepperTotalSteps), logger);
if (CONFIG(useHbridges)) {
auto motorA = initDcMotor(0 PASS_ENGINE_PARAMETER_SUFFIX);
auto motorB = initDcMotor(1 PASS_ENGINE_PARAMETER_SUFFIX);
if (motorA && motorB) {
iacHbridgeHw.initialize(
motorA,
motorB,
CONFIG(idleStepperReactionTime)
);
}
hw = &iacHbridgeHw;
} else {
iacStepperHw.initialize(
CONFIG(idle).stepperStepPin,
CONFIG(idle).stepperDirectionPin,
CONFIG(stepperDirectionPinMode),
CONFIG(idleStepperReactionTime),
CONFIG(stepperEnablePin),
CONFIG(stepperEnablePinMode)
);
hw = &iacStepperHw;
}
iacMotor.initialize(hw, CONFIG(idleStepperTotalSteps), logger);
// This greatly improves PID accuracy for steppers with a small number of steps
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;

View File

@ -28,6 +28,8 @@
#include "idle_thread.h"
#include "allsensors.h"
#if EFI_ENGINE_CONTROL
EXTERN_ENGINE
;
@ -328,3 +330,4 @@ void buildTimingMap(float advanceMax DECLARE_CONFIG_PARAMETER_SUFFIX) {
}
}
#endif // EFI_ENGINE_CONTROL

View File

@ -717,6 +717,8 @@ case BMW_M73_F:
return "BMW_M73_F";
case BMW_M73_M:
return "BMW_M73_M";
case BMW_M73_MRE:
return "BMW_M73_MRE";
case BMW_M73_PROTEUS:
return "BMW_M73_P";
case MRE_BOARD_TEST:
@ -805,6 +807,8 @@ case TOYOTA_JZS147:
return "TOYOTA_JZS147";
case VAG_18_TURBO:
return "VAG_18_TURBO";
case TEST_33816:
return "TEST_33816";
case VW_B6:
return "VW_B6";
case VW_ABA:

View File

@ -243,6 +243,7 @@ void Engine::preCalculate(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif
}
#if EFI_SHAFT_POSITION_INPUT
void Engine::OnTriggerStateDecodingError() {
Engine *engine = this;
EXPAND_Engine;
@ -340,7 +341,7 @@ void Engine::OnTriggerSyncronization(bool wasSynchronized) {
}
}
#endif
void Engine::setConfig(persistent_config_s *config) {
this->config = config;
@ -487,11 +488,13 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineState.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_ENGINE_CONTROL
engine->m.beforeFuelCalc = getTimeNowLowerNt();
int rpm = GET_RPM();
ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
engine->m.fuelCalcTime = getTimeNowLowerNt() - engine->m.beforeFuelCalc;
#endif
}
void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -58,11 +58,13 @@ public:
cyclic_buffer<int> triggerErrorDetection;
#if EFI_SHAFT_POSITION_INPUT
void OnTriggerStateDecodingError();
void OnTriggerStateProperState(efitick_t nowNt) override;
void OnTriggerSyncronization(bool wasSynchronized) override;
void OnTriggerInvalidIndex(int currentIndex) override;
void OnTriggerSynchronizationLost() override;
#endif
void setConfig(persistent_config_s *config);
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -318,7 +318,9 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
/* this breaks unit tests lovely TODO: fix this?
engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE;
*/
engineConfiguration->tps1_2AdcChannel = EFI_ADC_NONE;
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
engineConfiguration->tps2_2AdcChannel = EFI_ADC_NONE;
engineConfiguration->auxFastSensor1_adcChannel = EFI_ADC_NONE;
engineConfiguration->acSwitchAdc = EFI_ADC_NONE;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
@ -667,6 +669,9 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->canWriteEnabled = true;
engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
// Don't enable, but set default address
engineConfiguration->verboseCanBaseAddress = 0x200;
engineConfiguration->sdCardPeriodMs = 50;
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
@ -708,7 +713,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setLinearCurve(engineConfiguration->fsioCurve3Bins, 0, 100, 1);
setLinearCurve(engineConfiguration->fsioCurve4Bins, 0, 100, 1);
#if EFI_ENGINE_CONTROL
setDefaultWarmupIdleCorrection(PASS_CONFIG_PARAMETER_SIGNATURE);
setDefaultWarmupFuelEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -974,8 +979,6 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->vehicleSpeedCoef = 1.0f;
engineConfiguration->logicAnalyzerMode[0] = false;
engineConfiguration->logicAnalyzerMode[1] = false;
engineConfiguration->mapErrorDetectionTooLow = 5;
engineConfiguration->mapErrorDetectionTooHigh = 250;
@ -999,7 +1002,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->tpsAccelLength = 12;
engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
#endif // EFI_ENGINE_CONTROL
#if EFI_FSIO
/**
* to test:
@ -1109,33 +1112,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
* And override them with engine-specific defaults
*/
switch (engineType) {
case DEFAULT_FRANKENSO:
case FRANKENSO_QA_ENGINE:
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_F:
setEngineBMW_M73_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_M:
setEngineBMW_M73_Manhattan(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_PROTEUS:
setEngineBMW_M73_Proteus(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NA6:
setMiataNA6_VAF_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_UNIT_TEST
case ISSUE_898:
setIssue898(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif
case MRE_MIATA_NB2_MTB:
setMiataNB2_MRE_MTB(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NB2:
setMiataNB2_MRE_ETB(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MICRO_RUS_EFI:
// todo: is it time to replace MICRO_RUS_EFI, PROTEUS, PROMETHEUS_DEFAULTS with MINIMAL_PINS? maybe rename MINIMAL_PINS to DEFAULT?
case PROTEUS:
@ -1147,7 +1123,48 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case MRE_BOARD_TEST:
mreBoardTest(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_SUPPORT_DODGE_NEON
case TEST_ENGINE:
setTestEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_UNIT_TEST
case TEST_ISSUE_366_BOTH:
setTestEngineIssue366both(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TEST_ISSUE_366_RISE:
setTestEngineIssue366rise(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case ISSUE_898:
setIssue898(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif // EFI_UNIT_TEST
#if EFI_INCLUDE_ENGINE_PRESETS
case DEFAULT_FRANKENSO:
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case FRANKENSO_QA_ENGINE:
setFrankensoBoardTestConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_F:
setEngineBMW_M73_Frankenso(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_M:
setEngineBMW_M73_Manhattan(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_MRE:
setEngineBMW_M73_microRusEfi(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case BMW_M73_PROTEUS:
setEngineBMW_M73_Proteus(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NA6:
setMiataNA6_VAF_MRE(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NB2_MTB:
setMiataNB2_MRE_MTB(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MRE_MIATA_NB2:
setMiataNB2_MRE_ETB(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case DODGE_NEON_1995:
setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1158,23 +1175,15 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case LADA_KALINA:
setLadaKalina(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_DODGE_NEON */
#if EFI_SUPPORT_FORD_ASPIRE
case FORD_ASPIRE_1996:
setFordAspireEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_FORD_ASPIRE */
#if EFI_SUPPORT_FORD_FIESTA
case FORD_FIESTA:
setFordFiestaDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_FORD_FIESTA */
#if EFI_SUPPORT_NISSAN_PRIMERA
case NISSAN_PRIMERA:
setNissanPrimeraEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif
case HONDA_ACCORD_CD:
setHondaAccordConfigurationThreeWires(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1214,11 +1223,9 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case MITSU_4G93:
setMitsubishiConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_SUPPORT_1995_FORD_INLINE_6
case FORD_INLINE_6_1995:
setFordInline6(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */
case GY6_139QMB:
setGy6139qmbDefaultEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1267,21 +1274,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case VW_ABA:
setVwAba(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#if EFI_UNIT_TEST
case TEST_ISSUE_366_BOTH:
setTestEngineIssue366both(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TEST_ISSUE_366_RISE:
setTestEngineIssue366rise(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#else
case TEST_ISSUE_366_BOTH:
case TEST_ISSUE_366_RISE:
#endif
case TEST_ENGINE:
setTestEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case MAZDA_MIATA_2003:
setMazdaMiata2003EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
@ -1315,7 +1307,10 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb
case TOYOTA_JZS147:
setToyota_jzs147EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case TEST_33816:
setTest33816EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
#endif // EFI_INCLUDE_ENGINE_PRESETS
default:
warning(CUSTOM_UNEXPECTED_ENGINE_TYPE, "Unexpected engine type: %d", engineType);
}

View File

@ -8,9 +8,7 @@
#pragma once
#include "globalaccess.h"
#include "crc.h"
#include "engine_configuration_generated_structures.h"
#include "persistent_configuration.h"
#ifndef DEFAULT_ENGINE_TYPE
#define DEFAULT_ENGINE_TYPE DEFAULT_FRANKENSO
@ -26,13 +24,6 @@
float getRpmMultiplier(operation_mode_e mode);
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
typedef struct {
int version;
int size;
persistent_config_s persistentConfiguration;
crc_t value;
} persistent_config_container_s;
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration);
void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX);
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -49,6 +49,9 @@ typedef enum {
FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // lamborghini, typical rusEfi use-case
FO_1_12_5_8_3_10_6_7_2_11_4_9 = 18, // VAG W12
// 16 cylinder
// todo: 1-14-9-4-7-12-15-6-13-8-3-16-11-2-5-10
// max used = 19
Force_4b_firing_order = ENUM_32_BITS,

View File

@ -52,7 +52,12 @@ DISPLAY_TEXT(eol);
DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(float coolantTemperature,
uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX) {
// these magic constants are in Celsius
float baseCrankingFuel = engineConfiguration->cranking.baseFuel;
float baseCrankingFuel;
if (engineConfiguration->useRunningMathForCranking) {
baseCrankingFuel = engine->engineState.running.baseFuel;
} else {
baseCrankingFuel = engineConfiguration->cranking.baseFuel;
}
/**
* Cranking fuel changes over time
*/
@ -242,7 +247,7 @@ percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
ScopePerf perf(PE::GetInjectionDuration);
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
#if EFI_SHAFT_POSITION_INPUT
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
injection_mode_e mode = isCranking ?
engineConfiguration->crankingInjectionMode :

View File

@ -0,0 +1,19 @@
/*
* @file persistent_configuration.h
*
* @date Feb 27, 2020
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "globalaccess.h"
#include "crc.h"
#include "engine_configuration_generated_structures.h"
typedef struct {
int version;
int size;
persistent_config_s persistentConfiguration;
crc_t value;
} persistent_config_container_s;

View File

@ -193,6 +193,10 @@ typedef enum {
SUBARUEJ20G_DEFAULTS = 101,
VAG_18_TURBO = 102,
TEST_33816 = 103,
BMW_M73_MRE = 104,
Force_4_bytes_size_engine_type = ENUM_32_BITS,
} engine_type_e;
@ -522,6 +526,9 @@ typedef enum {
IM_SEQUENTIAL = 1,
/**
* each cylinder has it's own injector but these injectors work in pairs. Injectors could be wired in pairs or separately.
* Each pair is fired once per engine cycle
* todo: we might want to implement one additional mode where each pair of injectors is floating twice per engine cycle.
* todo: this could reduce phase offset from injection to stroke but would not work great for large injectors
*/
IM_BATCH = 2,
/**

View File

@ -0,0 +1,21 @@
/**
* @file can.h
*
* @date Mar 19, 2020
* @author Matthew Kennedy, (c) 2020
*/
#pragma once
#include "hal.h"
#include "periodic_thread_controller.h"
class Logging;
void processCanRxMessage(const CANRxFrame& msg, Logging* logger);
class CanWrite final : public PeriodicController<512> {
public:
CanWrite();
void PeriodicTask(efitime_t nowNt) override;
};

View File

@ -0,0 +1,143 @@
/**
* @file can_dash.cpp
*
* This file handles transmission of ECU data to various OE dashboards.
*
* @date Mar 19, 2020
* @author Matthew Kennedy, (c) 2020
*/
#include "globalaccess.h"
#if EFI_CAN_SUPPORT
#include "engine.h"
#include "can.h"
#include "can_hw.h"
#include "can_dash.h"
#include "allsensors.h"
#include "vehicle_speed.h"
EXTERN_ENGINE;
// CAN Bus ID for broadcast
/**
* e46 data is from http://forums.bimmerforums.com/forum/showthread.php?1887229
*
* Same for Mini Cooper? http://vehicle-reverse-engineering.wikia.com/wiki/MINI
*
* All the below packets are using 500kb/s
*
*/
#define CAN_BMW_E46_SPEED 0x153
#define CAN_BMW_E46_RPM 0x316
#define CAN_BMW_E46_DME2 0x329
#define CAN_BMW_E46_CLUSTER_STATUS 0x613
#define CAN_BMW_E46_CLUSTER_STATUS_2 0x615
#define CAN_FIAT_MOTOR_INFO 0x561
#define CAN_MAZDA_RX_RPM_SPEED 0x201
#define CAN_MAZDA_RX_STEERING_WARNING 0x300
#define CAN_MAZDA_RX_STATUS_1 0x212
#define CAN_MAZDA_RX_STATUS_2 0x420
// https://wiki.openstreetmap.org/wiki/VW-CAN
#define CAN_VAG_RPM 0x280
#define CAN_VAG_CLT 0x288
#define CAN_VAG_CLT_V2 0x420
#define CAN_VAG_IMMO 0x3D0
extern CANTxFrame txmsg;
static void setShortValue(CANTxFrame *txmsg, int value, int offset) {
txmsg->data8[offset] = value;
txmsg->data8[offset + 1] = value >> 8;
}
void canDashboardBMW(void) {
//BMW Dashboard
commonTxInit(CAN_BMW_E46_SPEED);
setShortValue(&txmsg, 10 * 8, 1);
sendCanMessage();
commonTxInit(CAN_BMW_E46_RPM);
setShortValue(&txmsg, (int) (GET_RPM() * 6.4), 2);
sendCanMessage();
commonTxInit(CAN_BMW_E46_DME2);
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 1);
sendCanMessage();
}
void canMazdaRX8(void) {
commonTxInit(CAN_MAZDA_RX_STEERING_WARNING);
// todo: something needs to be set here? see http://rusefi.com/wiki/index.php?title=Vehicle:Mazda_Rx8_2004
sendCanMessage();
commonTxInit(CAN_MAZDA_RX_RPM_SPEED);
float kph = getVehicleSpeed();
setShortValue(&txmsg, SWAP_UINT16(GET_RPM() * 4), 0);
setShortValue(&txmsg, 0xFFFF, 2);
setShortValue(&txmsg, SWAP_UINT16((int )(100 * kph + 10000)), 4);
setShortValue(&txmsg, 0, 6);
sendCanMessage();
commonTxInit(CAN_MAZDA_RX_STATUS_1);
txmsg.data8[0] = 0xFE; //Unknown
txmsg.data8[1] = 0xFE; //Unknown
txmsg.data8[2] = 0xFE; //Unknown
txmsg.data8[3] = 0x34; //DSC OFF in combo with byte 5 Live data only seen 0x34
txmsg.data8[4] = 0x00; // B01000000; // Brake warning B00001000; //ABS warning
txmsg.data8[5] = 0x40; // TCS in combo with byte 3
txmsg.data8[6] = 0x00; // Unknown
txmsg.data8[7] = 0x00; // Unused
sendCanMessage();
commonTxInit(CAN_MAZDA_RX_STATUS_2);
txmsg.data8[0] = (uint8_t)(getCoolantTemperature() + 69); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar
txmsg.data8[1] = ((int16_t)(engine->engineState.vssEventCounter*(engineConfiguration->vehicleSpeedCoef*0.277*2.58))) & 0xff;
txmsg.data8[2] = 0x00; // unknown
txmsg.data8[3] = 0x00; //unknown
txmsg.data8[4] = 0x01; //Oil Pressure (not really a gauge)
txmsg.data8[5] = 0x00; //check engine light
txmsg.data8[6] = 0x00; //Coolant, oil and battery
if ((GET_RPM()>0) && (engine->sensors.vBatt<13)) {
setTxBit(6, 6); // battery light
}
if (getCoolantTemperature() > 105) {
setTxBit(6, 1); // coolant light, 101 - red zone, light means its get too hot
}
//oil pressure warning lamp bit is 7
txmsg.data8[7] = 0x00; //unused
sendCanMessage();
}
void canDashboardFiat(void) {
//Fiat Dashboard
commonTxInit(CAN_FIAT_MOTOR_INFO);
setShortValue(&txmsg, (int) (getCoolantTemperature() - 40), 3); //Coolant Temp
setShortValue(&txmsg, GET_RPM() / 32, 6); //RPM
sendCanMessage();
}
void canDashboardVAG(void) {
//VAG Dashboard
commonTxInit(CAN_VAG_RPM);
setShortValue(&txmsg, GET_RPM() * 4, 2); //RPM
sendCanMessage();
commonTxInit(CAN_VAG_CLT);
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 1); //Coolant Temp
sendCanMessage();
commonTxInit(CAN_VAG_CLT_V2);
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 4); //Coolant Temp
sendCanMessage();
commonTxInit(CAN_VAG_IMMO);
setShortValue(&txmsg, 0x80, 1);
sendCanMessage();
}
#endif // EFI_CAN_SUPPORT

View File

@ -0,0 +1,13 @@
/**
* @file can_dash.h
*
* @date Mar 19, 2020
* @author Matthew Kennedy, (c) 2020
*/
#pragma once
void canDashboardBMW();
void canDashboardFiat();
void canDashboardVAG();
void canMazdaRX8();

View File

@ -0,0 +1,47 @@
/**
* @file can_rx.cpp
*
* CAN reception handling. This file handles multiplexing incoming CAN frames as appropriate
* to the subsystems that consume them.
*
* @date Mar 19, 2020
* @author Matthew Kennedy, (c) 2020
*/
#include "global.h"
#if EFI_CAN_SUPPORT
#include "can.h"
#include "obd2.h"
#include "engine.h"
EXTERN_ENGINE;
static void printPacket(const CANRxFrame& rx, Logging* logger) {
// only print info if we're in can debug mode
if (CONFIG(debugMode) == DBG_CAN) {
scheduleMsg(logger, "Got CAN message: SID %x/%x %x %x %x %x %x %x %x %x", rx.SID, rx.DLC, rx.data8[0], rx.data8[1],
rx.data8[2], rx.data8[3], rx.data8[4], rx.data8[5], rx.data8[6], rx.data8[7]);
}
}
volatile float aemXSeriesLambda = 0;
volatile float canPedal = 0;
void processCanRxMessage(const CANRxFrame& frame, Logging* logger) {
// TODO: if/when we support multiple lambda sensors, sensor N
// has address 0x0180 + N where N = [0, 15]
if (frame.SID == 0x0180) {
// AEM x-series lambda sensor reports in 0.0001 lambda per bit
uint16_t lambdaInt = SWAP_UINT16(frame.data16[0]);
aemXSeriesLambda = 0.0001f * lambdaInt;
} else if (frame.EID == 0x202) {
int16_t pedalScaled = *reinterpret_cast<const uint16_t*>(&frame.data8[0]);
canPedal = pedalScaled * 0.01f;
} else {
printPacket(frame, logger);
obdOnCanPacketRx(frame);
}
}
#endif // EFI_CAN_SUPPORT

View File

@ -0,0 +1,53 @@
/**
* @file can_tx.cpp
*
* CAN transmission handling. This file handles the dispatch of various outgoing regularly scheduled CAN message types.
*
* @date Mar 19, 2020
* @author Matthew Kennedy, (c) 2020
*/
#include "globalaccess.h"
#if EFI_CAN_SUPPORT
#include "engine.h"
#include "can.h"
#include "can_hw.h"
#include "can_dash.h"
#include "obd2.h"
EXTERN_ENGINE;
CanWrite::CanWrite()
: PeriodicController("CAN TX", NORMALPRIO, 50)
{
}
void CanWrite::PeriodicTask(efitime_t nowNt) {
UNUSED(nowNt);
if (CONFIG(enableVerboseCanTx)) {
void sendCanVerbose();
sendCanVerbose();
}
// Transmit dash data, if enabled
switch (CONFIG(canNbcType)) {
case CAN_BUS_NBC_BMW:
canDashboardBMW();
break;
case CAN_BUS_NBC_FIAT:
canDashboardFiat();
break;
case CAN_BUS_NBC_VAG:
canDashboardVAG();
break;
case CAN_BUS_MAZDA_RX8:
canMazdaRX8();
break;
default:
break;
}
}
#endif // EFI_CAN_SUPPORT

Some files were not shown because too many files have changed in this diff Show More