4#include "SoftwareSerial.h"
6#define MAX_CAPTURE_SIZE 500
7#define SERIAL_SPEED 9600
8#define SERIAL_TIMEOUT 500
10#define MAX_FREQ_THRESHOLD 100000
11#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
14#define DESCRIPTION "Arduino-AVR-Mega"
17#define DESCRIPTION "Arduino-AVR"
19#define PIN_COUNT sizeof(PinBitArray)*8
22#define LOG soft_serial
27namespace logic_analyzer {
30inline SoftwareSerial soft_serial(RXD2, TXD2);
37typedef uint8_t PinBitArray;
40#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
55 this->start_pin = startPin;
56 if (startPin >= 22 && startPin <= 29) {
58 shift = startPin - 22;
59 }
else if (startPin >= A0 && startPin <= A7) {
61 shift = startPin - A0;
62 }
else if (startPin >= A8 && startPin <= A15) {
64 shift = startPin - A8;
74 PinBitArray result = 0;
75 for (
int j = 0; j < (int)
sizeof(PinBitArray) * 8; j++) {
76 if (digitalRead(start_pin + j)) result |= (1 << j);
83 volatile uint8_t *reg =
nullptr;
97 PinReader(
int startPin){
98 this->start_pin = startPin;
106 uint16_t result = ((uint16_t)PINB & B00111111) << 8 | PIND;
107 return result >> start_pin;
Arduino Mega specific implementation Logic for the PinReader. The Mega GPIO numbers are not mapped to...
Definition config_avr.h:52
PinBitArray readAll()
reads all pins and provides the result as bitmask
Definition config_avr.h:69