set_value & notify_value with i16 and other values?
Gibbz opened this issue · 1 comments
Gibbz commented
Im trying to send values to my device from the nrf using set_value(handle: u16, val: &[u8])
and notify_value(conn: &Connection, handle: u16, val: &[u8])
but they both take a u8 object.
How do I set an i16 value? Also I will want to send other values, string etc later too....
Ive tried using a bitshift to split the i16 into 2 u8. But that gives the error Raw(DataSize)
// bitshift a 16 bit number into two 8 bit numbers
pub fn shift_split_u16(short_16: i16) -> [u8; 2] {
[(short_16 >> 8) as u8, (short_16 & 0xff) as u8]
}
Gibbz commented
For some reason it's working now! Confused
I wish for better documentation and examples 👍