The finished CLI implementation. All actions should be in a working condition. It should be able to read messages from any serial writer/reader. To do later if time build an desktop application to communicate with
60 lines
2.9 KiB
C
60 lines
2.9 KiB
C
/**********************************************************************
|
|
* NAME: cli.h *
|
|
* AUTHOR: Jonas Holmberg *
|
|
* PURPOSE: Provide the ability to change some values by use of *
|
|
* command line interface. *
|
|
* INFORMATION: By some predefined commands values can be changed in *
|
|
* the system by writing in a serial communication *
|
|
* terminal that runs on usart. It also has the ability *
|
|
* to save the value changes to EEPROM and reset all *
|
|
* values. The system can also be reseted and rebooted. *
|
|
* *
|
|
* GLOBAL VARIABLES: *
|
|
* Variable Type Description *
|
|
* -------- ---- ----------- *
|
|
* cliUsart Usart_profile The handler to the usart used by the cli* *
|
|
**********************************************************************/
|
|
|
|
#ifndef CONFIG_CLI_H_
|
|
#define CONFIG_CLI_H_
|
|
|
|
#include "drivers/usart.h"
|
|
|
|
/* The handler to the usart that is used by the CLI */
|
|
extern usart_profile cliUsart;
|
|
|
|
/***********************************************************************
|
|
* BRIEF: Call will start the cli loop *
|
|
* INFORMATION: Should be invoked if you want to start the cli loop, *
|
|
* will try to read instructions until told to stop. *
|
|
* Will not be part of the regular scheduler loop. *
|
|
***********************************************************************/
|
|
void cliRun();
|
|
|
|
/***********************************************************************
|
|
* BRIEF: Initiates the CLI *
|
|
* INFORMATION: The function initiates the CLI. To do this it will need *
|
|
* a usart that it should receive its commands from. *
|
|
***********************************************************************/
|
|
void cliInit(USART_TypeDef* usart);
|
|
|
|
/***********************************************************************
|
|
* BRIEF: Function that checks if the CLI asigned usart has a new *
|
|
* message that can be read. *
|
|
* INFORMATION: If there is a new message in the designated usart the *
|
|
* function will return true, otherwise false. *
|
|
***********************************************************************/
|
|
bool cliHasMessage();
|
|
|
|
/***********************************************************************
|
|
* BRIEF: Reads a cahracter from the usart and checks if it *
|
|
* is the start character for the CLI. *
|
|
* INFORMATION: Will read a character from the usart and compare if it *
|
|
* is the character that needs to be read to start the CLI *
|
|
***********************************************************************/
|
|
bool cliShouldRun();
|
|
|
|
|
|
|
|
#endif /* CONFIG_CLI_H_ */
|