Skip to content

Commit 16655d5

Browse files
committed
separate ADC definition into separate files and add a test
1 parent 2002495 commit 16655d5

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <ArduinoUnitTests.h>
2+
#include <Arduino.h>
3+
4+
unittest(check_ADCSRA_read_write) {
5+
ADCSRA = 123;
6+
7+
assertEqual(123, ADCSRA);
8+
}
9+
10+
unittest_main()

SampleProjects/TestSomething/test/isr_declaration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <ArduinoUnitTests.h>
22
#include <Arduino.h>
33

4+
// just check if declaration compiles
45
ISR (WDT_vect) {
56
}
67

cpp/arduino/Arduino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typedef uint8_t byte;
2424
// Math and Trig
2525
#include "AvrMath.h"
2626

27+
#include "AvrAdc.h"
2728
#include <avr/interrupt.h>
2829

2930
#include "Godmode.h"

cpp/arduino/AvrAdc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "AvrAdc.h"
2+
3+
// mock storage to allow access to ADCSRA
4+
unsigned char sfr_store;

cpp/arduino/AvrAdc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _AVR_ADC_H_
2+
#define _AVR_ADC_H_
3+
4+
// mock storage to allow access to ADCSRA
5+
extern unsigned char sfr_store;
6+
#define _SFR_MEM8(mem_addr) sfr_store
7+
8+
#endif // _AVR_ADC_H_

cpp/arduino/avr/sleep.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,4 @@ void sleep_mode() {
3737
sleep_disable();
3838
}
3939

40-
// mock storage to allow access to ADCSRA
41-
unsigned char sfr_store;
42-
#define _SFR_MEM8(mem_addr) sfr_store
43-
4440
#endif /* _AVR_SLEEP_H_ */

0 commit comments

Comments
 (0)