Introduction
MPLAB Harmony v3 drivers provide a simple and abstracted ‘C’ language interface to the peripherals and other system resources. Some functions are similar across on all the device drivers, while other functions are unique to a specific driver or peripheral. Driver interface functions are generally independent of the details of how a given peripheral is implemented on any specific hardware, or how many instances of that peripheral exist in each system. Applications can control and easily interact with the peripherals by calling the driver interface.
The following diagram illustrates the MPLAB Harmony v3 driver execution flow:
- System Initializes the device driver.
- Application calls the driver APIs.
- Driver starts its operation using peripheral libraries which is interacting with hardware.
- The driver state machine is run from the interrupt context or through continuously polling the device. For example, most of the MPLAB Harmony v3 peripheral drivers are interrupt driven, which means that the driver state machine doesn't wait in a loop for an operation to complete. The driver is notified through an interrupt, when the operation is complete. However, some drivers like the SD Card requires determining whether the SD Card is inserted or not, and most middle-ware has a state machine that runs from a super-loop.
- Driver finishes the operation and notifies the application.
MPLAB Harmony v3 enables users to configure the drivers in any one of these operating modes: Synchronous (Blocking) or Asynchronous (Non-Blocking). This document describes Synchronous and Asynchronous operating modes and how to use them.