• LOG IN
  • REGISTER
  • ISSUES

Make, Hack, Void

  • home
  • projects
  • news
  • community
Home

MHVLib

  • Home
  • Documentation
  • Source Browser
  • Tutorials
    • Installing Eclipse
    • Building with Make
    • Blinking LED
    • Unipolar Stepper Motor
  • Issues
  • Downloads

MHVLib - An Efficiency Oriented Runtime Library for AVR Microcontrollers

deece — Tue, 30/08/2011 - 12:44am

About

Having been frustrated with many of the inefficiencies of the Arduino core libraries, we have built an alternate set with performance and size in mind. Alastair has given a talk at the Canberra Linux User Group about this library - the slides can be viewed on SlideShare.

Much of the efficiency gains comes from addressing some of the key design deficiencies of the Arduino runtime - we do not store pin/port information in tables in flash, needlessly preallocate objects nor dictate that excessively large buffers must be used. Instead, control of these are handed over to the developer at compile time.

We recommend using cppcheck and the CPPCeclipse Eclipse Plugin for further bug checking in your code.

Design Philosophies

  • Design for the architecture
  • Favour efficiency over simplicity
  • Hide complexity using macros
  • Provide a rich API that exposes all likely usages that are expected
  • Fix all warnings!
  • Use appropriate datatypes, and use strict typing where possible to minimise the wrong variable being passed
  • Favour C++ references over pointers to reduce bad usage which can lead to crashes
  • Leverage inheritance to make generic routines available for all objects that need it
  • Expensive operations should be asynchronous where possible, so they run in the background while your code does other things
  • Enable an event driven approach
  • BSD licensed to encourage commercial use (there is a separate GPL project for ports of GPL software to MHVLib, such as V-USB)
     

Getting Started

We recommend developing your MHVlib projects in Eclipse. For instructions on how to do so, please see our tutorial.

We also have another tutorial showing how to build MHVlib using make from the command line.

Bootloader

If an Arduino-style bootloader is required, we recommend Optiboot, which clocks at only a quarter the size of the Arduino bootloader (0.5kb vs 2kb), and a programming baud rate of 115,200bps.

If USB is more your thing, you may want to consider USBaspLoader, which clocks in at 2kb (the same size as the Arduino bootloader), and pretends to be a USBasp programmer. This uses software USB (based on the V-USB library), removing the need for a USB->serial chip, and allows you to flash your chip over USB using AVRdude.

Download

You can grab the libraries from our GIT repository at git.makehackvoid.com:

git clone http://git.makehackvoid.com/mhvlib.git

To update later...

git pull

You can also grab a tarball from the releases at the bottom of the page.

Licensing

This software is licensed under the BSD license. This means you can do what you like with it, including distributing it with your own software licensed under different terms. The only restriction is that you attibute us for our work, and reproduce our copyright:

Copyright (c) 2011, Make, Hack, Void Inc
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
 * Neither the name of the Make, Hack, Void nor the
   names of its contributors may be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MAKE, HACK, VOID BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Whats Implemented

  • Digital I/O
  • Timers
  • Serial (both busy-waiting and asynchronous)
  • External Interrupts
  • PinChange Interrupts
  • Servo control
  • Analogue to digital
  • Hardware PWM
  • Gamma correction - calculate on the fly, or lookup tables (recommended)
  • Fast synchronous serial shifter
  • Software H Bridge for driving naked transistors (with PWM support)
  • Realtime Clock & event triggering
  • Debouncing (detect button presses, as well as held buttons)
  • Software PWM Matrix (for passive LED matrices)
  • HT1632 based LED matrix displays such as the Sure Electronics DE-DP105 (search for 0832 led matrix on Ebay)
  • HD44780 & compatible LCD character displays
  • Software controlled voltage regulator
  • EEPROM
  • Power Saving (via AVR LibC)
  • PID algorithm
  • Voltage Regulator (buck/boost controller)
  • USB Keyboard emulation (via V-USB)

Todo

  • Optimise servo library
  • Input Capture for timers
  • SPI
  • Full functionality of the Arduino runtime

Contributing

Send patches, bugs or suggestions to our bug tracker, or leave a comment.

Downloads

  • View all releasesRSS feed of all releases

Development

  • View pending patches

  • Login or register to post comments
  • Printer-friendly version

Search

Member Tweets

geoff_swan
1 day 8 hours ago — @soilduck #nom #nom #nom #cupcakes #mhv
soilduck
1 day 8 hours ago — This week in #MHV cupcake news, there will be plum cupcakes or cake! I haven't quite decided on which one yet. #noms ping @makehackvoid
projectgus
1 day 23 hours ago — No @MakeHackVoid attendance for me tonight, think I'm going to stay home and hack on home-bound things. Or, just sit here on the couch..
evildeece
2 days 19 hours ago — Blergh, ghetto hack did not result in a functioning machine... time to order a new media centre #mhv
geoff_swan
2 days 19 hours ago — Hot tip: when using solder don't eat food or touch eyes. #mhv
geoff_swan
2 days 20 hours ago — 2 down, 4 to go. #mhv http://t.co/6YPYn8YD
evildeece
2 days 20 hours ago — Ghetto hack to replace blown cap on a motherboard #mhv http://t.co/7K9zDQa0
geoff_swan
2 days 21 hours ago — Desk layout optimized, now just add a strong dark roasted malt and some flux and we can begin. #mhv #soldering http://t.co/RVbH2eXp
RuthEllison
3 days 35 min ago — @gavintapp @trib Yes http://t.co/V4VyVs2k and @MakeHackVoid /cc @evildeece
evildeece
3 days 10 hours ago — Intel's "Industrial Control in Concert", a robotic musical instrument that uses fired balls as actuators: http://t.co/YEpHBoS4 #mhv
  •  
  • 1 of 10
  • ››
more