Add test code for using RTT

This commit is contained in:
Sem van der Hoeven
2023-10-27 00:33:17 +02:00
parent 0e4f501f24
commit 4c78d0eac6
4 changed files with 88 additions and 2 deletions

View File

@@ -11,9 +11,10 @@ Program to create a car monitor display using:
#include <UTFT.h>
#include "obd2_display.h"
// #include "obd2_timer.h"
#include "obd2_timer.h"
#define DEBUG 1
// #define RTT_MR 0x400E1A30U
/* pins */
#define PIN_BT_RX 19
@@ -24,6 +25,8 @@ extern uint8_t BigFont[];
extern uint8_t SmallFont[];
char should_clear = 1;
char led_state = LOW;
char flag = 0;
/* Set the pins for the display and dev board */
/* Standard Arduino Mega/Due shield : <display model>,38,39,40,41 */
@@ -46,7 +49,16 @@ void setup() {
Serial.println("Starting");
#endif
TCCR0A=(1<<WGM01); //Set the CTC mode
pinMode(LED_BUILTIN, OUTPUT);
obd2_timer_init();
}
void RTT_Handler()
{
flag = 0;
obd2_timer_reset();
}
void loop() {
@@ -68,4 +80,14 @@ void loop() {
delay(10);
should_clear = 0;
}
if (!flag)
{
led_state = ~led_state;
digitalWrite(LED_BUILTIN, led_state);
flag = 1;
#if (DEBUG == 1)
Serial.println("switching led");
#endif
}
}