2020-09-07 08:28:51 -07:00
|
|
|
/*
|
|
|
|
* @file config/boards/kinetis/rusefi_hw_enums.h
|
|
|
|
*
|
|
|
|
* @date Jun 2, 2019
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
|
|
* @author andreika <prometheus.pcb@gmail.com>
|
|
|
|
*/
|
|
|
|
|
2020-09-21 03:10:25 -07:00
|
|
|
#pragma once
|
2020-09-07 08:28:51 -07:00
|
|
|
|
|
|
|
// todo: migrate/unify with pin_output_mode_e? rename? something is messy here
|
|
|
|
// this enum is currently only used for SPI pins
|
|
|
|
typedef enum __attribute__ ((__packed__)) {
|
|
|
|
// todo: here we have a rare example of stm32-specific enum, todo: make this not stm32 specific?
|
|
|
|
PO_DEFAULT = 0,
|
|
|
|
PO_OPENDRAIN = 4, // PAL_STM32_OTYPE_OPENDRAIN
|
|
|
|
PO_PULLUP = 32, // PAL_STM32_PUDR_PULLUP
|
|
|
|
PO_PULLDOWN = 64 // PAL_STM32_PUPDR_PULLDOWN
|
|
|
|
} pin_mode_e;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hardware pin. This enum is platform-specific.
|
|
|
|
*/
|
|
|
|
typedef enum __attribute__ ((__packed__)) {
|
|
|
|
GPIO_UNASSIGNED = 0,
|
|
|
|
GPIO_INVALID = 1,
|
|
|
|
|
|
|
|
GPIOA_0 = 2,
|
|
|
|
GPIOA_1 = 3,
|
|
|
|
GPIOA_2 = 4,
|
|
|
|
GPIOA_3 = 5,
|
|
|
|
GPIOA_4 = 6,
|
|
|
|
GPIOA_5 = 7,
|
|
|
|
GPIOA_6 = 8,
|
|
|
|
GPIOA_7 = 9,
|
|
|
|
GPIOA_8 = 10,
|
|
|
|
GPIOA_9 = 11,
|
|
|
|
GPIOA_10 = 12,
|
|
|
|
GPIOA_11 = 13,
|
|
|
|
GPIOA_12 = 14,
|
|
|
|
GPIOA_13 = 15,
|
|
|
|
GPIOA_14 = 16,
|
|
|
|
GPIOA_15 = 17,
|
|
|
|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OJ_14 = 160,
|
|
|
|
GPIOJ_15 = 161,
|
|
|
|
|
|
|
|
GPIOK_0 = 162,
|
|
|
|
GPIOK_1 = 163,
|
|
|
|
GPIOK_2 = 164,
|
|
|
|
GPIOK_3 = 165,
|
|
|
|
GPIOK_4 = 166,
|
|
|
|
GPIOK_5 = 167,
|
|
|
|
GPIOK_6 = 168,
|
|
|
|
GPIOK_7 = 169,
|
|
|
|
GPIOK_8 = 170,
|
|
|
|
GPIOK_9 = 171,
|
|
|
|
GPIOK_10 = 172,
|
|
|
|
GPIOK_11 = 173,
|
|
|
|
GPIOK_12 = 174,
|
|
|
|
GPIOK_13 = 175,
|
|
|
|
GPIOK_14 = 176,
|
|
|
|
GPIOK_15 = 177,
|
|
|
|
|
|
|
|
// DRV8860 pins go right after on chips
|
|
|
|
//#define DRV8860_PIN(n) ((brain_pin_e)((int)BRAIN_PIN_LAST_ONCHIP + 1 + (n)))
|
|
|
|
DRV8860_PIN_1 = 178,
|
|
|
|
DRV8860_PIN_2 = 179,
|
|
|
|
DRV8860_PIN_3 = 180,
|
|
|
|
DRV8860_PIN_4 = 181,
|
|
|
|
DRV8860_PIN_5 = 182,
|
|
|
|
DRV8860_PIN_6 = 183,
|
|
|
|
DRV8860_PIN_7 = 184,
|
|
|
|
DRV8860_PIN_8 = 185,
|
|
|
|
DRV8860_PIN_9 = 186,
|
|
|
|
DRV8860_PIN_10 = 187,
|
|
|
|
DRV8860_PIN_11 = 188,
|
|
|
|
DRV8860_PIN_12 = 189,
|
|
|
|
DRV8860_PIN_13 = 190,
|
|
|
|
DRV8860_PIN_14 = 191,
|
|
|
|
DRV8860_PIN_15 = 192,
|
|
|
|
DRV8860_PIN_16 = 193,
|
|
|
|
|
|
|
|
} brain_pin_e;
|
|
|
|
|
|
|
|
/* Plase keep updating this define */
|
|
|
|
#define BRAIN_PIN_LAST_ONCHIP GPIOK_15
|
|
|
|
|
|
|
|
/* diagnostic for brain pins
|
|
|
|
* can be combination of few bits
|
|
|
|
* defined as bit mask */
|
|
|
|
typedef enum __attribute__ ((__packed__))
|
|
|
|
{
|
|
|
|
PIN_OK = 0,
|
|
|
|
PIN_OPEN = 0x01,
|
|
|
|
PIN_SHORT_TO_GND = 0x02,
|
|
|
|
PIN_SHORT_TO_BAT = 0x04,
|
|
|
|
PIN_OVERLOAD = 0x08,
|
|
|
|
PIN_DRIVER_OVERTEMP = 0x10,
|
|
|
|
PIN_INVALID = 0x80
|
|
|
|
} brain_pin_diag_e;
|
|
|
|
|
|
|
|
typedef enum __attribute__ ((__packed__)) {
|
2020-09-23 11:06:22 -07:00
|
|
|
EFI_ADC_NONE = 0,
|
|
|
|
|
|
|
|
EFI_ADC_0 = 1,
|
|
|
|
EFI_ADC_1 = 2,
|
|
|
|
EFI_ADC_2 = 3,
|
|
|
|
EFI_ADC_3 = 4,
|
|
|
|
EFI_ADC_4 = 5,
|
|
|
|
EFI_ADC_5 = 6,
|
|
|
|
EFI_ADC_6 = 7,
|
|
|
|
EFI_ADC_7 = 8,
|
|
|
|
EFI_ADC_8 = 9,
|
|
|
|
EFI_ADC_9 = 10,
|
|
|
|
EFI_ADC_10 = 11,
|
|
|
|
EFI_ADC_11 = 12,
|
|
|
|
EFI_ADC_12 = 13,
|
|
|
|
EFI_ADC_13 = 14,
|
|
|
|
EFI_ADC_14 = 15,
|
|
|
|
EFI_ADC_15 = 16,
|
|
|
|
EFI_ADC_16 = 17,
|
|
|
|
EFI_ADC_17 = 18,
|
|
|
|
EFI_ADC_18 = 19,
|
|
|
|
EFI_ADC_19 = 20,
|
|
|
|
EFI_ADC_20 = 21,
|
|
|
|
EFI_ADC_21 = 22,
|
|
|
|
EFI_ADC_22 = 23,
|
|
|
|
EFI_ADC_23 = 24,
|
|
|
|
EFI_ADC_24 = 25,
|
|
|
|
EFI_ADC_25 = 26,
|
|
|
|
EFI_ADC_26 = 27,
|
|
|
|
EFI_ADC_27 = 28,
|
|
|
|
EFI_ADC_28 = 29,
|
|
|
|
EFI_ADC_29 = 30,
|
|
|
|
EFI_ADC_30 = 31,
|
|
|
|
EFI_ADC_31 = 32,
|
2020-12-06 20:19:57 -08:00
|
|
|
EFI_ADC_LAST_CHANNEL = 33, // Please keep this in sync with the last valid channel index!
|
2020-09-07 08:28:51 -07:00
|
|
|
|
2020-12-06 20:19:57 -08:00
|
|
|
EFI_ADC_ERROR = 50,
|
2020-09-07 08:28:51 -07:00
|
|
|
} adc_channel_e;
|