SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
PinConfig.def File Reference

Pin Configuration. More...

Go to the source code of this file.

Macros

#define CONF_PINS_CANBUS_UPDATE_INTERVAL_MICRO   50000
 The interval in micros to update outgoing canPins.
 
#define CONF_PINS_ANALOG_WRITE_RESOLUTION   12
 The write resolution for analog pins.
 
#define ECU_PINS
 The defintions of every physical pin.
 
#define PINS_CANBUS_ANALOG_IN
 The defintions of every analog pin to be received over canbus.
 
#define PINS_CANBUS_ANALOG_OUT    X(ADD_CANPIN_ANALOG3, PINS_INTERNAL_STATE)
 Same as PINS_CANBUS_ANALOG_IN only for the analog pins that are outgoing.
 
#define PINS_CANBUS_DIGITAL_IN
 The defintions of every digital pin to be received over canbus.
 
#define PINS_CANBUS_DIGITAL_OUT
 Same as PINS_CANBUS_DIGITAL_IN only for the digital pins that are outgoing.
 

Detailed Description

Pin Configuration.

Author
IR
Version
0.1
Date
2020-11-11

This config file is used configure the Pin module.

It is mostly used to define pins and CanPins.

Because, at the moment, there are two ECUs on the car, the pin definitions are split in half by an if statement, one case is for the back ECU, the other for the front.

Only the back ECU has documentation, as the process for defining pins is the same on both ECUs.

See also
Pins.h for more info on how pins work
ECU_PINS for defining pins
PINS_CANBUS_ANALOG_IN for incoming Analog CanPins
PINS_CANBUS_ANALOG_OUT for outgoing Analog CanPins
PINS_CANBUS_DIGITAL_IN for incoming Digital CanPins
PINS_CANBUS_DIGITAL_OUT for outgoing Digital CanPins

Definition in file PinConfig.def.

Macro Definition Documentation

◆ CONF_PINS_ANALOG_WRITE_RESOLUTION

#define CONF_PINS_ANALOG_WRITE_RESOLUTION   12

The write resolution for analog pins.

Definition at line 52 of file PinConfig.def.

◆ CONF_PINS_CANBUS_UPDATE_INTERVAL_MICRO

#define CONF_PINS_CANBUS_UPDATE_INTERVAL_MICRO   50000

The interval in micros to update outgoing canPins.

Definition at line 47 of file PinConfig.def.

◆ ECU_PINS

#define ECU_PINS
Value:
X(PINS_BOTH_LED, DIGITAL, OUTPUT, NIL) \
X(PINS_BACK_SERVO_OFF, DIGITAL, OUTPUT, 0) \
X(PINS_BACK_TSV_SIGNAL, DIGITAL, INPUT, NIL) \
X(PINS_BACK_AIR2, ANALOG, OUTPUT, 0) \
X(PINS_BACK_CHARGING_RELAY, DIGITAL, OUTPUT, 1) \
X(PINS_BACK_SOUND_DRIVER, ANALOG, OUTPUT, 0) \
X(PINS_BACK_BRAKE_LIGHT, ANALOG, OUTPUT, 0) \
X(PINS_BACK_SERVO1_PWM, ANALOG, OUTPUT, NIL) \
X(PINS_BACK_PRECHARGE_RELAY, ANALOG, OUTPUT, 0) \
X(PINS_BACK_AIR1, ANALOG, OUTPUT, 0) \
X(PINS_BACK_FANS_ONOFF, DIGITAL, OUTPUT, 0) \
X(PINS_BACK_SHUTDOWN_SIGNAL, DIGITAL, INPUT, NIL) \
X(PINS_BACK_HVD_FAULT, DIGITAL, INPUT, NIL) \
X(PINS_BACK_SERVO2_PWM, ANALOG, OUTPUT, NIL) \
X(PINS_BACK_FAN1_PWM, ANALOG, OUTPUT, 0) \
X(PINS_BACK_FAN2_PWM, ANALOG, OUTPUT, 0) \
X(PINS_BACK_FAN3_PWM, ANALOG, OUTPUT, 0) \
X(PINS_BACK_FAN4_PWM, ANALOG, OUTPUT, 0) \
X(PINS_BACK_IMD_FAULT, DIGITAL, INPUT, NIL) \
X(PINS_BACK_BMS_FAULT, DIGITAL, INPUT, NIL) \
X(PINS_BACK_PUMP_DAC, ANALOG, OUTPUT, 0)

The defintions of every physical pin.

The pinout setup for the ECU, set the specific pin, whether it is analog or digital, and whether we are taking input or giving an output on the pin

Unless it is the last entry, this is how to add a new pin

C
X(GPIO, ANALOG/DIGITAL, INPUT/OUTPUT, INITAL_STATE) \
Definition test_a.h:7

INITAL_STATE is the value a pin should be set to on startup

It can be a number or NIL, meaning that we do not care what it's starting output value is

All INPUT pins should have this set to NIL

Only the last entry should NOT have a '\'

See also
The warning under Defining in X Macros for more info on Defining X Macros

Definition at line 132 of file PinConfig.def.

◆ PINS_CANBUS_ANALOG_IN

#define PINS_CANBUS_ANALOG_IN
Value:
X(ADD_CANPIN_ANALOG0, PINS_FRONT_PEDAL0) \
X(ADD_CANPIN_ANALOG0, PINS_FRONT_PEDAL1) \
X(ADD_CANPIN_ANALOG1, PINS_FRONT_WHEEL1) \
X(ADD_CANPIN_ANALOG1, PINS_FRONT_WHEEL0) \
X(ADD_CANPIN_ANALOG2, PINS_FRONT_STEER) \
X(ADD_CANPIN_ANALOG2, PINS_FRONT_BRAKE) \
X(ADD_CANPIN_ANALOG4, PINS_INTERNAL_TVAGG)

The defintions of every analog pin to be received over canbus.

Note
Only two analog pins can be allocated per address
The number of pins per address must be maximized, this means that there should be, at a maximum, only one address that only has one value to send

Unless it is the last entry, this is how to add a new pin

C
X(Address, Pin) \

Only the last entry should NOT have a '\'

See also
The warning under Defining in X Macros for more info on Defining X Macros
CanBusAddresses.def for more info on defining new addresses

Definition at line 172 of file PinConfig.def.

◆ PINS_CANBUS_ANALOG_OUT

#define PINS_CANBUS_ANALOG_OUT    X(ADD_CANPIN_ANALOG3, PINS_INTERNAL_STATE)

Same as PINS_CANBUS_ANALOG_IN only for the analog pins that are outgoing.

Definition at line 184 of file PinConfig.def.

◆ PINS_CANBUS_DIGITAL_IN

#define PINS_CANBUS_DIGITAL_IN
Value:
X(ADD_CANPIN_DIGITAL1, PINS_INTERNAL_CHARGE_SIGNAL) \
X(ADD_CANPIN_DIGITAL1, PINS_INTERNAL_SYNC) \
X(ADD_CANPIN_DIGITAL1, PINS_INTERNAL_REVERSE) \
X(ADD_CANPIN_DIGITAL1, PINS_FRONT_BUTTON_INPUT_OFF)

The defintions of every digital pin to be received over canbus.

Note
Only 8 digital pins can be allocated per address
Currently, only one address is supported, support for up to 64 pins can be added later if needed

Unless it is the last entry, this is how to add a new pin

C
X(Address, Pin) \

Only the last entry should NOT have a '\'

See also
The warning under Defining in X Macros for more info on Defining X Macros
CanBusAddresses.def for more info on defining new addresses

Definition at line 204 of file PinConfig.def.

◆ PINS_CANBUS_DIGITAL_OUT

#define PINS_CANBUS_DIGITAL_OUT
Value:
X(ADD_CANPIN_DIGITAL0, PINS_INTERNAL_START) \
X(ADD_CANPIN_DIGITAL0, PINS_INTERNAL_BMS_FAULT) \
X(ADD_CANPIN_DIGITAL0, PINS_INTERNAL_IMD_FAULT) \
X(ADD_CANPIN_DIGITAL0, PINS_INTERNAL_GEN_FAULT)

Same as PINS_CANBUS_DIGITAL_IN only for the digital pins that are outgoing.

Definition at line 213 of file PinConfig.def.