Orangutan-lib 0.3 released

A new version of Orangutan-lib is up on Sourceforge:


Orangutan-lib is a C library for AVR Studio 4 and WinAVR. It should also work on UNIX avr-gcc toolchains after running an included script to make the necessary tweaks to the makefiles. (OSX testing and toolchain documentation is also being done, so bear with us. (Yeah, there really is more than one person working on this.))

As of this release, Orangutan-lib has support for the Orangutan and the Baby-Orangutan, and with the exception of the motor, buzzer, and UART code, will run on the Orangutan-X2 as well. (The 0.3 code has #ifdefs so it won’t try to run Orangutan/Baby-O specific code on the X2, but the X2’s SPI calls aren’t in this release. The 0.4 release will have Ben’s SPI calls for the X2 rolled into it - sorry for the delay.)

This latest one has support for:

  • Basic A/D conversion
  • Bitfields on I/O registers
  • The Orangutan buzzer (thanks to Jim!)
  • 1kHz up/down counters (user settable)
  • I2C Master (thanks to Peter Fleury!)
  • LCD (hopefully fixed after lots of head-scratching)
  • Pin change interrupts on all I/O ports
  • Symmetric PWM for the motors
  • Lightweight relay-style motor control
  • Code to drive up to eight servos (can be expanded to 16)
  • SPI master for the Baby-O (though the Orangutan could probably use this as well through the ISP header)
  • UART-based SPI master for the Baby-O (I don’t think the other Orangutans bring the UART’s synchronous clock out to a header)
  • Code to use the hardware UART using a modified version of Pascal Stang’s code

The docs are an improvement over the 0.2 release, but they’re still what I’d call sketchy. If there’s a particular point that’s confusing, please let me know and I’ll re-write it. (Or in several instances, I’ll write it in the first place… docs are not complete.)

If you wind up using the library and need particular functionality, please do let me know. I’m happy to go after particulars.

If you see a big glaring flaw with anything in the library, please PLEASE let me know. Only way it’s going to get fixed. Turns out the 0.2 release had some heinous problems in the LCD code that I didn’t catch. I’m still trying to figure out how it ran at all. If something doesn’t work, I’d be more than happy to fix it. But if I don’t know it’s broken I won’t know it needs fixing.

If you like living on the raw hairy edge of things, the working source for the library is in a Subversion tree on Sourceforge. It’s public, you can grab the latest greatest, likely horribly broken source any time you want. There are some advantages to this since bug fixes really do happen (really really!) and get checked into the Subversion tree. But do so at your own risk. I’ve had to check in broken code enough times I’ve given up wincing when I do.

Fair warning, the coding practices in the library are not the best. When push came to shove, readability was ranked higher than efficiency. (And when bugs pushed back “works” ranked higher than “pretty”.) There’s also a fair bit of overhead required to make the library generic for all three Orangutans, so chances are for a lot of it there’s a cleaner way to get the job done. (Pin change interrupt routines come to mind here…)

With one exception you should be able to use any compiler optimization flags you want on the library. That one exception is the UART code, which for some reason likes to optimize out its wait flag.

Orangutan-lib is still very much a work in progress. If it’s not doing what you want or it’s not everything you hoped it would be, please let me know, please be patient, and please have a sense of humor. I write better code when I’m laughing.

Have fun with your Orangutans!


1 Like

Thanks! I’ve linked orangutan-lib from the three orangutan pages.

- Ben

Whoa! Thanks!

And please, if you do find any glaring errors (or even not so glaring errors), please do let me know. Rather fix it than leave folks in a broken state.

Thanks again for the links!