added interrupt counters

This commit is contained in:
Tristan Krause 2019-06-21 14:05:57 +02:00
parent 42a1b7e0ab
commit 74b71d0fe8
8 changed files with 169 additions and 8 deletions

View file

@ -21,7 +21,7 @@ HEX = b15f.hex
MCU = atmega1284
CFLAGS = -Wall -Wextra -std=c++14 -O3 -mmcu=$(MCU) -DF_CPU=$(F_CPU) $(DEBUG)
LDFLAGS =
OBJECTS = main.o spi.o mcp23s17.o tlc5615.o adu.o selftest.o global_vars.o usart.o requests.o interrupts.o pwm.o
OBJECTS = main.o spi.o mcp23s17.o tlc5615.o adu.o selftest.o global_vars.o usart.o request_handlers.o interrupts.o pwm.o

View file

@ -10,3 +10,4 @@ volatile ADU adu;
volatile USART usart;
volatile PWM pwm;
volatile bool nextRequest = false;
volatile uint16_t interruptCounters[35];

View file

@ -20,5 +20,6 @@ extern volatile ADU adu;
extern volatile USART usart;
extern volatile PWM pwm;
extern volatile bool nextRequest;
extern volatile uint16_t interruptCounters[];
#endif // GLOBAL_VARS_H

View file

@ -1,22 +1,181 @@
#include <avr/interrupt.h>
#include "global_vars.h"
ISR(USART0_RX_vect)
ISR(BADISR_vect)
{
usart.handleRX();
interruptCounters[0]++;
}
ISR(USART0_TX_vect)
ISR(INT0_vect)
{
usart.handleTX();
interruptCounters[1]++;
}
ISR(INT1_vect)
{
interruptCounters[2]++;
}
ISR(INT2_vect)
{
interruptCounters[3]++;
}
ISR(PCINT0_vect)
{
interruptCounters[4]++;
}
ISR(PCINT1_vect)
{
interruptCounters[5]++;
}
ISR(PCINT2_vect)
{
interruptCounters[6]++;
}
ISR(PCINT3_vect)
{
interruptCounters[7]++;
}
ISR(WDT_vect)
{
interruptCounters[8]++;
}
ISR(TIMER2_COMPA_vect)
{
interruptCounters[9]++;
}
ISR(TIMER2_COMPB_vect)
{
interruptCounters[10]++;
}
ISR(TIMER2_OVF_vect)
{
interruptCounters[11]++;
}
ISR(TIMER1_CAPT_vect)
{
interruptCounters[12]++;
}
ISR(TIMER1_COMPA_vect)
{
interruptCounters[13]++;
}
ISR(TIMER1_COMPB_vect)
{
interruptCounters[14]++;
}
ISR(TIMER1_OVF_vect)
{
interruptCounters[15]++;
}
ISR(TIMER0_COMPA_vect)
{
interruptCounters[16]++;
}
ISR(TIMER0_COMPB_vect)
{
interruptCounters[17]++;
}
ISR(TIMER0_OVF_vect)
{
interruptCounters[18]++;
}
ISR(SPI_STC_vect)
{
interruptCounters[19]++;
spi.handleTransfer();
}
ISR(USART0_RX_vect)
{
interruptCounters[20]++;
usart.handleRX();
}
ISR(USART0_UDRE_vect)
{
interruptCounters[21]++;
}
ISR(USART0_TX_vect)
{
interruptCounters[22]++;
usart.handleTX();
}
ISR(ANALOG_COMP_vect)
{
interruptCounters[23]++;
}
ISR(ADC_vect)
{
interruptCounters[24]++;
adu.handleConversionComplete();
}
ISR(EE_READY_vect)
{
interruptCounters[25]++;
}
ISR(TWI_vect)
{
interruptCounters[26]++;
}
ISR(SPM_READY_vect)
{
interruptCounters[27]++;
}
ISR(USART1_RX_vect)
{
interruptCounters[28]++;
}
ISR(USART1_UDRE_vect)
{
interruptCounters[29]++;
}
ISR(USART1_TX_vect)
{
interruptCounters[30]++;
}
ISR(TIMER3_CAPT_vect)
{
interruptCounters[31]++;
}
ISR(TIMER3_COMPA_vect)
{
interruptCounters[32]++;
}
ISR(TIMER3_COMPB_vect)
{
interruptCounters[33]++;
}
ISR(TIMER3_OVF_vect)
{
interruptCounters[34]++;
}

View file

@ -4,7 +4,7 @@
#include <avr/wdt.h>
#include "global_vars.h"
#include "selftest.h"
#include "requests.h"
#include "request_handlers.h"
int main()

View file

@ -1,4 +1,4 @@
#include "requests.h"
#include "request_handlers.h"
void handleRequest()
{

View file

@ -6,7 +6,7 @@
class USART;
#include "global_vars.h"
#include "requests.h"
#include "request_handlers.h"
class USART
{