Function libmodbus_rs::prelude::get_float_dcba [] [src]

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

get_float_dcba - get a float value from 2 registers in DCBA byte order

The get_float_dcba() function shall get a float from 4 bytes with swapped bytes (DCBA 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_dcba(&[0x47F1, 0x2000]), 123456.0);