main.c
depends on matter_commission.h matter_fab_settings.h
API
Fstatic void heap_peak_log(const char *when)
Reported at the grant, because by then the unlock has done every P-256 and AES-GCM operation it is going to do. The peak is cumulative since boot, so it covers BLE pairing and the Aliro exchange too, not only the ranging.
mainFstatic bool provisioning_requested(void)
Check GPIO SW0 (active-low, pulled up in DTS) to see if provisioning is requested at boot. Returns true if SW0 is ready and held (logical 1), false otherwise.
mainFstatic void provisioning_mode(void)
Runs the console and nothing else. Never returns: leaving this function would start the radios in a mode the user did not ask for.
mainFstatic void factory_reset_if_requested(void)
Check GPIO SW0 (active-low, pulled up in DTS) at boot. If SW0 is held (logical 1), toggle LED0 six times at 120 ms intervals as user feedback, erase Aliro provisioning and Matter fabric (if CONFIG_ALIRO_MATTER_BLE is on), and log that the board is now commissionable on the next boot. Returns silently if GPIO is not ready or if SW0 is not held.
mainFint main(void)
Entry point for the DWM3001CDK reader application. Initializes provisioning and factory-reset paths, starts the Aliro BLE reader and optional Matter commissioning and DFU receiver, then runs the approach controller loop. Feeds the controller trusted ranges on each new latch generation and observes untrusted ranges for departure detection. Grants unlock on approach prediction or threshold crossing, relocks on departure or abort, and exits with an error code if reader startup fails.
factory_reset_if_requested, heap_peak_log, provisioning_mode, provisioning_requested