as5048a-async 0.1.0

Async driver for AS5048A 14-bit magnetic rotary position sensor with SPI interface
Documentation
1
2
3
4
5
6
7
8
9
10
/// Calculate even parity bit for the lower 15 bits of a 16-bit value
pub fn calculate_parity(value: u16) -> bool {
    let bits = value & 0x7FFF;
    bits.count_ones() % 2 == 1
}

/// Verify even parity of a 16-bit frame
pub fn verify_parity(frame: u16) -> bool {
    frame.count_ones().is_multiple_of(2)
}