Communication with peripheral devices is an essential part of any embedded application. Applications need to check the availability and status and send data to and receive data from a variety of devices.
Each target platform is different and many ways of connecting peripheral devices to the computing unit exist. There are, however, several hardware and software interfaces that have become industry standard for communication with peripheral devices. In this chapter, we will learn how to work with peripheral devices connected directly to processor pins or over serial interfaces. This chapter covers the following topics:
- Controlling devices connected via GPIO
- Exploring pulse-width modulation
- Using ioctl to access a real-time clock in Linux
- Using libgpiod to control GPIO pins
- Controlling I2C peripheral devices
The recipes in this chapter involve interaction...