Electronics
DIT Adafruit FeatherM0 LED Library
The source code can be found on GitHub.
This library provides:
- A couple of convenient name definitions, like:
LED_PIN
the MCU pin the LED is connected to LED_ON
the signal level to write to the pin to turn the LED on LED_OFF
the signal level to write to the pin to switch the LED off so we don't have to look up the values all the time.
- The
LED_configure()
function, that configures the MCU pin, so it can drive the LED.
See the 01_Blink
tutorial for a demo on how to use the library.
Adafruit_FeatherM0_LED.h
Adafruit_FeatherM0_LED.c
In lines 41..48 we find the function LED_configure()
that configures a specific GPIO pin as a digital output pin.
- Line 43 creates a variable of the
port_config
type - This variable is initialized with the default port configuration in line 45
- Line 46 changes the configuration of our pin from the default input to output, so we can drive the LED.
- Line 47 writes the modified configuration to the port pin specified.