* All bugs by Jan "Yenya" Kasprzak <kas@fi.muni.cz> :-)
*/
+/*
+ * Call this at the beginning of the program.
+ */
void modbus_init(uint8_t unit_id);
-void modbus_poll();
+
+/*
+ * Call this frequently. Returns 0 when no data was received
+ * and the processing went on quickly. Returns 1 after potentially lengthy
+ * packet processing.
+ */
+uint8_t modbus_poll();
typedef enum {
MB_OK = 0,
} mb_exception;
#define MB_HOLD_REGS_BASE 1000
-#define MB_N_HOLD_REGS 40
+#define MB_N_HOLD_REGS 60
#define MB_N_HOLD_REGS_EEPROM 20
extern uint16_t hold_regs[MB_N_HOLD_REGS];
#define mb_unit_id (hold_regs[0])