7 Tips for Developing Great APIs: Page 2 of 2

The embedded software industry is changing and that change is requiring developers to start working at higher levels of abstraction which requires designing and creating application programming interfaces that allow software to be reused. Embedded design

and use but also contains the most common elements that developers need during their development. There are times when there may be uncommon features that developers will want to use in the microcontroller, such as a GPIO hardware debounce that every microcontroller may not have. In these cases, developers will want to make sure they have a mechanism built into their API’s that allow the interface to be extended. This can be done by allowing a pointer to a new interface structure or by creating register accesses into an API that allow low level manipulation and higher level interfaces to be created.

7. Build Interrupt Handling into the API

In order to make sure interrupts are handled properly, it is easier for the API developer to handle interrupts internal to the API so that interrupts are a black box to the API user. This means that there needs to be a mechanism used to assign functions to interrupt handlers in the higher-level application code. One way to do this is to add callback registration into the API so that interrupts can be assigned their executable code in the application code. This allows the API to ensure that interrupts are handled properly, but also allow developers to override those defaults with their own custom code.


Developing API’s and HAL’s are nearly a requirement now if developers want to decrease costs and time to market. Microcontrollers have reached a level of complexity, performance, and capability that are comparable to early x86 microprocessors. With such complexity in systems today, designing API’s to maximize code reuse is a must. These seven tips should help developers looking to reuse their own code more able to developer their own API’s and HAL’s.

To learn more about API and HAL design, listen to the Design News/Digi-Key Continuing Education Course “ Designing API's and HAL's for Real-time Embedded Systems .”

Jacob Beningo is an embedded software consultant who currently works with clients in more than a dozen countries to dramatically transform their businesses by improving product quality, cost and time to market. He has published more than 200 articles on embedded software development techniques, is a sought-after speaker and technical trainer and holds three degrees which include a Masters of Engineering from the University of Michigan. Feel free to contact him at [email protected], at his website www.beningo.com/, and sign-up for his monthly Embedded Bytes Newsletter .


ESC, Embedded Systems Conference, BostonBootloader Design Techniques for Microcontrollers. 
Remotely updating firmware is a critical for any embedded system and even more so for an IoT device. Bootloaders are often added along side application code to facilitate firmware updates but very few developers truly understand how to build one robustly. Join Jacob Beningo as he examines the fundamental challenges facing software engineers in performing updates in a secure and safe manner during his half-day tutorial, "Bootloader Design Techniques for Microcontrollers" at ESC Boston 2017 , May 3-4. Register today !





Add new comment

By submitting this form, you accept the Mollom privacy policy.