mirror of
https://github.com/gillham/logic_analyzer.git
synced 2026-05-01 23:53:02 +03:00
Improve Leonardo support.
Shift port by 1 bit on the Leonardo since PB0 is the RXLED and not available for use via a pin. Use a more generic method of shifting the bits since the Leonardo needs 1 bit shift and the Mega needs 2.
This commit is contained in:
@@ -88,6 +88,11 @@ void debugdump(void);
|
|||||||
* PORTD support with triggers seems to work but needs more testing.
|
* PORTD support with triggers seems to work but needs more testing.
|
||||||
*/
|
*/
|
||||||
//#define USE_PORTD 1
|
//#define USE_PORTD 1
|
||||||
|
#if defined(USE_PORTD)
|
||||||
|
#define SHIFTBITS 2
|
||||||
|
#elif defined(__AVR_ATmega32U4__)
|
||||||
|
#define SHIFTBITS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arduino device profile: ols.profile-agla.cfg
|
* Arduino device profile: ols.profile-agla.cfg
|
||||||
@@ -339,8 +344,8 @@ void loop()
|
|||||||
* we can just use it directly as our trigger mask.
|
* we can just use it directly as our trigger mask.
|
||||||
*/
|
*/
|
||||||
getCmd();
|
getCmd();
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
trigger = cmdBytes[0] << 2;
|
trigger = cmdBytes[0] << SHIFTBITS;
|
||||||
#else
|
#else
|
||||||
trigger = cmdBytes[0];
|
trigger = cmdBytes[0];
|
||||||
#endif
|
#endif
|
||||||
@@ -351,8 +356,8 @@ void loop()
|
|||||||
* defines whether we're looking for it to be high or low.
|
* defines whether we're looking for it to be high or low.
|
||||||
*/
|
*/
|
||||||
getCmd();
|
getCmd();
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
trigger_values = cmdBytes[0] << 2;
|
trigger_values = cmdBytes[0] << SHIFTBITS;
|
||||||
#else
|
#else
|
||||||
trigger_values = cmdBytes[0];
|
trigger_values = cmdBytes[0];
|
||||||
#endif
|
#endif
|
||||||
@@ -585,8 +590,8 @@ void captureMicro() {
|
|||||||
* is done for any triggers, this is effectively the 0/100 buffer split.
|
* is done for any triggers, this is effectively the 0/100 buffer split.
|
||||||
*/
|
*/
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
Serial.write(logicdata[i] >> 2);
|
Serial.write(logicdata[i] >> SHIFTBITS);
|
||||||
#else
|
#else
|
||||||
Serial.write(logicdata[i]);
|
Serial.write(logicdata[i]);
|
||||||
#endif
|
#endif
|
||||||
@@ -660,8 +665,8 @@ void captureMilli() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0 ; i < readCount; i++) {
|
for (i = 0 ; i < readCount; i++) {
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
Serial.write(logicdata[i] >> 2);
|
Serial.write(logicdata[i] >> SHIFTBITS);
|
||||||
#else
|
#else
|
||||||
Serial.write(logicdata[i]);
|
Serial.write(logicdata[i]);
|
||||||
#endif
|
#endif
|
||||||
@@ -854,8 +859,8 @@ void triggerMicro() {
|
|||||||
if (logicIndex >= readCount) {
|
if (logicIndex >= readCount) {
|
||||||
logicIndex = 0;
|
logicIndex = 0;
|
||||||
}
|
}
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
Serial.write(logicdata[logicIndex++] >> 2);
|
Serial.write(logicdata[logicIndex++] >> SHIFTBITS);
|
||||||
#else
|
#else
|
||||||
Serial.write(logicdata[logicIndex++]);
|
Serial.write(logicdata[logicIndex++]);
|
||||||
#endif
|
#endif
|
||||||
@@ -1018,8 +1023,8 @@ void debugdump() {
|
|||||||
Serial.print("\r\n");
|
Serial.print("\r\n");
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
|
for (i = 0 ; i < MAX_CAPTURE_SIZE; i++) {
|
||||||
#ifdef USE_PORTD
|
#ifdef SHIFTBITS
|
||||||
Serial.print(logicdata[i] >> 2, HEX);
|
Serial.print(logicdata[i] >> SHIFTBITS, HEX);
|
||||||
#else
|
#else
|
||||||
Serial.print(logicdata[i], HEX);
|
Serial.print(logicdata[i], HEX);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user