|
ELEC-C7222
Libraries for ELEC C7222 Course Work
|
Minimal BLE GAP example (FreeRTOS). More...
#include <cassert>#include <cstdint>#include <cstdio>#include "advertisement_data.hpp"#include "../common/gap_event_handler.hpp"#include "ble.hpp"#include "freertos_task.hpp"#include "gap.hpp"#include "onboard_led.hpp"#include "pico/stdlib.h"#include "platform.hpp"
Functions | |
| static void | on_turn_on () |
| Callback executed when the BLE stack is fully initialized. | |
| void | ble_app_task (void *params) |
| FreeRTOS task that owns BLE initialization and periodic updates. | |
| int | main () |
| Program entry point. | |
Variables | |
| static c7222::OnBoardLED * | onboard_led = nullptr |
| On-board LED used as a heartbeat while advertising. | |
| static c7222::Platform * | platform = nullptr |
| Platform abstraction (initializes CYW43/BTstack). | |
| static GapEventHandler | gap_event_handler |
| Common GAP event handler used for logging. | |
Minimal BLE GAP example (FreeRTOS).
This example focuses purely on GAP functionality: setting up advertising, registering a GAP event handler, and periodically updating manufacturer data.
Dependencies:
GapEventHandler from examples/ble/common/gap_event_handler.hpp is used to log GAP events (advertising, scanning, connections). It provides a lightweight, reusable handler for examples.c7222::Ble and c7222::Gap encapsulate BTstack and provide the APIs for advertising and data updates.c7222::OnBoardLED provides a visible heartbeat while advertising.c7222::FreeRtosTask wrapper is used for task lifecycle and delay/tick helpers. | void ble_app_task | ( | void * | params | ) |
FreeRTOS task that owns BLE initialization and periodic updates.
Initializes the BLE stack, registers the stack-on callback, then periodically refreshes manufacturer data while advertising is enabled. The LED toggles as a heartbeat to confirm the task is running.


| int main | ( | void | ) |
Program entry point.

|
static |
Callback executed when the BLE stack is fully initialized.
Steps:


|
static |
Common GAP event handler used for logging.
|
static |
On-board LED used as a heartbeat while advertising.
|
static |
Platform abstraction (initializes CYW43/BTstack).