Skip to content

Digital Out Driver

The digital out driver provides abstraction for accessing GPIO individual pins as digital output.

Use the Digital Out Driver interface to configure and control a digital output pin by setting the pin to logic level low or high.

To use this library

Header: #include "drv_digital_out.h"

memake: MikroSDK.Driver


Before using other driver functions, user needs to define driver context variable and initialize it, as shown in the example below:

digital_out_t out_pin;

digital_out_init(&out_pin, PA11);

First parameter is the address of driver context structure, and second parameter is the name of the pin that will be configured as digital output. After the initialization, out_pin variable will be our handle for accessing the configured pin.

Default state

Default state of configured pin is logical low.

Changing pin state

For changing the pin state, driver provides several functions that can be used for setting the pin low / high, toggling it and writing a value directly to it.

Example for setting a pin to high logical level is shown below:


Example for setting a pin to low logical level is shown below:


Example for toggling a pin's logical level is shown below: