using libgpio to bitbang LCDs!
Slawa Olhovchenkov
slw at zxy.spb.ru
Sun Apr 12 08:44:48 UTC 2015
On Sat, Apr 11, 2015 at 05:11:47PM -0700, Adrian Chadd wrote:
> Hi!
>
> I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial task:
>
> * convert C++ to C, which was done primarily to not rely on the arduino-isms;
> * use libgpio to bitbang the SPI bus needed to write to the LCD.
>
> It worked third time. First was "oh it runs on 5v power and 3.3v
> signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't
> set the pins to be output pins yet." Third time worked - just slowly.
>
> However - using libgpio was just pleasant. Get a handle, set the pin
> config, set the pins high/low. It was pretty damned wonderful.
>
> It turns out that to fill the screen with individual pixel writes
> takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000
> syscalls a second. Ian's suggested something sensible - a bulk data
> ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one
> syscall, a big chunk of data with instructions and timings.
May be best choise is write() or netmap-like interface?
More information about the freebsd-arch
mailing list