rusEFI
The most advanced open source ECU
Functions | Variables
serial_hw.cpp File Reference

Detailed Description

SERIAL bus low level code.

Date
Apr 17, 2020
Author
Konstantin Smola, (c) 2020

Definition in file serial_hw.cpp.

Functions

static void auxInfo ()
 
void enableAuxSerial ()
 
void stopAuxSerialPins ()
 
void startAuxSerialPins ()
 
void initAuxSerial (void)
 

Variables

static bool isSerialEnabled = false
 
static bool isSerialTXEnabled = false
 
static bool isSerialRXEnabled = false
 
static SerialConfig uartCfg
 
static SerialRead serialRead
 

Function Documentation

◆ auxInfo()

static void auxInfo ( )
static

Definition at line 25 of file serial_hw.cpp.

25  {
26  if (!isSerialEnabled) {
27  efiPrintf("AUX Serial is not enabled, please enable & restart");
28  return;
29  }
30 
31  efiPrintf("AUX Serial TX %s", hwPortname(engineConfiguration->auxSerialTxPin));
32  efiPrintf("AUX Serial RX %s", hwPortname(engineConfiguration->auxSerialRxPin));
33 }
engine_configuration_s * engineConfiguration
const char * hwPortname(brain_pin_e brainPin)
static bool isSerialEnabled
Definition: serial_hw.cpp:18

Referenced by initAuxSerial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enableAuxSerial()

void enableAuxSerial ( )

Definition at line 35 of file serial_hw.cpp.

35  {
37  sdStart(AUX_SERIAL_DEVICE, &uartCfg);
38 
39  efiPrintf("AUX Serial started");
40 }
static SerialConfig uartCfg
Definition: serial_hw.cpp:22

Referenced by startAuxSerialPins().

Here is the caller graph for this function:

◆ initAuxSerial()

void initAuxSerial ( void  )

Definition at line 56 of file serial_hw.cpp.

56  {
57  addConsoleAction("auxinfo", auxInfo);
58 
61 
63  isSerialRXEnabled || // we need at least one pin set
65 
66  // exit if no pin is configured
67  if (!isSerialEnabled)
68  return;
69 
70  // Validate pins
72  criticalError("unexpected aux TX pin");
73  return;
74  }
75 
77  criticalError("unexpected aux RX pin");
78  return;
79  }
80 
82 
84  serialRead.start();
85 }
void start()
Start the thread.
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
bool isValidSerialRxPin(brain_pin_e pin)
bool isValidSerialTxPin(brain_pin_e pin)
bool isBrainPinValid(brain_pin_e brainPin)
static void auxInfo()
Definition: serial_hw.cpp:25
static SerialRead serialRead
Definition: serial_hw.cpp:23
static bool isSerialTXEnabled
Definition: serial_hw.cpp:19
static bool isSerialRXEnabled
Definition: serial_hw.cpp:20
void startAuxSerialPins()
Definition: serial_hw.cpp:47

Referenced by initHardware().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startAuxSerialPins()

void startAuxSerialPins ( )

Definition at line 47 of file serial_hw.cpp.

47  {
49  efiSetPadMode("AuxSerial TX", engineConfiguration->auxSerialTxPin, PAL_MODE_ALTERNATE(8));
51  efiSetPadMode("AuxSerial RX", engineConfiguration->auxSerialRxPin, PAL_MODE_ALTERNATE(8));
52 
54 }
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
void enableAuxSerial()
Definition: serial_hw.cpp:35

Referenced by applyNewHardwareSettings(), and initAuxSerial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopAuxSerialPins()

void stopAuxSerialPins ( )

Definition at line 42 of file serial_hw.cpp.

42  {
45 }
engine_configuration_s & activeConfiguration
void efiSetPadUnused(brain_pin_e brainPin)
Definition: io_pins.cpp:20

Referenced by applyNewHardwareSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ isSerialEnabled

bool isSerialEnabled = false
static

Definition at line 18 of file serial_hw.cpp.

Referenced by auxInfo(), and initAuxSerial().

◆ isSerialRXEnabled

bool isSerialRXEnabled = false
static

Definition at line 20 of file serial_hw.cpp.

Referenced by initAuxSerial().

◆ isSerialTXEnabled

bool isSerialTXEnabled = false
static

Definition at line 19 of file serial_hw.cpp.

Referenced by initAuxSerial().

◆ serialRead

SerialRead serialRead
static

Definition at line 23 of file serial_hw.cpp.

Referenced by initAuxSerial().

◆ uartCfg

SerialConfig uartCfg
static

Definition at line 22 of file serial_hw.cpp.

Referenced by enableAuxSerial().

Go to the source code of this file.