How to create a simple periodic non blocking timer in Embedded Rust

The following C code in the Arduino framework creates a simple periodic non-blocking 1 minute timer:

uint32_t currentMillis = 0;
uint32_t intervalMillis = 0;
void loop() { 
    currentMillis = millis();
    if (currentMillis - intervalMillis >= 60000) {
        intervalMillis = currentMillis;
        // run code every minute, such as reporting telemetry to cloud

The millis() function is available within the Arduino framework. How would one go about accessing a similar function within embedded Rust? ... Assuming one is using the STM32F3DISCOVERY board. Seems to be a pertinent question being that many people will be coming to embedded Rust from an Arduino perspective.

Also, is it discouraged to use such a process? Is it usually better to implement hardware interrupts instead? If so, is there a simple example of doing so.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.