auto-sync

This commit is contained in:
rusEfi 2014-12-27 15:03:38 -06:00
parent 5177b7c832
commit 2bc129176e
19 changed files with 1135 additions and 1218 deletions

View File

@ -20,7 +20,7 @@
#include "engine_configuration.h"
#include "thermistors.h"
#include "engine_math.h"
#include "le_functions.h"
#include "fsio_impl.h"
#if EFI_PROD_CODE
#include "HIP9011.h"
#endif
@ -357,7 +357,8 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
/**
* set_fsio_setting 0 0.11
*/
// todo setFsio(engineConfiguration, 0, GPIOE_5, "");
engineConfiguration->bc.fsio_setting[0] = 0.2;
setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400);
// engineConfiguration->isCanEnabled = true;
boardConfiguration->canTxPin = GPIOB_6;

View File

@ -12,13 +12,11 @@
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "fsio_impl.h"
#include "mazda_miata.h"
#include "engine_math.h"
#include "advance_map.h"
#include "allsensors.h"
#include "le_functions.h"
// setFrankenso_01_LCD
#include "honda_accord.h"
static const fuel_table_t miata_maf_fuel_table = { {/*0 engineLoad=1.2*//*0 800.0*/1.53, /*1 1213.0*/0.92, /*2 1626.0*/

View File

@ -9,9 +9,9 @@
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "fsio_impl.h"
#include "mitsubishi.h"
#include "allsensors.h"
#include "le_functions.h"
void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
engineConfiguration->engineType = MITSU_4G93;

View File

@ -22,17 +22,12 @@
#include "main.h"
#include "engine_configuration.h"
#include "fsio_impl.h"
#include "allsensors.h"
#include "interpolation.h"
#include "trigger_decoder.h"
#include "engine_math.h"
#include "speed_density.h"
#include "logic_expression.h"
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
#endif
#include "audi_aan.h"
#include "bmw_e34.h"
#include "dodge_neon.h"
@ -54,6 +49,10 @@
#include "subaru.h"
#include "test_engine.h"
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
#endif
//#define TS_DEFAULT_SPEED 115200
#define TS_DEFAULT_SPEED 38400
@ -683,7 +682,7 @@ void applyNonPersistentConfiguration(Logging * logger, Engine *engine) {
return;
}
engine->engineCycleEventCount = engine->triggerShape.getLength();
parseUserFsio(PASS_ENGINE_PARAMETER_F);
applyFsioConfiguration(PASS_ENGINE_PARAMETER_F);
}
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)

View File

@ -3,6 +3,6 @@ CONTROLLERS_CORE_SRC = $(PROJECT_DIR)/controllers/core/avg_values.c
CONTROLLERS_CORE_SRC_CPP = $(PROJECT_DIR)/controllers/core/EfiWave.cpp \
$(PROJECT_DIR)/controllers/core/table_helper.cpp \
$(PROJECT_DIR)/controllers/core/logic_expression.cpp \
$(PROJECT_DIR)/controllers/core/fsio_core.cpp \
$(PROJECT_DIR)/controllers/core/interpolation.cpp \
$(PROJECT_DIR)/controllers/core/le_functions.cpp
$(PROJECT_DIR)/controllers/core/fsio_impl.cpp

View File

@ -9,6 +9,8 @@
#ifndef FL_STACK_H_
#define FL_STACK_H_
#include "error_handling.h"
template<typename T, int MAXSIZE>
class FLStack {
public:

View File

@ -1,6 +1,6 @@
/**
* @file logic_expression.cpp
* @brief Logical expressions handling logic
* @file fsio_core.cpp
* @brief core FSUI handling logic
*
* Here we parse and evaluate logical expressions in
* http://en.wikipedia.org/wiki/Reverse_Polish_notation
@ -17,8 +17,8 @@
#if EFI_FSIO || defined(__DOXYGEN__)
#include "logic_expression.h"
#include "le_functions.h"
#include "fsio_core.h"
#include "fsio_impl.h"
LENameOrdinalPair * LE_FIRST = NULL;
@ -47,26 +47,6 @@ static LENameOrdinalPair leMax(LE_METHOD_MAX, "max");
static LENameOrdinalPair leMin(LE_METHOD_MIN, "min");
static LENameOrdinalPair leIf(LE_METHOD_IF, "if");
#define LE_EVAL_POOL_SIZE 32
#if EFI_PROD_CODE || EFI_SIMULATOR
static Logging logger;
#endif
static LECalculator evalCalc;
static LEElement evalPoolElements[LE_EVAL_POOL_SIZE];
static LEElementPool evalPool(evalPoolElements, LE_EVAL_POOL_SIZE);
#define SYS_ELEMENT_POOL_SIZE 128
#define UD_ELEMENT_POOL_SIZE 128
static LEElement sysElements[SYS_ELEMENT_POOL_SIZE];
LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE);
static LEElement userElements[UD_ELEMENT_POOL_SIZE];
LEElementPool userPool(userElements, UD_ELEMENT_POOL_SIZE);
LEElement * fsioLogics[LE_COMMAND_COUNT] CCM_OPTIONAL;
LENameOrdinalPair::LENameOrdinalPair(le_action_e action, const char *name) {
this->action = action;
this->name = name;
@ -385,45 +365,4 @@ LEElement *LEElementPool::parseExpression(const char * line) {
return first;
}
EXTERN_ENGINE;
void parseUserFsio(DECLARE_ENGINE_PARAMETER_F) {
board_configuration_s * boardConfiguration = &engineConfiguration->bc;
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e brainPin = boardConfiguration->fsioPins[i];
if (brainPin != GPIO_UNASSIGNED) {
const char *formula = boardConfiguration->le_formulas[i];
LEElement *logic = userPool.parseExpression(formula);
if (logic == NULL) {
warning(OBD_PCM_Processor_Fault, "parsing [%s]", formula);
}
fsioLogics[i] = logic;
}
}
}
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
static void eval(char *line, Engine *engine) {
line = unquote(line);
scheduleMsg(&logger, "Parsing [%s]", line);
evalPool.reset();
LEElement * e = evalPool.parseExpression(line);
if (e == NULL) {
scheduleMsg(&logger, "parsing failed");
} else {
float result = evalCalc.getValue2(e, engine);
scheduleMsg(&logger, "Eval result: %f", result);
}
}
void initEval(Engine *engine) {
initLogging(&logger, "le");
addConsoleActionSP("eval", (VoidCharPtrVoidPtr) eval, engine);
}
#endif
#endif /* EFI_FSIO */

View File

@ -1,5 +1,5 @@
/**
* @file logic_expression.h
* @file fsio_core.h
*
* @date Oct 3, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
@ -112,7 +112,5 @@ public:
const char *getNextToken(const char *line, char *buffer);
bool isNumeric(const char* line);
le_action_e parseAction(const char * line);
void initEval(Engine *engine);
void parseUserFsio(DECLARE_ENGINE_PARAMETER_F);
#endif /* LOGIC_EXPRESSION_H_ */

View File

@ -0,0 +1,340 @@
/**
* @file fsio_impl.cpp
* @brief FSIO as it's used for GPIO
*
* @date Oct 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "main.h"
#if EFI_FSIO || defined(__DOXYGEN__)
#include "fsio_impl.h"
#include "allsensors.h"
#include "rpm_calculator.h"
#include "efiGpio.h"
#include "pin_repository.h"
#include "pwm_generator.h"
// todo: that's about bench test mode, wrong header for sure!
#include "injector_central.h"
/**
* Here we define all rusEfi-specific methods
*/
static LENameOrdinalPair leRpm(LE_METHOD_RPM, "rpm");
static LENameOrdinalPair leTps(LE_METHOD_TPS, "tps");
static LENameOrdinalPair leMaf(LE_METHOD_MAF, "maf");
static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt");
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
static LENameOrdinalPair leFsioSsetting(LE_METHOD_FSIO_SETTING, "fsio_setting");
#define LE_EVAL_POOL_SIZE 32
#if EFI_PROD_CODE || EFI_SIMULATOR
static Logging logger;
#endif
static LECalculator evalCalc;
static LEElement evalPoolElements[LE_EVAL_POOL_SIZE];
static LEElementPool evalPool(evalPoolElements, LE_EVAL_POOL_SIZE);
#define SYS_ELEMENT_POOL_SIZE 128
#define UD_ELEMENT_POOL_SIZE 128
static LEElement sysElements[SYS_ELEMENT_POOL_SIZE];
LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE);
static LEElement userElements[UD_ELEMENT_POOL_SIZE];
LEElementPool userPool(userElements, UD_ELEMENT_POOL_SIZE);
static LEElement * fsioLogics[LE_COMMAND_COUNT] CCM_OPTIONAL;
static LEElement * acRelayLogic;
static LEElement * fuelPumpLogic;
static LEElement * radiatorFanLogic;
static LEElement * alternatorLogic;
void setFsioExt(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp, int freq) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
boardConfiguration->fsioPins[index] = pin;
strcpy(boardConfiguration->le_formulas[index], exp);
boardConfiguration->fsioFrequency[index] = freq;
}
void setFsio(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp) {
setFsioExt(engineConfiguration, index, pin, exp, 0);
}
EXTERN_ENGINE;
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_F) {
board_configuration_s * boardConfiguration = &engineConfiguration->bc;
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e brainPin = boardConfiguration->fsioPins[i];
if (brainPin != GPIO_UNASSIGNED) {
const char *formula = boardConfiguration->le_formulas[i];
LEElement *logic = userPool.parseExpression(formula);
if (logic == NULL) {
warning(OBD_PCM_Processor_Fault, "parsing [%s]", formula);
}
fsioLogics[i] = logic;
}
}
}
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
static SimplePwm fsioPwm[LE_COMMAND_COUNT] CCM_OPTIONAL;
static LECalculator calc;
extern LEElement * fsioLogics[LE_COMMAND_COUNT];
static void handleFsio(Engine *engine, int index) {
if (boardConfiguration->fsioPins[index] == GPIO_UNASSIGNED)
return;
bool_t isPwmMode = boardConfiguration->fsioFrequency[index] != 0;
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + index);
float fvalue = calc.getValue2(fsioLogics[index], engine);
engine->engineConfiguration2->fsioLastValue[index] = fvalue;
if (isPwmMode) {
fsioPwm[index].setSimplePwmDutyCycle(fvalue);
} else {
int value = (int) fvalue;
if (value != getOutputPinValue(pin)) {
// scheduleMsg(&logger, "setting %s %s", getIo_pin_e(pin), boolToString(value));
setOutputPinValue(pin, value);
}
}
}
static void setPinState(io_pin_e ioPin, LEElement *element, Engine *engine) {
if (element == NULL) {
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", getIo_pin_e(ioPin));
} else {
int value = calc.getValue2(element, engine);
if (value != getOutputPinValue(ioPin)) {
if (isRunningBenchTest())
return; // let's not mess with bench testing
scheduleMsg(&logger, "setting %s %s", getIo_pin_e(ioPin), boolToString(value));
setOutputPinValue(ioPin, value);
}
}
}
static void showFsio(const char *msg, LEElement *element) {
if (msg != NULL)
scheduleMsg(&logger, "%s:", msg);
while (element != NULL) {
scheduleMsg(&logger, "action %d: fValue=%f iValue=%d", element->action, element->fValue, element->iValue);
element = element->next;
}
scheduleMsg(&logger, "<end>");
}
static void showFsioInfo(void) {
scheduleMsg(&logger, "sys used %d/user used %d", sysPool.getSize(), userPool.getSize());
showFsio("a/c", acRelayLogic);
showFsio("fuel", fuelPumpLogic);
showFsio("fan", radiatorFanLogic);
showFsio("alt", alternatorLogic);
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
char * exp = boardConfiguration->le_formulas[i];
if (exp[0] != 0) {
/**
* in case of FSIO user interface indexes are starting with 0, the argument for that
* is the fact that the target audience is more software developers
*/
scheduleMsg(&logger, "FSIO #%d [%s] at %s@%dHz value=%f", i, exp,
hwPortname(boardConfiguration->fsioPins[i]), boardConfiguration->fsioFrequency[i],
engineConfiguration2->fsioLastValue[i]);
// scheduleMsg(&logger, "user-defined #%d value=%f", i, engine->engineConfiguration2->fsioLastValue[i]);
showFsio(NULL, fsioLogics[i]);
}
}
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
float v = boardConfiguration->fsio_setting[i];
if (!cisnan(v)) {
scheduleMsg(&logger, "user property #%d: %f", i + 1, v);
}
}
}
/**
* set_fsio_setting 0 0.11
*/
static void setFsioSetting(float indexF, float value) {
int index = indexF;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
engineConfiguration->bc.fsio_setting[index] = value;
showFsioInfo();
}
static void setFsioFrequency(int index, int frequency) {
index--;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
boardConfiguration->fsioFrequency[index] = frequency;
scheduleMsg(&logger, "Setting FSIO frequency %d on #%d", frequency, index + 1);
}
static void setFsioPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
brain_pin_e pin = parseBrainPin(pinName);
// todo: extract method - code duplication with other 'set_xxx_pin' methods?
if (pin == GPIO_INVALID) {
scheduleMsg(&logger, "invalid pin name [%s]", pinName);
return;
}
boardConfiguration->fsioPins[index] = pin;
scheduleMsg(&logger, "FSIO pin #%d [%s]", (index + 1), hwPortname(pin));
}
static void setUserOutput(const char *indexStr, const char *quotedLine, Engine *engine) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
char * l = unquote((char*) quotedLine);
if (strlen(l) > LE_COMMAND_LENGTH - 1) {
scheduleMsg(&logger, "Too long %d", strlen(l));
return;
}
scheduleMsg(&logger, "setting user out #%d to [%s]", index + 1, l);
strcpy(engine->engineConfiguration->bc.le_formulas[index], l);
// this would apply the changes
applyFsioConfiguration(PASS_ENGINE_PARAMETER_F);
showFsioInfo();
}
static void eval(char *line, Engine *engine) {
line = unquote(line);
scheduleMsg(&logger, "Parsing [%s]", line);
evalPool.reset();
LEElement * e = evalPool.parseExpression(line);
if (e == NULL) {
scheduleMsg(&logger, "parsing failed");
} else {
float result = evalCalc.getValue2(e, engine);
scheduleMsg(&logger, "Eval result: %f", result);
}
}
float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
efiAssert(engine!=NULL, "getLEValue", NAN);
switch (action) {
case LE_METHOD_FAN:
return getOutputPinValue(FAN_RELAY);
case LE_METHOD_AC_TOGGLE:
return getAcToggle(engine);
case LE_METHOD_COOLANT:
return getCoolantTemperature(engine);
case LE_METHOD_INTAKE_AIR:
return getIntakeAirTemperature(engine);
case LE_METHOD_RPM:
return engine->rpmCalculator.rpm();
case LE_METHOD_TIME_SINCE_BOOT:
return getTimeNowSeconds();
case LE_METHOD_FAN_OFF_SETTING:
return engine->engineConfiguration->fanOffTemperature;
case LE_METHOD_FAN_ON_SETTING:
return engine->engineConfiguration->fanOnTemperature;
case LE_METHOD_VBATT:
return getVBatt(engine->engineConfiguration);
default:
firmwareError("FSIO unexpected %d", action);
return NAN;
}
}
void runFsio(void) {
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
handleFsio(engine, i);
}
#if EFI_FUEL_PUMP
if (boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED && engineConfiguration->isFuelPumpEnabled) {
setPinState(FUEL_PUMP_RELAY, fuelPumpLogic, engine);
}
#endif
if (boardConfiguration->acRelayPin != GPIO_UNASSIGNED) {
setPinState(AC_RELAY, acRelayLogic, engine);
}
if (boardConfiguration->alternatorControlPin != GPIO_UNASSIGNED) {
setPinState(ALTERNATOR_SWITCH, alternatorLogic, engine);
}
if (boardConfiguration->fanPin != GPIO_UNASSIGNED) {
// setPinState(FAN_RELAY, radiatorFanLogic, engine);
}
}
static pin_output_mode_e defa = OM_DEFAULT;
void initFsioImpl(Engine *engine) {
initLogging(&logger, "le");
#if EFI_FUEL_PUMP
fuelPumpLogic = sysPool.parseExpression(FUEL_PUMP_LOGIC);
#endif
acRelayLogic = sysPool.parseExpression(AC_RELAY_LOGIC);
radiatorFanLogic = sysPool.parseExpression(FAN_CONTROL_LOGIC);
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e brainPin = boardConfiguration->fsioPins[i];
if (brainPin != GPIO_UNASSIGNED) {
//mySetPadMode2("user-defined", boardConfiguration->gpioPins[i], PAL_STM32_MODE_OUTPUT);
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + i);
int frequency = boardConfiguration->fsioFrequency[i];
if (frequency == 0) {
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->fsioPins[i], &defa);
} else {
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, pin, frequency, 0.5f, applyPinState);
}
}
}
addConsoleActionSSP("set_fsio", (VoidCharPtrCharPtrVoidPtr) setUserOutput, engine);
addConsoleActionSS("set_fsio_pin", (VoidCharPtrCharPtr) setFsioPin);
addConsoleActionII("set_fsio_frequency", (VoidIntInt) setFsioFrequency);
addConsoleActionFF("set_fsio_setting", setFsioSetting);
addConsoleAction("fsioinfo", showFsioInfo);
addConsoleActionSP("eval", (VoidCharPtrVoidPtr) eval, engine);
}
#endif
#endif /* EFI_FSIO */

View File

@ -1,5 +1,6 @@
/**
* @file le_functions.h
* @file fsio_impl.h
* @brief FSIO as it's used for GPIO
*
* @date Oct 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
@ -8,8 +9,8 @@
#ifndef LE_FUNCTIONS_H_
#define LE_FUNCTIONS_H_
#include "fsio_core.h"
#include "engine.h"
#include "logic_expression.h"
/**
* In human language that's
@ -32,4 +33,8 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action);
void setFsio(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp);
void setFsioExt(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp, int freq);
void initFsioImpl(Engine *engine);
void runFsio(void);
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_F);
#endif /* LE_FUNCTIONS_H_ */

View File

@ -1,75 +0,0 @@
/**
* @file le_functions.cpp
*
* @date Oct 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "main.h"
#if EFI_FSIO || defined(__DOXYGEN__)
#include "le_functions.h"
#include "allsensors.h"
#include "rpm_calculator.h"
#include "efiGpio.h"
//extern LENameOrdinalPair * LE_FIRST;
/**
* Here we define all rusEfi-specific methods
*/
static LENameOrdinalPair leRpm(LE_METHOD_RPM, "rpm");
static LENameOrdinalPair leTps(LE_METHOD_TPS, "tps");
static LENameOrdinalPair leMaf(LE_METHOD_MAF, "maf");
static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt");
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
static LENameOrdinalPair leFsioSsetting(LE_METHOD_FSIO_SETTING, "fsio_setting");
#if EFI_PROD_CODE || EFI_SIMULATOR
float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
efiAssert(engine!=NULL, "getLEValue", NAN);
switch (action) {
case LE_METHOD_FAN:
return getOutputPinValue(FAN_RELAY);
case LE_METHOD_AC_TOGGLE:
return getAcToggle(engine);
case LE_METHOD_COOLANT:
return getCoolantTemperature(engine);
case LE_METHOD_INTAKE_AIR:
return getIntakeAirTemperature(engine);
case LE_METHOD_RPM:
return engine->rpmCalculator.rpm();
case LE_METHOD_TIME_SINCE_BOOT:
return getTimeNowSeconds();
case LE_METHOD_FAN_OFF_SETTING:
return engine->engineConfiguration->fanOffTemperature;
case LE_METHOD_FAN_ON_SETTING:
return engine->engineConfiguration->fanOnTemperature;
case LE_METHOD_VBATT:
return getVBatt(engine->engineConfiguration);
default:
firmwareError("FSIO unexpected %d", action);
return NAN;
}
}
#endif
void setFsioExt(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp, int freq) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
boardConfiguration->fsioPins[index] = pin;
strcpy(boardConfiguration->le_formulas[index], exp);
boardConfiguration->fsioFrequency[index] = freq;
}
void setFsio(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp) {
setFsioExt(engineConfiguration, index, pin, exp, 0);
}
#endif /* EFI_FSIO */

View File

@ -22,8 +22,11 @@
*/
#include "main.h"
#include "engine_configuration.h"
#include "trigger_central.h"
#include "engine_controller.h"
#include "fsio_core.h"
#include "fsio_impl.h"
#include "idle_thread.h"
#include "rpm_calculator.h"
#include "signal_executor.h"
@ -35,7 +38,6 @@
#include "injector_central.h"
#include "ignition_central.h"
#include "rfiutil.h"
#include "engine_configuration.h"
#include "engine_math.h"
#include "wave_analyzer.h"
#include "allsensors.h"
@ -52,23 +54,13 @@
#include "ec2.h"
#include "PwmTester.h"
#include "engine.h"
#include "logic_expression.h"
#include "le_functions.h"
#include "pin_repository.h"
#include "pwm_generator.h"
static LEElement * acRelayLogic;
static LEElement * fuelPumpLogic;
static LEElement * radiatorFanLogic;
static LEElement * alternatorLogic;
extern OutputPin outputs[IO_PIN_COUNT];
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
extern bool hasFirmwareErrorFlag;
extern LEElementPool sysPool;
extern LEElementPool userPool;
persistent_config_container_s persistentState CCM_OPTIONAL;
/**
@ -194,144 +186,6 @@ static void cylinderCleanupControl(Engine *engine) {
}
}
#if EFI_FSIO
static SimplePwm fsioPwm[LE_COMMAND_COUNT] CCM_OPTIONAL;
static LECalculator calc;
extern LEElement * fsioLogics[LE_COMMAND_COUNT];
static void handleFsio(Engine *engine, int index) {
if (boardConfiguration->fsioPins[index] == GPIO_UNASSIGNED)
return;
bool_t isPwmMode = boardConfiguration->fsioFrequency[index] != 0;
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + index);
float fvalue = calc.getValue2(fsioLogics[index], engine);
engine->engineConfiguration2->fsioLastValue[index] = fvalue;
if (isPwmMode) {
fsioPwm[index].setSimplePwmDutyCycle(fvalue);
} else {
int value = (int) fvalue;
if (value != getOutputPinValue(pin)) {
// scheduleMsg(&logger, "setting %s %s", getIo_pin_e(pin), boolToString(value));
setOutputPinValue(pin, value);
}
}
}
static void setPinState(io_pin_e ioPin, LEElement *element, Engine *engine) {
if (element == NULL) {
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", getIo_pin_e(ioPin));
} else {
int value = calc.getValue2(element, engine);
if (value != getOutputPinValue(ioPin)) {
if (isRunningBenchTest())
return; // let's not mess with bench testing
scheduleMsg(&logger, "setting %s %s", getIo_pin_e(ioPin), boolToString(value));
setOutputPinValue(ioPin, value);
}
}
}
static void showFsio(const char *msg, LEElement *element) {
if (msg != NULL)
scheduleMsg(&logger, "%s:", msg);
while (element != NULL) {
scheduleMsg(&logger, "action %d: fValue=%f iValue=%d", element->action, element->fValue, element->iValue);
element = element->next;
}
scheduleMsg(&logger, "<end>");
}
static void showFsioInfo(void) {
scheduleMsg(&logger, "sys used %d/user used %d", sysPool.getSize(), userPool.getSize());
showFsio("a/c", acRelayLogic);
showFsio("fuel", fuelPumpLogic);
showFsio("fan", radiatorFanLogic);
showFsio("alt", alternatorLogic);
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
char * exp = boardConfiguration->le_formulas[i];
if (exp[0] != 0) {
/**
* in case of FSIO user interface indexes are starting with 0, the argument for that
* is the fact that the target audience is more software developers
*/
scheduleMsg(&logger, "FSIO #%d [%s] at %s@%dHz value=%f", i, exp,
hwPortname(boardConfiguration->fsioPins[i]), boardConfiguration->fsioFrequency[i],
engineConfiguration2->fsioLastValue[i]);
// scheduleMsg(&logger, "user-defined #%d value=%f", i, engine->engineConfiguration2->fsioLastValue[i]);
showFsio(NULL, fsioLogics[i]);
}
}
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
float v = boardConfiguration->fsio_setting[i];
if (!cisnan(v)) {
scheduleMsg(&logger, "user property #%d: %f", i + 1, v);
}
}
}
static void setFsioSetting(float indexF, float value) {
int index = indexF;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
engineConfiguration->bc.fsio_setting[index] = value;
showFsioInfo();
}
static void setFsioFrequency(int index, int frequency) {
index--;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
boardConfiguration->fsioFrequency[index] = frequency;
scheduleMsg(&logger, "Setting FSIO frequency %d on #%d", frequency, index + 1);
}
static void setFsioPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
brain_pin_e pin = parseBrainPin(pinName);
// todo: extract method - code duplication with other 'set_xxx_pin' methods?
if (pin == GPIO_INVALID) {
scheduleMsg(&logger, "invalid pin name [%s]", pinName);
return;
}
boardConfiguration->fsioPins[index] = pin;
scheduleMsg(&logger, "FSIO pin #%d [%s]", (index + 1), hwPortname(pin));
}
static void setUserOutput(const char *indexStr, const char *quotedLine, Engine *engine) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= LE_COMMAND_COUNT) {
scheduleMsg(&logger, "invalid index %d", index);
return;
}
char * l = unquote((char*) quotedLine);
if (strlen(l) > LE_COMMAND_LENGTH - 1) {
scheduleMsg(&logger, "Too long %d", strlen(l));
return;
}
scheduleMsg(&logger, "setting user out #%d to [%s]", index + 1, l);
strcpy(engine->engineConfiguration->bc.le_formulas[index], l);
// this would apply the changes
parseUserFsio(PASS_ENGINE_PARAMETER_F);
showFsioInfo();
}
#endif /* EFI_FSIO */
static void onEvenyGeneralMilliseconds(Engine *engine) {
/**
* We need to push current value into the 64 bit counter often enough so that we do not miss an overflow
@ -348,30 +202,8 @@ static void onEvenyGeneralMilliseconds(Engine *engine) {
engine->watchdog();
engine->updateSlowSensors();
#if EFI_FSIO
runFsio();
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
handleFsio(engine, i);
}
#if EFI_FUEL_PUMP
if (boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED && engineConfiguration->isFuelPumpEnabled) {
setPinState(FUEL_PUMP_RELAY, fuelPumpLogic, engine);
}
#endif
if (boardConfiguration->acRelayPin != GPIO_UNASSIGNED) {
setPinState(AC_RELAY, acRelayLogic, engine);
}
if (boardConfiguration->alternatorControlPin != GPIO_UNASSIGNED) {
setPinState(ALTERNATOR_SWITCH, alternatorLogic, engine);
}
if (boardConfiguration->fanPin != GPIO_UNASSIGNED) {
// setPinState(FAN_RELAY, radiatorFanLogic, engine);
}
#endif
updateErrorCodes();
@ -474,8 +306,6 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
scheduleMsg(&logger, "setting float @%d to %f", offset, value);
}
static pin_output_mode_e d = OM_DEFAULT;
void initEngineContoller(Engine *engine) {
if (hasFirmwareError()) {
return;
@ -565,46 +395,12 @@ void initEngineContoller(Engine *engine) {
}
#endif
#if EFI_FUEL_PUMP
fuelPumpLogic = sysPool.parseExpression(FUEL_PUMP_LOGIC);
#endif
acRelayLogic = sysPool.parseExpression(AC_RELAY_LOGIC);
radiatorFanLogic = sysPool.parseExpression(FAN_CONTROL_LOGIC);
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
addConsoleAction("analoginfo", printAnalogInfo);
#if EFI_FSIO
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
brain_pin_e brainPin = boardConfiguration->fsioPins[i];
if (brainPin != GPIO_UNASSIGNED) {
//mySetPadMode2("user-defined", boardConfiguration->gpioPins[i], PAL_STM32_MODE_OUTPUT);
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + i);
int frequency = boardConfiguration->fsioFrequency[i];
if (frequency == 0) {
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->fsioPins[i], &d);
} else {
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, pin, frequency, 0.5f, applyPinState);
}
}
}
addConsoleActionSSP("set_fsio", (VoidCharPtrCharPtrVoidPtr) setUserOutput, engine);
addConsoleActionSS("set_fsio_pin", (VoidCharPtrCharPtr) setFsioPin);
addConsoleActionII("set_fsio_frequency", (VoidIntInt) setFsioFrequency);
addConsoleActionFF("set_fsio_setting", setFsioSetting);
addConsoleAction("fsioinfo", showFsioInfo);
#endif
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
addConsoleActionII("set_int", (VoidIntInt) setInt);
addConsoleActionI("get_float", getFloat);
addConsoleActionI("get_int", getInt);
initEval(engine);
initFsioImpl(engine);
}

View File

@ -265,5 +265,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20141226;
return 20141227;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -1,4 +1,4 @@
Cmp-Mod V01 Created by CvPcb (22-Jun-2014 BZR 4027)-stable date = Чт. 25 дек. 2014 14:44:43
Cmp-Mod V01 Created by CvPcb (22-Jun-2014 BZR 4027)-stable date = Сб. 27 дек. 2014 20:57:53
BeginCmp
TimeStamp = /549BD2BA;
@ -133,13 +133,6 @@ ValeurCmp = CONN_20;
IdModule = PIN_ARRAY_20X1;
EndCmp
BeginCmp
TimeStamp = /549BE47C;
Reference = Q1;
ValeurCmp = DTA114E;
IdModule = SOT323;
EndCmp
BeginCmp
TimeStamp = /549BD29D;
Reference = R1;
@ -211,9 +204,9 @@ IdModule = lqfp48;
EndCmp
BeginCmp
TimeStamp = /549BE1BB;
TimeStamp = /549EE660;
Reference = U2;
ValeurCmp = STF202;
ValeurCmp = NUF2101MT1G;
IdModule = SOT-457;
EndCmp

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
(export (version D)
(design
(source /home/rox/Art_Electro/MY_PROJ/mini48-stm32/mini48-stm32.sch)
(date "Сб. 27 дек. 2014 12:16:03")
(source /home/rox/Art_Electro/RUSEFI/SVN-rusefi/mini48-stm32/mini48-stm32.sch)
(date "Сб. 27 дек. 2014 20:56:42")
(tool "eeschema (22-Jun-2014 BZR 4027)-stable"))
(components
(comp (ref X1)
@ -155,16 +155,6 @@
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 549BDC77))
(comp (ref U2)
(value STF202)
(libsource (lib art-electro-ic) (part STF202))
(sheetpath (names /) (tstamps /))
(tstamp 549BE1BB))
(comp (ref Q1)
(value DTA114E)
(libsource (lib transistors) (part DTA114E))
(sheetpath (names /) (tstamps /))
(tstamp 549BE47C))
(comp (ref P1)
(value CONN_20)
(libsource (lib conn) (part CONN_20))
@ -174,7 +164,12 @@
(value CONN_20)
(libsource (lib conn) (part CONN_20))
(sheetpath (names /) (tstamps /))
(tstamp 549BE7DA)))
(tstamp 549BE7DA))
(comp (ref U2)
(value NUF2101MT1G)
(libsource (lib art-electro-ic) (part NUF2101MT1G))
(sheetpath (names /) (tstamps /))
(tstamp 549EE660)))
(libparts
(libpart (lib device) (part C)
(description "Condensateur non polarise")
@ -251,6 +246,32 @@
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))))
(libpart (lib conn) (part CONN_20)
(description "Symbole general de connexion")
(fields
(field (name Reference) P)
(field (name Value) CONN_20))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name P2) (type passive))
(pin (num 3) (name P3) (type passive))
(pin (num 4) (name P4) (type passive))
(pin (num 5) (name P5) (type passive))
(pin (num 6) (name P6) (type passive))
(pin (num 7) (name P7) (type passive))
(pin (num 8) (name P8) (type passive))
(pin (num 9) (name P9) (type passive))
(pin (num 10) (name P10) (type passive))
(pin (num 11) (name P11) (type passive))
(pin (num 12) (name P12) (type passive))
(pin (num 13) (name P13) (type passive))
(pin (num 14) (name P14) (type passive))
(pin (num 15) (name P15) (type passive))
(pin (num 16) (name P16) (type passive))
(pin (num 17) (name P17) (type passive))
(pin (num 18) (name P18) (type passive))
(pin (num 19) (name P19) (type passive))
(pin (num 20) (name P20) (type passive))))
(libpart (lib art-electro-stm32) (part STM32F103C8)
(description "STM8S105C4(C6), 8-bit microcontroller, 16MHz, 16(32)KB Flash, 2KB RAM, VQFP48")
(footprints
@ -309,50 +330,24 @@
(pin (num 46) (name PB9) (type BiDi))
(pin (num 47) (name VSS_3) (type power_in))
(pin (num 48) (name VDD_3) (type power_in))))
(libpart (lib conn) (part CONN_20)
(description "Symbole general de connexion")
(fields
(field (name Reference) P)
(field (name Value) CONN_20))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name P2) (type passive))
(pin (num 3) (name P3) (type passive))
(pin (num 4) (name P4) (type passive))
(pin (num 5) (name P5) (type passive))
(pin (num 6) (name P6) (type passive))
(pin (num 7) (name P7) (type passive))
(pin (num 8) (name P8) (type passive))
(pin (num 9) (name P9) (type passive))
(pin (num 10) (name P10) (type passive))
(pin (num 11) (name P11) (type passive))
(pin (num 12) (name P12) (type passive))
(pin (num 13) (name P13) (type passive))
(pin (num 14) (name P14) (type passive))
(pin (num 15) (name P15) (type passive))
(pin (num 16) (name P16) (type passive))
(pin (num 17) (name P17) (type passive))
(pin (num 18) (name P18) (type passive))
(pin (num 19) (name P19) (type passive))
(pin (num 20) (name P20) (type passive))))
(libpart (lib art-electro-ic) (part STF202)
(description "USB Filter with ESD Protection")
(libpart (lib art-electro-ic) (part NUF2101MT1G)
(description "EMI Filter and line termination for USB upstream")
(footprints
(fp SOT*))
(fields
(field (name Reference) U)
(field (name Value) STF202)
(field (name Value) NUF2101MT1G)
(field (name Footprint) ~)
(field (name Datasheet) ~))
(pins
(pin (num 1) (name Vbus) (type power_in))
(pin (num 2) (name D+) (type input))
(pin (num 3) (name D-) (type input))
(pin (num 4) (name DP) (type output))
(pin (num 5) (name DM) (type output))
(pin (num 6) (name GND) (type power_in))))
(pin (num 1) (name D+out) (type output))
(pin (num 2) (name GND) (type power_in))
(pin (num 3) (name D-out) (type output))
(pin (num 4) (name D-) (type input))
(pin (num 5) (name Vbus) (type power_in))
(pin (num 6) (name D+) (type input))))
(libpart (lib art-electro-power) (part LM2937)
(description "Voltage Regulators 3.3v 0.5A SOT 223/263")
(description "Voltage Regulators 3.3v SOT 223/263")
(footprints
(fp SOT223)
(fp TO263))
@ -366,18 +361,6 @@
(pin (num 2) (name GND) (type passive))
(pin (num 3) (name Vout) (type power_out))
(pin (num 4) (name ~) (type passive))))
(libpart (lib transistors) (part DTA114E)
(description "DTA114E, Digital Transistor, 10k/10k, SOT23")
(footprints
(fp SOT23*)
(fp SC59*))
(fields
(field (name Reference) Q)
(field (name Value) DTA114E))
(pins
(pin (num 1) (name B) (type input))
(pin (num 2) (name E) (type passive))
(pin (num 3) (name C) (type passive))))
(libpart (lib art-electro-conn) (part LED_0805)
(footprints
(fp LED-0805*))
@ -390,7 +373,6 @@
(pin (num 1) (name A) (type passive))
(pin (num 2) (name K) (type passive))))
(libpart (lib art-electro-conn) (part MINI-USB)
(description "MINI USB")
(footprints
(fp MINI-USB*))
(fields
@ -410,230 +392,223 @@
(uri /usr/share/kicad/library/device.lib))
(library (logical conn)
(uri /usr/share/kicad/library/conn.lib))
(library (logical art-electro-ic)
(uri ../art_el_lib/art-electro-ic.lib))
(library (logical art-electro-stm32)
(uri ../art_el_lib/art-electro-stm32.lib))
(uri ../rusefi_lib/art-electro-stm32.lib))
(library (logical art-electro-power)
(uri ../art_el_lib/art-electro-power.lib))
(library (logical transistors)
(uri /usr/share/kicad/library/transistors.lib))
(uri ../rusefi_lib/art-electro-power.lib))
(library (logical art-electro-ic)
(uri ../rusefi_lib/art-electro-ic.lib))
(library (logical art-electro-conn)
(uri ../art_el_lib/art-electro-conn.lib)))
(uri ../rusefi_lib/art-electro-conn.lib)))
(nets
(net (code 1) (name /23_USBDP)
(node (ref P2) (pin 12))
(node (ref U2) (pin 5))
(node (ref U1) (pin 33)))
(net (code 2) (name GND)
(net (code 1) (name GND)
(node (ref C11) (pin 2))
(node (ref C10) (pin 2))
(node (ref C9) (pin 2))
(node (ref C6) (pin 1))
(node (ref U2) (pin 2))
(node (ref D4) (pin 2))
(node (ref J1) (pin 5))
(node (ref D1) (pin 2))
(node (ref U1) (pin 8))
(node (ref C3) (pin 1))
(node (ref P2) (pin 2))
(node (ref U1) (pin 35))
(node (ref R6) (pin 1))
(node (ref SW1) (pin 1))
(node (ref U1) (pin 47))
(node (ref C4) (pin 1))
(node (ref U1) (pin 35))
(node (ref U1) (pin 23))
(node (ref R6) (pin 1))
(node (ref C5) (pin 1))
(node (ref C9) (pin 2))
(node (ref C3) (pin 1))
(node (ref C4) (pin 1))
(node (ref U1) (pin 8))
(node (ref C7) (pin 2))
(node (ref C2) (pin 1))
(node (ref C8) (pin 2))
(node (ref C12) (pin 2))
(node (ref C1) (pin 1))
(node (ref R2) (pin 2))
(node (ref U3) (pin 4))
(node (ref U2) (pin 6))
(node (ref U3) (pin 2))
(node (ref P1) (pin 2)))
(net (code 3) (name "")
(node (ref C12) (pin 1))
(node (ref D3) (pin 2))
(node (ref U3) (pin 4))
(node (ref P1) (pin 2))
(node (ref R2) (pin 2))
(node (ref C12) (pin 2)))
(net (code 2) (name "")
(node (ref U3) (pin 1))
(node (ref D2) (pin 2)))
(net (code 4) (name /D+)
(node (ref U2) (pin 2))
(node (ref J1) (pin 3)))
(net (code 5) (name /D-)
(node (ref U2) (pin 3))
(node (ref D2) (pin 2))
(node (ref D3) (pin 2))
(node (ref C12) (pin 1)))
(net (code 3) (name /D+)
(node (ref J1) (pin 3))
(node (ref U2) (pin 6)))
(net (code 4) (name /D-)
(node (ref U2) (pin 4))
(node (ref J1) (pin 2)))
(net (code 6) (name /24_USBDM)
(node (ref P2) (pin 13))
(node (ref U1) (pin 32))
(node (ref U2) (pin 4)))
(net (code 7) (name /+5v)
(node (ref D3) (pin 1))
(net (code 5) (name /+5v)
(node (ref R3) (pin 1))
(node (ref D3) (pin 1))
(node (ref U2) (pin 5))
(node (ref J1) (pin 1)))
(net (code 8) (name /VCC)
(node (ref U3) (pin 3))
(node (ref C11) (pin 1))
(node (ref U1) (pin 48))
(node (ref C10) (pin 1))
(node (ref P2) (pin 1))
(node (ref R5) (pin 2))
(node (ref U1) (pin 24))
(node (ref U1) (pin 36))
(node (ref C7) (pin 1))
(node (ref Q1) (pin 2))
(node (ref C8) (pin 1))
(node (ref P1) (pin 1))
(node (ref C9) (pin 1))
(node (ref U1) (pin 9))
(node (ref R1) (pin 2)))
(net (code 9) (name /VIN)
(node (ref P1) (pin 20))
(node (ref D2) (pin 1)))
(net (code 10) (name /Reset)
(node (ref U1) (pin 7))
(node (ref SW1) (pin 2))
(node (ref R1) (pin 1))
(node (ref P1) (pin 7))
(node (ref C6) (pin 2)))
(net (code 11) (name "")
(node (ref P1) (pin 6)))
(net (code 12) (name "")
(node (ref P1) (pin 5)))
(net (code 13) (name /14)
(node (ref U1) (pin 2))
(node (ref P1) (pin 4)))
(net (code 14) (name /DISK)
(node (ref Q1) (pin 1))
(node (ref U1) (pin 46)))
(net (code 15) (name "")
(net (code 6) (name /23_USBDP)
(node (ref U2) (pin 1))
(node (ref Q1) (pin 3)))
(net (code 16) (name "")
(node (ref U1) (pin 33))
(node (ref P2) (pin 12)))
(net (code 7) (name /VCC)
(node (ref P2) (pin 1))
(node (ref U1) (pin 24))
(node (ref U1) (pin 48))
(node (ref U1) (pin 9))
(node (ref R5) (pin 2))
(node (ref C8) (pin 1))
(node (ref C9) (pin 1))
(node (ref C7) (pin 1))
(node (ref R1) (pin 2))
(node (ref U3) (pin 3))
(node (ref U1) (pin 36))
(node (ref C10) (pin 1))
(node (ref P1) (pin 1))
(node (ref C11) (pin 1)))
(net (code 8) (name /VIN)
(node (ref D2) (pin 1))
(node (ref P1) (pin 20)))
(net (code 9) (name /14)
(node (ref P1) (pin 4))
(node (ref U1) (pin 2)))
(net (code 10) (name /35)
(node (ref U1) (pin 46))
(node (ref P1) (pin 6)))
(net (code 11) (name "")
(node (ref P1) (pin 5)))
(net (code 12) (name /VBAT)
(node (ref P1) (pin 3))
(node (ref U1) (pin 1)))
(net (code 13) (name "")
(node (ref D1) (pin 1))
(node (ref R3) (pin 2)))
(net (code 17) (name "")
(net (code 14) (name "")
(node (ref J1) (pin 4)))
(net (code 15) (name "")
(node (ref SW2) (pin 1))
(node (ref R5) (pin 1)))
(net (code 16) (name /BOOT0)
(node (ref U1) (pin 44))
(node (ref P2) (pin 3))
(node (ref SW2) (pin 2))
(node (ref R4) (pin 2))
(node (ref R6) (pin 2)))
(net (code 17) (name /24_USBDM)
(node (ref P2) (pin 13))
(node (ref U2) (pin 3))
(node (ref U1) (pin 32)))
(net (code 18) (name /33)
(node (ref U1) (pin 19))
(node (ref R7) (pin 1)))
(net (code 19) (name "")
(node (ref R7) (pin 2))
(node (ref D4) (pin 1)))
(net (code 20) (name "")
(node (ref R2) (pin 1))
(node (ref C1) (pin 2))
(node (ref J1) (pin 6)))
(net (code 18) (name "")
(node (ref J1) (pin 4)))
(net (code 19) (name "")
(node (ref R5) (pin 1))
(node (ref SW2) (pin 1)))
(net (code 20) (name /BOOT0)
(node (ref P2) (pin 3))
(node (ref R4) (pin 2))
(node (ref SW2) (pin 2))
(node (ref R6) (pin 2))
(node (ref U1) (pin 44)))
(net (code 21) (name /33)
(node (ref U1) (pin 19))
(node (ref R7) (pin 1)))
(net (code 22) (name "")
(node (ref D4) (pin 1))
(node (ref R7) (pin 2)))
(net (code 23) (name /11)
(node (ref U1) (pin 10))
(node (ref P1) (pin 8)))
(net (code 24) (name /18)
(node (ref P2) (pin 7))
(node (ref U1) (pin 40)))
(net (code 25) (name /31)
(node (ref U1) (pin 25))
(node (ref P2) (pin 20)))
(net (code 26) (name /30)
(node (ref P2) (pin 19))
(node (ref U1) (pin 26)))
(net (code 27) (name /29)
(node (ref U1) (pin 27))
(node (ref P2) (pin 18)))
(net (code 28) (name /28)
(node (ref U1) (pin 28))
(node (ref P2) (pin 17)))
(net (code 29) (name /27)
(node (ref P2) (pin 16))
(node (ref U1) (pin 29)))
(net (code 30) (name /26)
(node (ref P2) (pin 15))
(node (ref U1) (pin 30)))
(net (code 31) (name /25)
(node (ref P2) (pin 14))
(node (ref U1) (pin 31)))
(net (code 32) (name /22)
(node (ref U1) (pin 34))
(node (ref P2) (pin 11)))
(net (code 33) (name /21)
(node (ref P2) (pin 10))
(node (ref U1) (pin 37)))
(net (code 34) (name /20)
(node (ref U1) (pin 38))
(node (ref P2) (pin 9)))
(net (code 35) (name /19)
(node (ref P2) (pin 8))
(node (ref U1) (pin 39)))
(net (code 36) (name /17)
(node (ref U1) (pin 41))
(node (ref P2) (pin 6)))
(net (code 37) (name /16)
(node (ref P2) (pin 5))
(node (ref U1) (pin 42)))
(net (code 38) (name /15)
(node (ref P2) (pin 4))
(node (ref U1) (pin 43)))
(net (code 39) (name /0)
(node (ref U1) (pin 22))
(node (ref P1) (pin 19)))
(net (code 40) (name /1)
(node (ref P1) (pin 18))
(node (ref U1) (pin 21)))
(net (code 41) (name /2)
(node (ref U1) (pin 20))
(node (ref P1) (pin 17)))
(net (code 42) (name /3)
(net (code 21) (name /29)
(node (ref P2) (pin 18))
(node (ref U1) (pin 27)))
(net (code 22) (name /2)
(node (ref P1) (pin 17))
(node (ref U1) (pin 20)))
(net (code 23) (name /3)
(node (ref P1) (pin 16))
(node (ref U1) (pin 18)))
(net (code 43) (name /4)
(node (ref P1) (pin 15))
(node (ref U1) (pin 17)))
(net (code 44) (name /5)
(net (code 24) (name /4)
(node (ref U1) (pin 17))
(node (ref P1) (pin 15)))
(net (code 25) (name /5)
(node (ref P1) (pin 14))
(node (ref U1) (pin 16)))
(net (code 45) (name /6)
(net (code 26) (name /6)
(node (ref U1) (pin 15))
(node (ref P1) (pin 13)))
(net (code 46) (name /7)
(node (ref P1) (pin 12))
(node (ref U1) (pin 14)))
(net (code 47) (name /8)
(net (code 27) (name /7)
(node (ref U1) (pin 14))
(node (ref P1) (pin 12)))
(net (code 28) (name /8)
(node (ref U1) (pin 13))
(node (ref P1) (pin 11)))
(net (code 48) (name /9)
(net (code 29) (name /9)
(node (ref U1) (pin 12))
(node (ref P1) (pin 10)))
(net (code 49) (name /10)
(net (code 30) (name /10)
(node (ref U1) (pin 11))
(node (ref P1) (pin 9)))
(net (code 50) (name /VBAT)
(node (ref U1) (pin 1))
(node (ref P1) (pin 3)))
(net (code 51) (name /OSC32_OUT)
(net (code 31) (name /11)
(node (ref U1) (pin 10))
(node (ref P1) (pin 8)))
(net (code 32) (name /Reset)
(node (ref U1) (pin 7))
(node (ref R1) (pin 1))
(node (ref P1) (pin 7))
(node (ref SW1) (pin 2))
(node (ref C6) (pin 2)))
(net (code 33) (name /31)
(node (ref P2) (pin 20))
(node (ref U1) (pin 25)))
(net (code 34) (name /30)
(node (ref U1) (pin 26))
(node (ref P2) (pin 19)))
(net (code 35) (name /1)
(node (ref U1) (pin 21))
(node (ref P1) (pin 18)))
(net (code 36) (name /28)
(node (ref P2) (pin 17))
(node (ref U1) (pin 28)))
(net (code 37) (name /27)
(node (ref U1) (pin 29))
(node (ref P2) (pin 16)))
(net (code 38) (name /26)
(node (ref P2) (pin 15))
(node (ref U1) (pin 30)))
(net (code 39) (name /25)
(node (ref P2) (pin 14))
(node (ref U1) (pin 31)))
(net (code 40) (name /22)
(node (ref P2) (pin 11))
(node (ref U1) (pin 34)))
(net (code 41) (name /21)
(node (ref P2) (pin 10))
(node (ref U1) (pin 37)))
(net (code 42) (name /20)
(node (ref U1) (pin 38))
(node (ref P2) (pin 9)))
(net (code 43) (name /19)
(node (ref P2) (pin 8))
(node (ref U1) (pin 39)))
(net (code 44) (name /18)
(node (ref P2) (pin 7))
(node (ref U1) (pin 40)))
(net (code 45) (name /17)
(node (ref U1) (pin 41))
(node (ref P2) (pin 6)))
(net (code 46) (name /16)
(node (ref U1) (pin 42))
(node (ref P2) (pin 5)))
(net (code 47) (name /0)
(node (ref U1) (pin 22))
(node (ref P1) (pin 19)))
(net (code 48) (name /15)
(node (ref U1) (pin 43))
(node (ref P2) (pin 4)))
(net (code 49) (name /OSC32_OUT)
(node (ref U1) (pin 4))
(node (ref X2) (pin 1))
(node (ref C4) (pin 2)))
(net (code 52) (name /OSC32_IN)
(node (ref X2) (pin 2))
(net (code 50) (name /OSC32_IN)
(node (ref C5) (pin 2))
(node (ref X2) (pin 2))
(node (ref U1) (pin 3)))
(net (code 53) (name "")
(net (code 51) (name "")
(node (ref X1) (pin 2))
(node (ref C3) (pin 2))
(node (ref U1) (pin 6)))
(net (code 54) (name "")
(net (code 52) (name "")
(node (ref U1) (pin 5))
(node (ref C2) (pin 2))
(node (ref X1) (pin 1)))
(net (code 55) (name "")
(net (code 53) (name "")
(node (ref U1) (pin 45))
(node (ref R4) (pin 1)))))

View File

@ -17,10 +17,10 @@ $Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "Maplemini fork"
Date "25 dec 2014"
Date "27 dec 2014"
Rev ""
Comp "Art_Electro"
Comment1 "v1.0"
Comment1 "v1.2"
Comment2 "Art_Electro"
Comment3 ""
Comment4 ""
@ -422,7 +422,7 @@ Text Label 4425 2350 0 60 ~ 0
Text Label 4425 2450 0 60 ~ 0
15
Text Label 4425 2650 0 60 ~ 0
DISK
35
Text Label 4425 2850 0 60 ~ 0
0
Text Label 4425 2950 0 60 ~ 0
@ -757,9 +757,9 @@ F 3 "~" H 1100 6250 60 0000 C CNN
1 1100 6250
1 0 0 -1
$EndComp
Text Label 4925 7300 0 60 ~ 0
Text Label 4925 6800 0 60 ~ 0
24_USBDM
Text Label 4925 7050 0 60 ~ 0
Text Label 4925 7300 0 60 ~ 0
23_USBDP
$Comp
L GND #PWR020
@ -882,12 +882,12 @@ $EndComp
$Comp
L GND #PWR026
U 1 1 549BD32C
P 4775 6800
F 0 "#PWR026" H 4775 6800 30 0001 C CNN
F 1 "GND" H 4775 6730 30 0001 C CNN
F 2 "" H 4775 6800 60 0001 C CNN
F 3 "" H 4775 6800 60 0001 C CNN
1 4775 6800
P 4925 7050
F 0 "#PWR026" H 4925 7050 30 0001 C CNN
F 1 "GND" H 4925 6980 30 0001 C CNN
F 2 "" H 4925 7050 60 0001 C CNN
F 3 "" H 4925 7050 60 0001 C CNN
1 4925 7050
0 -1 -1 0
$EndComp
Wire Wire Line
@ -911,9 +911,9 @@ F 3 "" H 5450 4800 60 0000 C CNN
$EndComp
Text Notes 6675 4650 0 60 ~ 0
3.3v
Text Label 3375 7050 2 60 ~ 0
Text Label 3225 7300 2 60 ~ 0
D+
Text Label 3375 7300 2 60 ~ 0
Text Label 3225 6800 2 60 ~ 0
D-
Text Notes 8900 6650 0 60 ~ 0
diodes schottky 20V 1A SD0805S020S1R0
@ -964,38 +964,8 @@ Wire Wire Line
Wire Wire Line
5650 4800 5925 4800
Connection ~ 5750 4800
$Comp
L STF202 U2
U 1 1 549BE1BB
P 4075 7050
F 0 "U2" H 4175 7450 70 0000 C CNN
F 1 "STF202" H 4075 6650 70 0000 C CNN
F 2 "~" H 4075 7050 60 0000 C CNN
F 3 "~" H 4075 7050 60 0000 C CNN
1 4075 7050
1 0 0 -1
$EndComp
$Comp
L DTA114E Q1
U 1 1 549BE47C
P 3125 6600
F 0 "Q1" H 3070 6440 40 0000 R CNN
F 1 "DTA114E" H 3125 6750 40 0000 R CNN
F 2 "" H 3125 6600 60 0000 C CNN
F 3 "" H 3125 6600 60 0000 C CNN
1 3125 6600
1 0 0 1
$EndComp
Wire Wire Line
3225 6800 3375 6800
Wire Wire Line
3225 6400 3225 6325
Wire Wire Line
2875 6600 2675 6600
Text Label 3225 6325 0 60 ~ 0
VCC
Text Label 2675 6600 2 60 ~ 0
DISK
$Comp
L CONN_20 P1
U 1 1 549BE7CD
@ -1137,7 +1107,6 @@ Wire Wire Line
Wire Wire Line
8375 3175 8250 3175
NoConn ~ 7125 1675
NoConn ~ 7125 1775
Text Label 7250 1875 0 60 ~ 0
Reset
Text Label 7250 1975 0 60 ~ 0
@ -1194,4 +1163,27 @@ Wire Wire Line
7250 3075 7125 3075
Wire Wire Line
7250 3175 7125 3175
Text Label 7250 1775 0 60 ~ 0
35
Wire Wire Line
7125 1775 7250 1775
Text Label 3225 7050 2 60 ~ 0
+5v
$Comp
L NUF2101MT1G U2
U 1 1 549EE660
P 4075 7050
F 0 "U2" H 4175 7450 70 0000 C CNN
F 1 "NUF2101MT1G" H 4075 6650 70 0000 C CNN
F 2 "~" H 4075 7050 60 0000 C CNN
F 3 "~" H 4075 7050 60 0000 C CNN
1 4075 7050
-1 0 0 1
$EndComp
Wire Wire Line
3375 7050 3225 7050
Wire Wire Line
3375 7300 3225 7300
Wire Wire Line
4775 6800 4925 6800
$EndSCHEMATC

View File

@ -9,10 +9,8 @@
#include "main.h"
#include "test_logic_expression.h"
#include "logic_expression.h"
#include "le_functions.h"
#include "fsio_impl.h"
#include "cli_registry.h"
#include "engine.h"
#define TEST_POOL_SIZE 256