Function libmodbus_rs::prelude::get_float_badc [] [src]

pub fn get_float_badc(src: &[u16]) -> f32

get_float_badc - get a float value from 2 registers in BADC byte order

The get_float_badc() function shall get a float from 4 bytes with swapped bytes (BADC instead of ABCD). The src slice mut contain two u16 values, for example, if the first word is set to 0x2000 and the second to 0x47F1, the float value will be read as 123456.0.

Return value

The function shall return a float.

Parameters

Examples

use libmodbus_rs::prelude::*;

assert_eq!(get_float_badc(&[0x2000, 0x47F1]), 123456.0);