35 dest[index+i] = (value & (1 << i)) ? 1 : 0;
42 const uint8_t *tab_byte)
47 for (i = index; i < index + nb_bits; i++) {
48 dest[i] = tab_byte[(i - index) / 8] & (1 << shift) ? 1 : 0;
69 for (i=0; i < nb_bits; i++) {
70 value |= (src[index+i] << i);
82 i = (((uint32_t)src[1]) << 16) + src[0];
83 memcpy(&f, &i,
sizeof(
float));
93 memcpy(&i, &f,
sizeof(uint32_t));
94 dest[0] = (uint16_t)i;
95 dest[1] = (uint16_t)(i >> 16);
void modbus_set_float(float f, uint16_t *dest)
void modbus_set_bits_from_byte(uint8_t *dest, int index, const uint8_t value)
void modbus_set_bits_from_bytes(uint8_t *dest, int index, unsigned int nb_bits, const uint8_t *tab_byte)
float modbus_get_float(const uint16_t *src)
uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb_bits)