mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-15 20:21:03 +00:00
Add test code for using RTT
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user