2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file fsio_impl.h
|
|
|
|
* @brief FSIO as it's used for GPIO
|
|
|
|
*
|
|
|
|
* @date Oct 5, 2014
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2019-12-15 20:33:15 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#include "fsio_core.h"
|
|
|
|
#include "engine.h"
|
2016-04-04 07:01:43 -07:00
|
|
|
#include "table_helper.h"
|
2017-01-19 14:04:15 -08:00
|
|
|
#include "system_fsio.h"
|
2016-04-04 07:01:43 -07:00
|
|
|
|
2019-09-12 04:31:13 -07:00
|
|
|
// see useFSIO12ForIdleOffset
|
|
|
|
#define MAGIC_OFFSET_FOR_IDLE_OFFSET 12
|
|
|
|
// see useFSIO13ForIdleMinValue
|
|
|
|
#define MAGIC_OFFSET_FOR_IDLE_MIN_VALUE 13
|
|
|
|
|
2019-06-10 09:38:32 -07:00
|
|
|
typedef Map3D<FSIO_TABLE_8, FSIO_TABLE_8, float, float> fsio8_Map3D_f32t;
|
|
|
|
typedef Map3D<FSIO_TABLE_8, FSIO_TABLE_8, uint8_t, float> fsio8_Map3D_u8t;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-01-19 19:09:37 -08:00
|
|
|
#define MAGIC_OFFSET_FOR_ENGINE_WARNING 4
|
|
|
|
#define MAGIC_OFFSET_FOR_CRITICAL_ENGINE 5
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2017-06-04 12:25:37 -07:00
|
|
|
float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2019-08-14 22:59:15 -07:00
|
|
|
/**
|
|
|
|
* set_fsio_output_pin 7 PE3
|
|
|
|
* set_rpn_expression 1 "rpm 0 fsio_setting <"
|
|
|
|
*/
|
2019-05-03 15:41:43 -07:00
|
|
|
void setFsio(int index, brain_pin_e pin, const char * exp DECLARE_CONFIG_PARAMETER_SUFFIX);
|
|
|
|
void setFsioExt(int index, brain_pin_e pin, const char * exp, int pwmFrequency DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2017-05-15 20:33:22 -07:00
|
|
|
void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2017-12-16 21:03:26 -08:00
|
|
|
void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2019-09-18 18:48:46 -07:00
|
|
|
void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2017-12-16 21:03:26 -08:00
|
|
|
float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2017-05-15 20:33:22 -07:00
|
|
|
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2018-02-03 08:42:50 -08:00
|
|
|
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2019-11-25 17:08:01 -08:00
|
|
|
void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-07-12 05:31:38 -07:00
|
|
|
ValueProvider3D *getFSIOTable(int index);
|
|
|
|
|