---
title: "Omar Hiari (@omarhiari) | Hashnode"
description: "I am an 📟 Embedded Engineer with years of experience in both industry 🏭 and academia 🏫. Passionate Mentor 👨‍💼 and Instructor 👨‍🏫. Rustacean 🦀"
url: "https://hashnode.com/@omarhiari"
---

@omarhiari

# Omar Hiari

@omarhiari · Joined March 2022

[Website](https://www.theembeddedrustacean.com/)

## Comments

[Thanks for reading! To your comment, there has probably been a change in the interface, however, it makes sense. Resetting the interrupt enable is not unusual.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-interrupts/64f9e579c9aab703dd159b34/comment/65536c27fbdaaf31319ed323#reply-6553af8ffbdaaf31319edd3e)

Reply · Article · Nov 14, 2023 · [ESP32 Standard Library Embedded Rust: GPIO Interrupts](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-interrupts/64f9e579c9aab703dd159b34)

[Your welcome! If you check the pin name column in table 8 in the datasheet I shared there should be all the pins listed there. There also should be a column titled “alternate functions”. These are all the functions that each pin supports. If you look up the PA9 for example, you’ll see that TIM1\_CH2 is one of the functions it supports. You’ll need to find the same table for the F3 device.](https://hashnode.com/posts/embedded-rust-embassy-pwm-generation/638e065090845e1bd201fb6d/comment/65451b3931ab12d0f49ef3d5#reply-6545278531ab12d0f49ef585)

Reply · Article · Nov 3, 2023 · [Embedded Rust & Embassy: PWM Generation](https://hashnode.com/posts/embedded-rust-embassy-pwm-generation/638e065090845e1bd201fb6d)

[juebanlin I have created a full STM32 strictly hal-based series in the past that you can find here. There is also a series using the STM32 with embassy. The closest example to what you are looking for is probably the ultrasonic measurement with timers. Regarding more examples, that is always a goal, but time is always tight, and I am always trying my best to generate more. As for the FG input, I don't have such hardware readily available but the concept of how to measure is largely similar to examples I already developed. For example, the earlier example I shared about the squarewave generator input connected the ESP, that would be exactly the same logic you would utilize to measure the frequency of an FG signal.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-pwm-servo-motor-sweep/64d5f086de5e3e6bcfc23c0c/comment/650273bd6c527edfe705ffc9#reply-650317416c527edfe706134d)

Reply · Article · Sep 14, 2023 · [ESP32 Standard Library Embedded Rust: PWM Servo Motor Sweep](https://hashnode.com/posts/esp32-standard-library-embedded-rust-pwm-servo-motor-sweep/64d5f086de5e3e6bcfc23c0c)

[Hello juebanlin and thanks for reading. There are several ways to achieve that. I Ideally, I would use something like input capture mode in a timer. However, the last I used the STM HALs most, if not all, did not support input capture mode yet. I figure you can implement using the PAC, but that might be a bit of a hassle. Another way around it is by using GPIO similar to something in this post. Although using ESP, it should map more or less in a similar manner to the STM. Also, you can achieve the same using GPIO interrupts if you want to avoid polling. The ISR would instead inform you that the event happened.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-pwm-servo-motor-sweep/64d5f086de5e3e6bcfc23c0c/comment/650273bd6c527edfe705ffc9#reply-6502c64d6c527edfe706089b)

Reply · Article · Sep 14, 2023 · [ESP32 Standard Library Embedded Rust: PWM Servo Motor Sweep](https://hashnode.com/posts/esp32-standard-library-embedded-rust-pwm-servo-motor-sweep/64d5f086de5e3e6bcfc23c0c)

[Thanks for pointing it out. I actually haven't tested for that case, however, it seems that dividing by zero in floating point (f32 or f64) does not panic in Rust. Instead, it results in a NaN (Not a Number) and continues operation. Here's where I found some insight: https://users.rust-lang.org/t/how-should-i-handle-f64-division-by-zero-panic-elegantly/32485 https://internals.rust-lang.org/t/should-x-0-be-an-error/2252](https://hashnode.com/posts/esp32-standard-library-embedded-rust-analog-temperature-sensing-using-the-adc/64df0bf057b35200b444521c/comment/64e730762a4db2f7752735bb#reply-64e733962a4db2f775273654)

Reply · Article · Aug 24, 2023 · [ESP32 Standard Library Embedded Rust: Analog Temperature Sensing using the ADC](https://hashnode.com/posts/esp32-standard-library-embedded-rust-analog-temperature-sensing-using-the-adc/64df0bf057b35200b444521c)

[Hello, rain silent I am glad you liked it. One thing I wanted to do in the past related to your request is input capture to measure the frequency of external clock sources. It turns out at the time that the feature was not yet supported in various STM32 HALs. Nevertheless, it can still be done with software and GPIO. A very similar post you might find useful is the ultrasonic distance measurement, as it achieves something quite similar. Here is the link: https://apollolabsblog.hashnode.dev/stm32f4-embedded-rust-at-the-hal-timer-ultrasonic-distance-measurement](https://hashnode.com/posts/stm32f4-embedded-rust-at-the-hal-timer-interrupts/630cc3b556df9e8e502523bf/comment/64e42b1a965997cb76b4e6de#reply-64e6ee7b06aee9f0bdb500ba)

Reply · Article · Aug 24, 2023 · [STM32F4 Embedded Rust at the HAL: Timer Interrupts](https://hashnode.com/posts/stm32f4-embedded-rust-at-the-hal-timer-interrupts/630cc3b556df9e8e502523bf)

[Thanks Christian Foucher, I will adjust this. It's an artifact left over as I was experimenting with floating point before. I decided to avoid floating point operations but forgot to adjust this.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-timers/64cbb8ea099350c77ac6d8cd/comment/64d6348d764f843874c4564c#reply-64dc89124429385b928035c5)

Reply · Article · Aug 16, 2023 · [ESP32 Standard Library Embedded Rust: Timers](https://hashnode.com/posts/esp32-standard-library-embedded-rust-timers/64cbb8ea099350c77ac6d8cd)

[Thank you for your contribution Christian Foucher! Actually, yes, given all the different types in embedded and the singleton pattern, setting up function parameters can take a while to digestive. This is why I try to avoid them in beginner tutorials. Maybe it's a topic for a separate blog post. I revised your refactor and yes, I am printing the value regardless of the update. I will update the post and repo to incorporate this as an optimization.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-timers/64cbb8ea099350c77ac6d8cd/comment/64d6348d764f843874c4564c#reply-64d86dc9102c3648a77c823c)

Reply · Article · Aug 13, 2023 · [ESP32 Standard Library Embedded Rust: Timers](https://hashnode.com/posts/esp32-standard-library-embedded-rust-timers/64cbb8ea099350c77ac6d8cd)

[Thank you! I hope that you’ll find it better. Rust has a steeper curve for sure, especially in embedded, though I feel it’s getting better as the ecosystem, including educational material, is growing.](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2/comment/64c41058917e545aeed98bb5#reply-64c49f05cbf7a460bdc58b05)

Reply · Article · Jul 29, 2023 · [ESP32 Standard Library Embedded Rust: GPIO Control](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2)

[Thank you for reading Mariusz Białończyk! Your doubt is in its place. Since I hooked up the sensor to 5V power then the TTL output levels of the ECHO pin will reach 5V. While pins typically have internal protection, this would still expose them to potential damage. No need to mention, it didn't matter in the simulation. As such, there are two options to address this; either a voltage divider like you indicated to shift the 5V range to a 3.3V range or use a 3.3V compatible device. However, for the latter, I think the accuracy is not as good as the 5V sensors. I adjusted the diagram in Wokwi to include the voltage divider.](https://hashnode.com/posts/esp32-embedded-rust-at-the-hal-timer-ultrasonic-distance-measurement/6465e8f538c36ad305c2c12f/comment/64bf5564453a851c7eb95de9#reply-64bf7a50c6ba3a1b3898617a)

Reply · Article · Jul 25, 2023 · [ESP32 Embedded Rust at the HAL: Timer Ultrasonic Distance Measurement](https://hashnode.com/posts/esp32-embedded-rust-at-the-hal-timer-ultrasonic-distance-measurement/6465e8f538c36ad305c2c12f)
