---
title: "Discussion on \"STM32F4 Embedded Rust at the HAL: The RTIC Framework\" | Hashnode"
description: "Discussion on \"STM32F4 Embedded Rust at the HAL: The RTIC Framework\". This blog post is the third of a three-part series of posts where I explore interrupts for the STM32F401RE microcontroller using embedded Rust at the HAL level.\n\nPast posts include (in order):\n\nSTM32F"
url: "https://hashnode.com/posts/stm32f4-embedded-rust-at-the-hal-the-rtic-framework/63162776d54563f8b19b03ec"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [STM32F4 Embedded Rust at the HAL: The RTIC Framework](https://blog.theembeddedrustacean.com/stm32f4-embedded-rust-at-the-hal-the-rtic-framework?utm_source=hashnode&utm_medium=feed)

This blog post is the third of a three-part series of posts where I explore interrupts for the STM32F401RE microcontroller using embedded Rust at the HAL level. Past posts include (in order): STM32F

Sep 5, 2022 · 16 min read · blog.theembeddedrustacean.com  
Updated Aug 3  
Read the article

-   [#rust](https://hashnode.com/tag/rust)
-   [#embedded](https://hashnode.com/tag/embedded)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

[Omar Hiari](https://hashnode.com/@omarhiari)

@omarhiari

  
[View profile](https://hashnode.com/@omarhiari)

I am an 📟 Embedded Engineer with years of experience in both industry 🏭 and academia 🏫. Passionate Mentor 👨‍💼 and Instructor 👨‍🏫. Rustacean 🦀

## Responses 1

Markdown supported · ⌘↵ to post

[Guilhem Pelissier](https://hashnode.com/@Seeveenn)

[Oct 12, 2022](https://hashnode.com/posts/stm32f4-embedded-rust-at-the-hal-the-rtic-framework/63162776d54563f8b19b03ec/comment/6346972bde139d2720692164)

Hello! First off, thank you very much for this series of articles, it's very helpful and nicely written.

I think I've found a small bug in the `button_pressed` task: it seems like the modification to the delay value is not saved in the local variable, and subsequent presses on the button don't decrease the value further (pressing the button always set the delay to 1500ms)

I've added the following line right after adjusting the delay value:

```
*ctx.local.delayval = delay;
```

and it seems like it fixes the problem.

Thank you once again for this series

[Omar Hiari](https://hashnode.com/@omarhiari)

[Oct 12, 2022](https://hashnode.com/posts/stm32f4-embedded-rust-at-the-hal-the-rtic-framework/63162776d54563f8b19b03ec/comment/6346972bde139d2720692164#reply-6346b22f81c6df26fb021d4f)

Thank you Guilhem! You are absolutely correct! I should have updated the `delayval` value in the global context after it gets modified in the task. Looks like I missed it when I tested it. I will adjust the post right away to reflect the correct code.
