rusefi/firmware/controllers/algo/rusefi_types.h

95 lines
2.0 KiB
C
Raw Normal View History

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-14 20:02:55 -07:00
#include <sys/types.h>
2016-07-25 21:03:50 -07:00
2023-08-30 18:35:30 -07:00
#include <rusefi/rusefi_time_types.h>
#include "generated_lookup_meta.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
#if __cplusplus
#include "efi_scaled_channel.h"
#endif
2019-06-10 12:45:18 -07:00
#define DEFAULT_FUEL_LOAD_COUNT 16
2023-09-18 11:19:58 -07:00
#define DEFAULT_FUEL_RPM_COUNT 16
2019-06-10 12:45:18 -07:00
#define DEFAULT_IGN_LOAD_COUNT 16
2023-09-18 11:19:58 -07:00
#define DEFAULT_IGN_RPM_COUNT 16
2019-06-10 12:45:18 -07:00
2021-11-06 21:03:16 -07:00
#define TWO_STROKE_CYCLE_DURATION 360
#define FOUR_STROKE_CYCLE_DURATION 720
// gasoline E0
#define STOICH_RATIO 14.7f
#define CONST_PI 3.14159265358979323846
2022-01-14 18:18:51 -08:00
2015-07-10 06:01:56 -07:00
/**
* integer time in milliseconds (1/1_000 of a second)
* 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 23(or46?) days.
* Please restart your ECU every 23(or46?) days? :) See issue https://github.com/rusefi/rusefi/issues/4554 tag#4554
* See getTimeNowUs()
2015-07-10 06:01:56 -07:00
*/
using efitimems_t = uint32_t;
2015-07-10 06:01:56 -07:00
2022-11-21 00:43:30 -08:00
// date-time struct a la ctime struct tm
typedef struct {
2023-11-04 21:47:11 -07:00
uint32_t year = 0;
2022-11-21 00:43:30 -08:00
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
// uint16_t millisecond;
} efidatetime_t;
using angle_t = float;
2015-07-10 06:01:56 -07:00
using engineSyncCam_e = uint8_t;
2021-12-26 09:33:32 -08:00
// mass in grams
using mass_t = float;
2021-12-26 09:33:32 -08:00
2019-06-19 18:24:09 -07:00
// temperature, in Celsius
using temperature_t = float;
using floatms_t = float;
using floatus_t = float;
2015-07-10 06:01:56 -07:00
/**
* numeric value from 0 to 100
*/
using percent_t = float;
2015-07-10 06:01:56 -07:00
using lua_script_t = char[LUA_SCRIPT_SIZE];
2023-03-16 12:53:30 -07:00
using warning_message_t = char[WARNING_BUFFER_SIZE];
2020-03-28 17:14:17 -07:00
using vehicle_info_t = char[VEHICLE_INFO_SIZE];
2020-05-05 12:47:14 -07:00
using vin_number_t = char[VIN_NUMBER_SIZE];
using gppwm_note_t = char[GPPWM_NOTE_SIZE];
using brain_pin_e = Gpio;
using egt_cs_array_t = brain_pin_e[EGT_CHANNEL_COUNT];
2015-07-10 06:01:56 -07:00
using pwm_freq_t = int16_t;
2016-03-01 21:02:17 -08:00
using script_setting_t = float;
2015-07-10 06:01:56 -07:00
using brain_input_pin_e = brain_pin_e;
using switch_input_pin_e = brain_pin_e;
using sent_input_pin_e = brain_pin_e;
using output_pin_e = brain_pin_e;