rusefi/firmware/controllers/algo/rusefi_types.h

136 lines
3.7 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file rusefi_types.h
*
* @date Jan 12, 2015
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-07-10 06:01:56 -07:00
*/
#ifndef CONTROLLERS_ALGO_RUSEFI_TYPES_H_
#define CONTROLLERS_ALGO_RUSEFI_TYPES_H_
2018-12-08 12:51:45 -08:00
#include <string.h>
#include <stdbool.h>
2018-12-08 13:00:36 -08:00
#include <float.h>
2015-07-10 06:01:56 -07:00
#include <stdint.h>
2016-07-25 21:03:50 -07:00
#if defined __GNUC__
// GCC
2016-07-14 20:02:55 -07:00
#include <sys/types.h>
2016-07-25 21:03:50 -07:00
#else
// IAR
typedef unsigned int time_t;
#endif
2015-07-10 06:01:56 -07:00
#include "rusefi_enums.h"
2018-09-29 07:39:21 -07:00
#include "firing_order.h"
2015-07-10 06:01:56 -07:00
#include "rusefi_generated.h"
2019-06-10 12:45:18 -07:00
#define DEFAULT_FUEL_LOAD_COUNT 16
#define DEFAULT_IGN_LOAD_COUNT 16
2016-07-14 20:02:55 -07:00
// time in seconds
typedef time_t efitimesec_t;
2015-07-10 06:01:56 -07:00
/**
* integer time in milliseconds
* 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days.
* Please restart your ECU every 46 days? :)
2016-02-04 12:01:45 -08:00
* See getTimeNowUs()
2015-07-10 06:01:56 -07:00
*/
typedef uint32_t efitimems_t;
2016-07-21 20:03:53 -07:00
typedef int pid_dt;
2015-07-10 06:01:56 -07:00
/**
* We use a signed type here so that subtraction result is a proper negative value.
* A typical use-case negative result is when we do 'timeNow() - timeOfEvent' where timeOfEvent
* is actually after timeNow() due to interrupt context switches
2017-12-05 20:45:31 -08:00
*
* See getTimeNowNt()
* See US2NT
* See MS2US
2015-07-10 06:01:56 -07:00
*/
typedef int64_t efitime_t;
/**
* 64 bit time in microseconds, since boot
*/
typedef efitime_t efitimeus_t;
/**
* platform-dependent tick since boot
* in case of stm32f4 that's a CPU tick
*/
typedef efitime_t efitick_t;
typedef float angle_t;
2019-06-19 18:24:09 -07:00
// temperature, in Celsius
typedef float temperature_t;
2015-07-10 06:01:56 -07:00
typedef float floatms_t;
typedef float floatus_t;
/**
* numeric value from 0 to 100
*/
typedef float percent_t;
typedef void (*Void)(void);
typedef char le_formula_t[LE_COMMAND_LENGTH];
typedef brain_pin_e egt_cs_array_t[EGT_CHANNEL_COUNT];
2016-07-01 20:01:22 -07:00
typedef uint8_t afr_table_t[FUEL_LOAD_COUNT][FUEL_RPM_COUNT];
2015-10-20 10:02:30 -07:00
// todo: merge these two types together? but these tables have different TS parameters like ranges etc
2015-07-10 06:01:56 -07:00
typedef float fuel_table_t[FUEL_LOAD_COUNT][FUEL_RPM_COUNT];
typedef float ignition_table_t[IGN_LOAD_COUNT][IGN_RPM_COUNT];
typedef int16_t ignition_tps_table_t[IGN_LOAD_COUNT][IGN_RPM_COUNT];
typedef uint8_t pedal_to_tps_t[PEDAL_TO_TPS_SIZE][PEDAL_TO_TPS_SIZE];
2019-10-30 06:27:12 -07:00
typedef uint8_t iac_pid_mult_t[IAC_PID_MULT_SIZE][IAC_PID_MULT_SIZE];
2015-07-10 06:01:56 -07:00
typedef float baro_corr_table_t[BARO_CORR_SIZE][BARO_CORR_SIZE];
2016-07-01 20:01:22 -07:00
typedef float fsio_table_8x8_f32t[FSIO_TABLE_8][FSIO_TABLE_8];
typedef uint8_t fsio_table_8x8_u8t[FSIO_TABLE_8][FSIO_TABLE_8];
2016-03-08 20:01:53 -08:00
typedef float tps_tps_table_t[TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE];
typedef uint8_t fsio_table_8x8_u8t[FSIO_TABLE_8][FSIO_TABLE_8];
2016-03-08 20:01:53 -08:00
2016-03-03 19:03:55 -08:00
2016-03-01 21:02:17 -08:00
// this is different type simply to have different hi/low range in rusefi.ini
typedef ignition_table_t angle_table_t;
2015-07-10 06:01:56 -07:00
typedef int cylinders_count_t;
typedef int32_t bool32_t;
typedef int16_t fsio_pwm_freq_t;
typedef float fsio_setting_t;
2017-03-11 17:15:27 -08:00
typedef float cfg_float_t_1f;
2015-07-10 06:01:56 -07:00
typedef brain_pin_e brain_input_pin_e;
2019-06-07 14:38:12 -07:00
typedef brain_pin_e switch_input_pin_e;
2015-07-10 06:01:56 -07:00
typedef fuel_table_t ve_table_t;
typedef void (*VoidPtr)(void*);
typedef void (*VoidInt)(int);
typedef void (*VoidIntVoidPtr)(int, void*);
typedef void (*VoidFloat)(float);
typedef void (*VoidFloatFloat)(float, float);
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
typedef void (*VoidIntInt)(int, int);
typedef void (*VoidIntIntVoidPtr)(int, int, void*);
typedef void (*VoidIntFloat)(int, float);
2015-07-10 06:01:56 -07:00
typedef void (*VoidCharPtr)(const char *);
typedef void (*VoidCharPtrVoidPtr)(const char *, void*);
typedef void (*VoidCharPtrCharPtr)(const char *, const char *);
typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *);
typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *);
#endif /* CONTROLLERS_ALGO_RUSEFI_TYPES_H_ */