Skip to main content

function_value

Function function_value 

Source
pub fn function_value(on: bool) -> u16
Expand description

Function number helpers: F0..F28 map directly to function addresses 0..28.

Returns the Command::SetFunction value for an on/off function: 1 for on, 0 for off.

use rolcb::traction::{function_value, Command};

let headlight_on = Command::SetFunction { addr: 0, value: function_value(true) };
assert_eq!(headlight_on.encode(), [0x01, 0, 0, 0, 0, 1]);