GPIO Examples (Blocking API)
Overview
The blocking GPIO examples are available for both C and C++:
C:
examples/blocking_api/gpio/c/C++:
examples/blocking_api/gpio/cpp/
These examples are intended for both Supernova and Pulsar USB host adapters.
Hardware Setup
Required hardware:
One Binho Supernova or Pulsar
One Binho Breakout Board
Required wiring:
Short GPIO 1 and GPIO 3 together on the breakout board.
This loopback connection is required for digital readback and interrupt validation.
What The GPIO Examples Do
The C and C++ examples implement the same workflow:
Connect to the adapter and read device information.
Configure multiple GPIO pins as input/output and validate interrupt configuration behavior.
Verify digital write/read by driving
GPIO 3and readingGPIO 1.Set GPIO target voltage to
1800 mV.Register a GPIO notification callback.
Enable
GPIO 1interrupt on both edges.Toggle
GPIO 3and verify interrupts are received onGPIO 1.
Notification Callback Requirement
GPIO interrupt events are consumed through notifications. For this reason, the client must register a callback before starting the interrupt test:
C API:
CosmicSDK_onNotificationandCosmicSDK_notificationAsGpio.C++ API:
CosmicSDK::onNotificationandnotification.gpio().
Build and Run (GPIO C/C++)
GPIO example directories build binaries with the following names:
- C (
examples/blocking_api/gpio/c/): example_c_dynamicexample_c_static
- C (
- C++ (
examples/blocking_api/gpio/cpp/): example_cpp_dynamicexample_cpp_static
- C++ (
See also: