2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file console_io.h
|
|
|
|
*
|
|
|
|
* @date Dec 29, 2012
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef CONSOLE_IO_H_
|
|
|
|
#define CONSOLE_IO_H_
|
|
|
|
|
|
|
|
#include <ch.h>
|
|
|
|
#include <hal.h>
|
|
|
|
|
|
|
|
typedef void (*CommandHandler)(char *);
|
|
|
|
|
|
|
|
#include "efifeatures.h"
|
|
|
|
#include "datalogging.h"
|
|
|
|
|
2015-12-21 17:02:32 -08:00
|
|
|
// todo: make this pin configurable
|
2017-01-04 16:01:27 -08:00
|
|
|
#define GET_CONSOLE_MODE_VALUE() palReadPad(CONSOLE_MODE_SWITCH_PORT, CONSOLE_MODE_SWITCH_PIN)
|
2015-07-10 06:01:56 -07:00
|
|
|
#define SHOULD_INGORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
|
|
|
|
|
|
|
|
SerialDriver * getConsoleChannel(void);
|
|
|
|
|
|
|
|
void consolePutChar(int x);
|
|
|
|
void consoleOutputBuffer(const uint8_t *buf, int size);
|
|
|
|
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
|
2017-01-05 02:01:46 -08:00
|
|
|
bool isCommandLineConsoleOverTTL(void);
|
2016-02-13 18:02:14 -08:00
|
|
|
void onDataArrived(void);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#if EFI_PROD_CODE || EFI_SIMULATOR || EFI_EGT
|
2017-01-05 01:03:02 -08:00
|
|
|
bool isCommandLineConsoleReady(void);
|
2015-07-10 06:01:56 -07:00
|
|
|
#else
|
2017-01-05 01:03:02 -08:00
|
|
|
#define isCommandLineConsoleReady() true
|
2015-07-10 06:01:56 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONSOLE_IO_H_ */
|