2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file rusefi_types.h
|
|
|
|
*
|
|
|
|
* @date Jan 12, 2015
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
2019-12-02 07:03:50 -08:00
|
|
|
|
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
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
|
|
|
|
|
2020-05-21 21:00:16 -07:00
|
|
|
#include "rusefi_generated.h"
|
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
|
|
|
|
2021-11-05 18:55:33 -07:00
|
|
|
#if __cplusplus
|
|
|
|
#include "scaled_channel.h"
|
|
|
|
#endif
|
|
|
|
|
2019-06-10 12:45:18 -07:00
|
|
|
#define DEFAULT_FUEL_LOAD_COUNT 16
|
|
|
|
#define DEFAULT_IGN_LOAD_COUNT 16
|
|
|
|
|
2021-11-06 21:03:16 -07:00
|
|
|
#define TWO_STROKE_CYCLE_DURATION 360
|
|
|
|
#define FOUR_STROKE_CYCLE_DURATION 720
|
|
|
|
|
2021-05-19 23:36:55 -07:00
|
|
|
// gasoline E0
|
|
|
|
#define STOICH_RATIO 14.7f
|
|
|
|
|
2016-07-14 20:02:55 -07:00
|
|
|
// time in seconds
|
|
|
|
typedef time_t efitimesec_t;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
/**
|
2019-12-21 18:11:09 -08:00
|
|
|
* integer time in milliseconds (1/1_000 of a second)
|
2015-07-10 06:01:56 -07:00
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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()
|
2019-08-18 12:53:38 -07:00
|
|
|
* See US2NT
|
|
|
|
* See MS2US
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
typedef int64_t efitime_t;
|
|
|
|
|
|
|
|
/**
|
2019-12-21 18:11:09 -08:00
|
|
|
* 64 bit time in microseconds (1/1_000_000 of a second), since boot
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
typedef efitime_t efitimeus_t;
|
|
|
|
|
2019-12-21 18:11:09 -08:00
|
|
|
/**
|
|
|
|
* 64 bit time in milliseconds (1/1_000 of a second), since boot
|
|
|
|
*/
|
|
|
|
typedef efitime_t efitimems64_t;
|
|
|
|
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2021-05-18 10:58:39 -07:00
|
|
|
typedef char lua_script_t[LUA_SCRIPT_SIZE];
|
|
|
|
|
2020-04-19 18:42:00 -07:00
|
|
|
typedef char error_message_t[ERROR_BUFFER_SIZE];
|
2020-03-28 17:14:17 -07:00
|
|
|
|
2020-05-06 11:00:08 -07:00
|
|
|
typedef char vehicle_info_t[VEHICLE_INFO_SIZE];
|
2020-05-05 12:47:14 -07:00
|
|
|
|
2021-09-26 20:36:08 -07:00
|
|
|
typedef char gppwm_note_t[GPPWM_NOTE_SIZE];
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
typedef char le_formula_t[LE_COMMAND_LENGTH];
|
|
|
|
|
|
|
|
typedef brain_pin_e egt_cs_array_t[EGT_CHANNEL_COUNT];
|
|
|
|
|
2016-03-01 21:02:17 -08:00
|
|
|
|
2021-11-14 07:39:47 -08:00
|
|
|
typedef int16_t pwm_freq_t;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2021-11-14 11:14:43 -08:00
|
|
|
typedef float script_setting_t;
|
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 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*);
|
2019-09-21 11:33:38 -07:00
|
|
|
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 *);
|