It's trivial.
I posted this earlier:
That's 128 LEDs via 3 ports on 2 mcp23017 I2C GPIO expander cards. Although that video demo only has a few LEDs on at a time, I can assure you that the code behind it is multiplexing all 128 LEDs. Each "pixel" is a green + red LED - it's pretending to be a
8x8x2 bit framebuffer there. The code to refresh the display runs as a thread in the background of your program -you just poke pixels into the 'frambeuffer' array.It's using only a few % of the CPU to do that. Most of the time its waiting on the I2C bus - I am running it at 1Mhz in that demo.
This:
is playing tones via software toggling of a GPIO pin. It's stuttering as I'm only playing the tone for 1/10 of a second before checking for a touch release.
This:
is software PWM over 12 LEDs.
And so on.
Yes - and the reason behind that is nothing to do with anything but the Linux kernel driver for SPI having a rather high latency when starting a transfer. If you want to poke the hardware directly, you'll get 20x that.
8Khz sampling over SPI:The max. SPI clock I've used reliably has been 32Mhz.
100Hz (and much more) is easily achievable in software with minimal CPU impact.Gordon