rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
console
console_io.cpp
Go to the documentation of this file.
1
/**
2
* @file console_io.cpp
3
*
4
* @date Dec 29, 2012
5
* @author Andrey Belomutskiy, (c) 2012-2020
6
*
7
* This file is part of rusEfi - see http://rusefi.com
8
*
9
* rusEFI can communicate with external universe via native USB or some sort of TTL mode
10
* We have an interesting situation with TTL communication channels, we have
11
* 1) SERIAL - this one was implemented first simply because the code was readily available (works on stm32)
12
* this one is most suitable for streaming HAL API
13
* this one is not great since each byte requires an IRQ and with enough IRQ delay we have a risk of data loss
14
* 2) UART DMA - the best one since FIFO buffer reduces data loss (works on stm32)
15
* We have two halves of DMA buffer - one is used for TTL while rusEFI prepares next batch of data in the other side.
16
* We need idle support in order to not wait for the complete buffer to get full in order to recieve a message.
17
* Back when we were implementing this STM32_DMA_CR_HTIE was not available in ChibiOS driver so we have added it.
18
* we have custom rusEFI changes to ChibiOS HAL driver v1
19
* F7 uses driver v2 which currently does not have rusEFI changes.
20
* open question if fresh ChibiOS is better in this regard.
21
* 3) UART this one is useful on platforms with hardware FIFO buffer like Kinetis.
22
* stm32 does not have such buffer so for stm32 UART without DMA has no advantages
23
*
24
*
25
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
26
* the GNU General Public License as published by the Free Software Foundation; either
27
* version 3 of the License, or (at your option) any later version.
28
*
29
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
30
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
* GNU General Public License for more details.
32
*
33
* You should have received a copy of the GNU General Public License along with this program.
34
* If not, see <http://www.gnu.org/licenses/>.
35
*/
36
37
#include "
pch.h
"
38
39
#include "
console_io.h
"
40
#include "
tunerstudio.h
"
41
#include "
connector_uart_dma.h
"
42
43
#if EFI_SIMULATOR
44
#include "rusEfiFunctionalTest.h"
45
#endif
/*EFI_SIMULATOR */
46
47
bool
consoleByteArrived
=
false
;
48
49
void
onDataArrived
(
bool
valid) {
50
consoleByteArrived
= valid;
51
}
52
53
CommandHandler
console_line_callback
;
54
55
void
startConsole
(
CommandHandler
console_line_callback_p) {
56
console_line_callback
= console_line_callback_p;
57
}
connector_uart_dma.h
console_line_callback
CommandHandler console_line_callback
Definition
console_io.cpp:53
onDataArrived
void onDataArrived(bool valid)
Definition
console_io.cpp:49
startConsole
void startConsole(CommandHandler console_line_callback_p)
Definition
console_io.cpp:55
consoleByteArrived
bool consoleByteArrived
Definition
console_io.cpp:47
console_io.h
CommandHandler
void(* CommandHandler)(char *)
Definition
console_io.h:10
pch.h
tunerstudio.h
Generated on Sat Sep 27 2025 00:10:04 for rusEFI by
1.9.8