GPIO Blink Application
Overview
The GPIO Blink application is a simple demonstration program that showcases the basic operation of GPIO pins using the NetBurner PinIO class. This example blinks one of the indicator LEDs on the device carrier board in a continuous loop.
- Note
- This example uses a bsp include file for LED pin mapping: #include <bsp_devboard.h> // A project header that contains the mapping of LED pins
Application Details
Application Name:** Blink
Purpose:** Basic GPIO pin control demonstration
Target Platform:** NetBurner embedded systems
Functionality
The application performs the following operations:
- System Initialization: Initializes the NetBurner system and enables system diagnostics
- Status Output: Displays the application name and NNDK revision information via serial output
- GPIO Configuration: Configures LED1 pin as a GPIO output
- LED Blinking Loop: Continuously blinks the LED with the following pattern:
- Turn LED ON (drive pin LOW) for 1 second
- Turn LED OFF (drive pin HIGH) for 1 second
- Repeat indefinitely
Code Structure
Key Components
- System Headers: Includes necessary NetBurner system libraries for initialization, timing, and GPIO control
- Pin Configuration: Uses the PinIO class to configure and control GPIO pins
- BSP Integration: Leverages board support package definitions for LED pin mapping
- RTOS Integration: Utilizes NetBurner RTOS timing functions for precise delays
Main Functions
UserMain()
: The primary application entry point that handles all initialization and the main execution loop
- LED control through direct pin assignment operations
- System diagnostic output for debugging and monitoring
Hardware Requirements
- NetBurner development board with carrier board
- At least one indicator LED (LED1) available on the carrier board
- Serial connection for viewing diagnostic output
Technical Notes
This example is intentionally simplified to demonstrate basic GPIO concepts. For more advanced GPIO usage, refer to:
- GpioServer Example: More comprehensive GPIO functionality demonstration
- PinIO Documentation: Complete API reference for the PinIO class
- Platform Specific Examples: GPIO examples tailored to specific NetBurner platforms
Build Requirements
- NetBurner NNDK (NetBurner Network Development Kit)
- Compatible NetBurner hardware platform
- Standard NetBurner development environment
Usage
- Compile and load the application onto your NetBurner device
- Connect a serial terminal to view system output
- Observe LED1 blinking at 1-second intervals
- Monitor serial output for application name and NNDK version information
Expected Output
Serial console will display:
Application: Blink
NNDK Revision: [Current NNDK Version]
The LED1 indicator will blink continuously with a 1-second on/off cycle.
Learning Objectives
This example teaches:
- Basic GPIO pin configuration using PinIO class
- Simple output control for driving LEDs
- NetBurner system initialization procedures
- RTOS timing and delay functions
- Board support package integration
Further Development
While this example covers basic GPIO output, the PinIO class supports many additional features including input reading, interrupt handling, and advanced pin functions. Consult the NetBurner documentation for expanded GPIO capabilities and platform-specific implementations. Please refer to the "Example Applications > Platform Specific" section of the NetBurner Documentation for additional GPIO examples specific to your particular NetBurner platform.