Function libmodbus_rs::prelude::get_float_cdab [] [src]

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

get_float_cdab - get a float value from 2 registers in CDAB byte order

The get_float_cdab() function shall get a float from 4 bytes with swapped bytes (CDAB 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_cdab(&[0xF147, 0x0020]), 123456.0);