Myriota Flex SDK 2.5.0
Loading...
Searching...
No Matches
Pulse Counter Example

This example demonstrates how to configure and use the Pulse Counter APIs.

#include <inttypes.h>
#include <stdio.h>
#include "flex.h"
#define APPLICATION_NAME "Pulse Counter Example"
// Number of pulses that will cause a wakeup event.
#define PULSE_WAKEUP_COUNT 6
static void RunsOnPulseCounterEvent() {
printf("Woken up by Pulse Counter @ %u\n", (unsigned int)FLEX_TimeGet());
printf("Current pulse counter value: %" PRIu32 "\n", (uint32_t)FLEX_PulseCounterGet());
}
void FLEX_AppInit() {
printf("%s\n", APPLICATION_NAME);
// Initialise to generate event every PULSE_WAKEUP_COUNT pulses
printf("Failed to initialise pulse counter\n");
}
// Enable pulse counter event
}