Commit dc8ed400bb26b6ddbdbd30b532fd6c4fd72539cf

Authored by Stéphane Raimbault
1 parent b5d75be3

Rename nb_bits to nb_points for status values

Showing 1 changed file with 4 additions and 4 deletions
modbus/modbus.c
... ... @@ -1784,13 +1784,13 @@ void set_bits_from_byte(uint8_t *dest, int address, const uint8_t value)
1784 1784 }
1785 1785  
1786 1786 /* Sets many inputs/coils from a table of bytes (only the bits between
1787   - address and address + nb_bits are setted) */
1788   -void set_bits_from_bytes(uint8_t *dest, int address, int nb_bits, const uint8_t tab_byte[])
  1787 + address and address + nb_points are setted) */
  1788 +void set_bits_from_bytes(uint8_t *dest, int address, int nb_points, const uint8_t tab_byte[])
1789 1789 {
1790 1790 int i;
1791 1791 int shift = 0;
1792 1792  
1793   - for (i=address; i < address + nb_bits; i++) {
  1793 + for (i=address; i < address + nb_points; i++) {
1794 1794 dest[i] = tab_byte[(i - address) / 8] & (1 << shift) ? ON : OFF;
1795 1795 /* gcc doesn't like: shift = (++shift) % 8; */
1796 1796 shift++;
... ... @@ -1799,7 +1799,7 @@ void set_bits_from_bytes(uint8_t *dest, int address, int nb_bits, const uint8_t
1799 1799 }
1800 1800  
1801 1801 /* Gets the byte value from many inputs/coils.
1802   - To obtain a full byte, set nb_bits to 8. */
  1802 + To obtain a full byte, set nb_points to 8. */
1803 1803 uint8_t get_byte_from_bits(const uint8_t *src, int address, int nb_bits)
1804 1804 {
1805 1805 int i;
... ...