5 * Loosely modelled after AVR-RS485 by Yoshinori Kohyama (http://algobit.jp/),
6 * available at https://github.com/kohyama/AVR-RS485/
8 * All bugs by Jan "Yenya" Kasprzak <kas@fi.muni.cz> :-)
12 * Call this at the beginning of the program.
14 void modbus_init(uint8_t unit_id);
17 * Call this frequently. Returns 0 when no data was received
18 * and the processing went on quickly. Returns 1 after potentially lengthy
21 uint8_t modbus_poll();
30 #define MB_HOLD_REGS_BASE 0 // first register
31 #define MB_N_HOLD_REGS 80 // total # of registers
32 #define MB_N_HOLD_REGS_EEPROM 20 // the first N registers eeprom-backed
33 extern uint16_t hold_regs[MB_N_HOLD_REGS];
34 #define mb_unit_id (hold_regs[0]) // MODBUS id in the first register
36 uint8_t hold_reg_is_valid(uint16_t reg, uint16_t val);
38 #endif /* MODBUS_H__ */