Skip to content

bits is hard to use #12

Description

@brandonros
    const BAUD_DIVISOR: u16 = 104; // For 12MHz clock
    const HALF_BAUD_DIVISOR: u16 = 52; // For 12MHz clock
    let baud_max = bits::<U16>(BAUD_DIVISOR as u128);
    let baud_half = bits::<U16>(HALF_BAUD_DIVISOR as u128);
Brandons-MacBook-Air:uart_fpga brandon 2025-07-08 21:38:25 $ cargo check
    Checking uart_fpga v0.1.0 (/Users/brandon/Documents/coding/uart_fpga)
error[E0277]: the trait bound `u16: rhdl::prelude::Digital` is not satisfied
  --> src/main.rs:98:32
   |
87 | #[kernel]
   | --------- required by a bound introduced by this call
...
98 |     let baud_max = bits::<U16>(BAUD_DIVISOR as u128);
   |                                ^^^^^^^^^^^^ the trait `rhdl::prelude::Digital` is not implemented for `u16`
   |
   = help: the following other types implement trait `rhdl::prelude::Digital`:
             i128
             u128
             usize

error[E0277]: the trait bound `u16: rhdl::prelude::Digital` is not satisfied
  --> src/main.rs:99:33
   |
87 | #[kernel]
   | --------- required by a bound introduced by this call
...
99 |     let baud_half = bits::<U16>(HALF_BAUD_DIVISOR as u128);
   |                                 ^^^^^^^^^^^^^^^^^ the trait `rhdl::prelude::Digital` is not implemented for `u16`
   |
   = help: the following other types implement trait `rhdl::prelude::Digital`:
             i128
             u128
             usize

For more information about this error, try `rustc --explain E0277`.
error: could not compile `uart_fpga` (bin "uart_fpga") due to 2 previous errors

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions