Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

07-uart code refactor #583

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

A-Young-Git
Copy link

Context: With recent updates to Rust’s embedded libraries, compatibility issues arose due to older versions of embedded-hal and associated dependencies. This refactor updates the project to utilize the latest libraries, ensuring both compatibility and enhanced functionality.

Key Refactoring Points:

  1. Updated Serial Communication:
  • Replaced the existing embedded-hal serial interfaces with the updated embedded-hal-nb::nb and embedded-hal-nb::serial modules, as well as embedded-io.

This update aligns the project with the latest embedded-hal standards, enhancing future compatibility and maintaining consistency with the broader embedded Rust ecosystem.

use embedded_hal_nb::nb;
use embedded_hal_nb::serial::{Error as SerialError, ErrorType, Read, Write};
use embedded_io::{Read as EmbeddedIoRead, Write as EmbeddedIoWrite};

  1. Refactored Static Buffers:
  • Updated tx and rx buffer static constants to utilize core::ptr::addr_of_mut, a safer and more flexible way to handle mutable pointers in Rust’s core library.

This change improves the handling of memory addresses, ensuring a more robust and maintainable codebase, especially in the context of embedded programming where direct memory manipulation is common.

  1. Dependency Version Updates:
  • Updated all dependencies in Cargo.toml to the latest compatible versions. This includes major updates like embedded-hal moving from version 0.2.6 to 1.0.0 and other libraries such as microbit-v2 and cortex-m.

These updates ensure compatibility with recent Rust releases and align with the latest improvements in the ecosystem.

@A-Young-Git A-Young-Git requested a review from a team as a code owner October 27, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant