0

October 25, 2011 AT 6:51 am

High speed, pin-flexible SPI writes

Pt 101822

We’re working on speeding up our LPD8806 library (for massive installations) and wanted to share our nice-and-fast ‘bitbang’ SPI code for use with Arduinos. we use this whenever we have a display that needs fast updating, but don’t want to constrain the system to using the hardware SPI port! You can check it out on GitHub


Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!


Maker Business — Transforming Today’s Bad Jobs into Tomorrow’s Good Jobs

Wearables — Not a loophole

Electronics — Rule of thumb: 10mils per amp.

Biohacking — Biomimicry – 8 Useful Technologies Inspired by Nature

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



1 Comment

  1. You can also use the counter variable as mask. This will make a better/smaller code:

    uint8_t mask;

    for (mask=0x80; mask!=0; mask>>=1) {
    *clkportreg &= ~clkpin;
    if(c & mask) {
    *mosiportreg |= mosipin;
    } else {
    *mosiportreg &= ~mosipin;
    }
    *clkportreg |= clkpin;
    }

    *clkportreg &= ~clkpin;
    // Make sure clock ends low

Sorry, the comment form is closed at this time.