2021-10-21 19:55:33 +02:00
|
|
|
/*
|
|
|
|
* EmbeddedSystemProject.c
|
|
|
|
*
|
|
|
|
* Created: 21/10/2021 16:55:21
|
|
|
|
* Author : n0x
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Led.h"
|
|
|
|
#include "Taster.h"
|
2021-10-28 19:24:52 +02:00
|
|
|
#include "Timer.h"
|
2021-11-18 19:34:41 +01:00
|
|
|
#include "Tasks.h"
|
2021-11-11 18:28:42 +01:00
|
|
|
#include "StopLight.h"
|
2021-12-17 22:26:41 +01:00
|
|
|
#include "uart.h"
|
|
|
|
#include "cli.h"
|
|
|
|
#include "adc.h"
|
|
|
|
#include "rotaryEncoder.h"
|
2021-10-28 19:24:52 +02:00
|
|
|
#include <avr/interrupt.h>
|
2021-10-21 19:55:33 +02:00
|
|
|
#define F_CPU 1000000
|
2021-11-11 01:33:55 +01:00
|
|
|
#include <util/delay.h>
|
2021-10-21 19:55:33 +02:00
|
|
|
|
2021-12-17 22:26:41 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2021-10-28 16:36:38 +02:00
|
|
|
/* function declarations */
|
2021-11-11 01:33:55 +01:00
|
|
|
void buttonTest (void);
|
2021-10-28 16:36:38 +02:00
|
|
|
|
2021-12-04 23:12:36 +01:00
|
|
|
uint16_t g_startMS;
|
2021-11-11 18:28:42 +01:00
|
|
|
|
2021-10-28 16:36:38 +02:00
|
|
|
int
|
|
|
|
main (void)
|
2021-10-21 19:55:33 +02:00
|
|
|
{
|
2021-10-28 19:24:52 +02:00
|
|
|
sei();
|
|
|
|
|
2021-11-18 19:34:41 +01:00
|
|
|
/* Initialize the LEDs, Buttons, etc. */
|
2021-12-04 23:12:36 +01:00
|
|
|
Timer_init();
|
|
|
|
Taster_init();
|
|
|
|
Led_init();
|
2022-01-26 21:17:40 +01:00
|
|
|
initTasks();
|
|
|
|
|
|
|
|
|
2021-12-04 23:12:36 +01:00
|
|
|
uart_init();
|
2021-12-17 22:26:41 +01:00
|
|
|
adc_init();
|
2021-10-21 19:55:33 +02:00
|
|
|
|
2021-12-17 22:26:41 +01:00
|
|
|
drehgeber_init();
|
2021-11-05 09:00:41 +01:00
|
|
|
|
2021-12-17 22:26:41 +01:00
|
|
|
line_interpreter_init(uart_send_byte);
|
|
|
|
uart_send_string("Welcome to the ATmega1284P CLI. Type HELP to display all options.\r\n");
|
|
|
|
|
2021-11-11 01:33:55 +01:00
|
|
|
while (1)
|
2021-12-04 23:12:36 +01:00
|
|
|
{
|
2022-01-26 21:17:40 +01:00
|
|
|
//blinkLedWithTimer();
|
|
|
|
|
2021-12-04 23:12:36 +01:00
|
|
|
if(uart_data_available()){
|
|
|
|
line_interpreter_get_data(uart_get_data());
|
|
|
|
}
|
2021-11-11 01:33:55 +01:00
|
|
|
}
|
2021-10-28 16:36:38 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 01:33:55 +01:00
|
|
|
void
|
|
|
|
buttonTest (void)
|
|
|
|
{
|
|
|
|
Taster1_get() ? Led1_On() : Led1_Off();
|
|
|
|
Taster2_get() ? Led2_On() : Led2_Off();
|
|
|
|
Taster3_get() ? Led3_On() : Led3_Off();
|
|
|
|
Taster4_get() ? Led4_On() : Led4_Off();
|
2021-10-28 19:24:52 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 01:33:55 +01:00
|
|
|
|
|
|
|
|