Skip to main content

Low-Level Hardware Drivers in C++

  • Chapter
  • First Online:
Real-Time C++
  • 4898 Accesses

Abstract

Microcontroller applications usually require low-level drivers for peripheral devices such as I/O ports, interrupts, timers, communication interfaces like UART, CAN [2], SPITM, etc. This chapter presents several efficient methods for programming peripheral hardware drivers in C++. Low-level drivers are inherently dependent on the microcontroller and its peripherals. Even though the low-level hardware drivers in this chapter are primarily designed for our target with the 8–bit microcontroller, an effort has been made to keep them as portable as possible. In this way, they can be adapted to other microcontrollers.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Notes

  1. 1.

    GNU compilers support numerous attributes for functions, variables, objects and types with its __attribute__() syntax. See [1] and [5] for additional details.

  2. 2.

    Note, however, that disabling the interrupts for too long or forgetting to re-enable them in a timely fashion may lead to a system crash with unpredictable results.

References

  1. Free Software Foundation, The GNU Compiler Collection Version 4.6.2 (2012), http://gcc.gnu.org

  2. ISO, ISO 11898–1:2003: Road Vehicles – Controller Area Network (CAN) – Part 1: Data Link Layer and Physical Signaling (International Organization for Standardization, Geneva, 2003)

    Google Scholar 

  3. ISO/IEC, ISO/IEC 9899:1999: Programming Languages – C (International Organization for Standardization, Geneva, 1999)

    Google Scholar 

  4. ISO/IEC, ISO/IEC 14882:2011: Information Technology – Programming Languages – C++ (International Organization for Standardization, Geneva, 2011)

    Google Scholar 

  5. W. van Hagen, The Definitive Guide to GCC (Apress, Berkeley, 2006)

    Book  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Kormanyos, C. (2013). Low-Level Hardware Drivers in C++. In: Real-Time C++. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-34688-0_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-34688-0_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-34687-3

  • Online ISBN: 978-3-642-34688-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics