/* Get the MODBUS function code from a telegram. */
static void modbus_get_function(struct modbus_slave *dev, uint8_t *req, uint8_t *func_index)
/* Get the MODBUS function code from a telegram. */
static void modbus_get_function(struct modbus_slave *dev, uint8_t *req, uint8_t *func_index)
{
	uint8_t function_number = sizeof(commands_array) /
				  sizeof(typeof(*commands_array));
	uint8_t i;
	for(i = 0; i < function_number; i++) {
		if(req[MODBUS_FUNCTION_PLACE] == commands_array[i])
			break;
	}
	*func_index = i;
}