Index: dialin/utils/conversions.py =================================================================== diff -u -r4246daa42e5c2ff25d4cc03ffc8507f40ec22119 -rf35a0d2a3223a6f7bd7a1eaad64cdb130b07a8d9 --- dialin/utils/conversions.py (.../conversions.py) (revision 4246daa42e5c2ff25d4cc03ffc8507f40ec22119) +++ dialin/utils/conversions.py (.../conversions.py) (revision f35a0d2a3223a6f7bd7a1eaad64cdb130b07a8d9) @@ -14,7 +14,7 @@ # ############################################################################ import struct -from typing import List +from typing import List, Union def byte_to_bytearray(val: int) -> bytes: @@ -41,11 +41,11 @@ return struct.pack(" bytes: +def integer_to_bytearray(val: Union[int, bool]) -> bytes: """ Converts an integer value into a byte array (little endian) - @param val: (int) integer to convert to byte array + @param val: integer to convert to byte array, bool is accepted @return: byte array """ if type(val) != bool and type(val) != int: @@ -65,14 +65,14 @@ return struct.pack(" bytes: +def float_to_bytearray(val: Union[float, int]) -> bytes: """ Converts a float value into a byte array (little endian) - @param val: (float) to convert to byte array + @param val: float to convert to byte array, int is accepted @return:: byte array """ - if type(val) != float: + if type(val) != float and type(val) != int: raise ValueError("Expected float but received {0} with type {1}".format(val, type(val))) return struct.pack('