This repository has been archived on 2020-06-14. You can view files and clone it, but cannot push or open issues or pull requests.
Jonas Holmberg 33a148b4dd Finished CLI Implementation
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
2016-10-10 08:59:49 +02:00

128 lines
2.6 KiB
C

/**
******************************************************************************
* @file main.c
* @author Ac6
* @version V1.0
* @date 01-December-2013
* @brief Default main function.
* Awesome ADC fix start project here to be good awesome!!
******************************************************************************
*/
#include "drivers/adc.h"
#include "drivers/system_clock.h"
#include "drivers/led.h"
#include "Scheduler/scheduler.h"
#include "stm32f4xx.h"
#include "stm32f4xx_revo.h"
#include "system_variables.h"
#include "utilities.h"
#include <string.h>
#include "drivers/uart1_inverter.h"
#include "config/cli.h"
#include "config/eeprom.h"
/**************************************************************************
* BRIEF: Should contain all the initializations of the system, needs to
* run before the scheduler.
*
* INFORMATION: Everything that will run somewhere in the system at some
* possible point and needs to be initialized to run properly, have to do it
* inside this function.
**************************************************************************/
void init_system()
{
//Init the Hardware abstraction layer (HAL)
HAL_Init();
//Configure the clock
system_clock_config();
/* read saved variables from eeprom */
readEEPROM();
//initialize the CLI
cliInit(USART1);
#ifdef USE_LEDS
//Initialize the on board leds
ledReavoEnable();
ledOffInverted(Led0_PIN, Led0_GPIO_PORT);
ledOffInverted(Led1, Led1_GPIO_PORT);
//ledEnable(GPIO_PIN_0, GPIOA);
#endif
#ifdef BARO
#endif
#ifdef COMPASS
#endif
#ifdef GPS
#endif
#ifdef SONAR
#endif
#if defined(BARO) || defined(SONAR)
#endif
#if BEEPER
#endif
}
/**************************************************************************
* BRIEF: Main function of the system, every thing originates from this
* point.
*
* INFORMATION: The function is responsible for calling the Initialize
* function that will make the system ready to run. It is also responsible
* for starting and running the scheduler in a loop that never stops.
**************************************************************************/
int main(void)
{
//Init the system
init_system();
//Initialize the scheduler, add all the tasks that should run to the ready queue of the scheduler
initScheduler();
// while (1)
// {
// cliInit(USART1);
// if (cliHasMessage() == true)
// {
// if (cliShouldRun() == true)
// cliRun();
// }
// else
// {
//
// }
//
// }
while (1)
{
//Run the scheduler, responsible for distributing all the work of the running system
scheduler();
#ifdef USE_LED_WARNINGS
ledIndicatorsUpdate();
#endif
}
for(;;);
}