Skip to content

JustSomeRandomDIYGuy/shiftDebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shiftDebug

A lightweight library to control a shift register IC for generating debug signals ("pings") in multithreaded and multitasking microcontroller applications (Arduino-compatible).

Purpose

shiftDebug provides a simple way to visualize the activity of individual threads or tasks using an external shift register. This is especially useful for debugging and analyzing concurrent operations, e.g., with a logic analyzer or oscilloscope.

Features

  • Control up to 16 outputs via SPI or shiftOut.
  • Direct port manipulation for maximum speed.
  • Visualize thread/task activity in real-time.
  • Option to aggregate thread activity on channel 0.
  • Simple API: sendThreadStartSignal, sendThreadStopSignal, getStates.
  • Example sketches for a quick start.

Installation

Copy threadDebugShifter.h and threadDebugShifter.cpp into your project, or integrate as an Arduino library.

#include <threadDebugShifter.h>

Usage

Initialization:

#define THREAD_DEBUG_LATCH_PIN  A4
ThreadDebugShifter tD(THREAD_DEBUG_LATCH_PIN);

void setup() {
    tD.begin();
    tD.disableSumThreadActivityOnCh0(); // Optional
    Serial.begin(115200);
}

Signaling thread activity:

tD.sendThreadStartSignal(threadID); // e.g., tD.sendThreadStartSignal(1);
tD.sendThreadStopSignal(threadID);  // e.g., tD.sendThreadStopSignal(1);

Example: See /examples/basicExample/basicExample.ino and /examples/serialParallelOut/serialParallelOut.ino for complete demo sketches.

API Overview

  • ThreadDebugShifter(uint8_t latchPin)
  • void begin()
  • void sendThreadStartSignal(uint8_t threadID)
  • void sendThreadStopSignal(uint8_t threadID)
  • void disableDebugging()
  • void enableSumThreadActivityOnCh0()
  • void disableSumThreadActivityOnCh0()
  • uint16_t getStates()

Hardware Requirements

  • Microcontroller with SPI support (e.g., Arduino, Feather)
  • External shift register (e.g., 74HC595)
  • Debugging via logic analyzer, oscilloscope, etc.

License & Author

Author: JustSomeRandomDIYGuy
License: MIT License


Questions or suggestions?
Open an issue or submit a pull request!

About

library to use a shift register IC to generate debug pings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages