Skip to content
Snippets Groups Projects
Commit 6e8c33b9 authored by Micah Elizabeth Scott's avatar Micah Elizabeth Scott
Browse files

USB activity light

parent 99a12922
Branches
Tags
No related merge requests found
......@@ -47,6 +47,7 @@ Teensy 3.0 Pin | Function
21 | Led strip #7
5 | Led strip #8
15 & 16 | Connect together
13 (LED) | Built-in LED blinks when data is received over USB
Remember that each strip may be up to 64 LEDs long. It's fine to have shorter strips or to leave some outputs unused. These outputs are 3.3V logic signals at 800 kilobits per second. It usually works to connect them directly to the 5V inputs of your WS2811 LED strips, but for the best signal integrity you should really use a level-shifting buffer to convert the 3.3V logic to 5V.
......
......@@ -435,6 +435,7 @@ static void updateDrawBuffer(unsigned interpCoefficient)
extern "C" int main()
{
pinMode(LED_BUILTIN, OUTPUT);
leds.begin();
while (1) {
......
......@@ -44,11 +44,14 @@ void fcBuffers::handleUSB()
* which we hold until a new packet arrives to replace them.
*/
bool handledAnyPackets = false;
while (1) {
usb_packet_t *packet = usb_rx(FC_OUT_ENDPOINT);
if (!packet) {
return;
break;
}
handledAnyPackets = true;
unsigned control = packet->buf[0];
unsigned type = control & TYPE_BITS;
......@@ -81,6 +84,9 @@ void fcBuffers::handleUSB()
break;
}
}
// Use the built-in LED as a USB activity indicator.
digitalWrite(LED_BUILTIN, handledAnyPackets);
}
void fcBuffers::finalizeFramebuffer()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment