MPLAB® Harmony v2 Device Drivers Overview

The basic driver operations allow an application to interact with a device, reading and writing data, as if it was a simple file. More specific operations are present on most drivers and the kind of specific operations available depends on the peripheral whose functionality is being exposed by the driver. A driver has the following fundamental responsibilities:

  • Providing a highly-abstracted interface to a peripheral
  • Controlling access to a peripheral
  • Managing the state of a peripheral

The following diagram illustrates how a driver interacts with the other pieces of the system:

  • Drivers are used directly by your application code, middleware (TCP/IP, USB, etc…), system services, and other drivers (SD Card Driver to SPI Driver).
  • The driver calls various system services to perform the tasks that are possibly shared across other drivers (Interrupts and Timers).
  • The driver also calls the peripheral library of the peripheral to which it is abstracting the interface.
  • Driver State machine can be invoked by the system task service (polling system) or the driver state machine can be invoked from an interrupt service routine.
harmony_blocks.png

If you would like to see an example of how a Device Driver is used to control a specific peripheral, please click on the following link.

 
USART Drivers
Learn more >