anchor.diff:      end,
       NewParams = maps:merge(Params, ParamsFromOpts),
       {ok, SetParams} = encode_packet(set_parameters, NewParams),
  -    uart:send(State#state.uart, SetParams),
  +    ftdi:sync_send(State#state.ftdi, SetParams),
       {next_state, wait_for_dmx, State};
   
   get_parameters({from_widget, received_dmx, _}, State) ->
  
positive.code:     end,
      NewParams = maps:merge(Params, ParamsFromOpts),
      {ok, SetParams} = encode_packet(set_parameters2, NewParams),
      uart:send(State#state.uart, SetParams),
      {ok, GetParams} = encode_packet(get_parameters, 0),
      uart:send(State#state.uart, GetParams),
      {next_state, get_parameters, State, ?DEFAULT_TIMEOUT};
  
  get_parameters2({from_widget, received_dmx, _}, State) ->
  
negative.code:     splice_dmx_change([I || <<I:1>> <= reverse_bits(Index)],
                        Changed, Data, <<>>).
  
  -spec match_device(enttec_widget_opts(), ftdi:device()) -> boolean().
  
  match_device(Opts, #{manufacturer := <<"ENTTEC">>,
                       description := <<"DMX USB PRO", _/binary>>,
                       serial := Serial}) ->
      case maps:get(serial, Opts, none) of
          none   -> true;
          Serial -> true;
          _      -> false
      end.
  
  init(Opts) ->
      {ok, Ftdi} = ftdi:new(),
  
      {ok, Devices} = ftdi:list_devices(Ftdi),
  
      [Dev|_] = lists:filter(fun(D) -> match_device(Opts, D) end, Devices),
  
      ok = ftdi:open(Ftdi, Dev),
  
      {ok, SendFull} = encode_packet(receive_dmx_on_change, send_always),
      ftdi:sync_send(Ftdi, SendFull),
      {ok, GetParams} = encode_packet(get_hw_version, none),
  
      ftdi:purge(Ftdi, rx),
      ftdi:sync_send(Ftdi, GetParams),
  
      ftdi:recv(Ftdi, 4),
      NewState = #state{ftdi = Ftdi, options = Opts},
      {ok, wait_for_hw_version, NewState, ?USB_PRO_TIMEOUT}.
  
  wait_for_hw_version({from_widget, get_hw_version, _Ver}, State) ->
      % Permission to publish the API key granted by ENTTEC.
      % Ticket reference: EU #DQA-88617-214
      {ok, EnableApi} = encode_packet(enable_api_v2, 16#BFC77FA4),
      ftdi:sync_send(State#state.ftdi, EnableApi),
      {ok, AssignPorts} = encode_packet(assign_ports, {1, 1}),
      ftdi:sync_send(State#state.ftdi, AssignPorts),
      {ok, GetParams} = encode_packet(get_parameters2, 0),
      ftdi:sync_send(State#state.ftdi, GetParams),
      {next_state, get_parameters2, State, ?DEFAULT_TIMEOUT};
  
  wait_for_hw_version(timeout, State) ->
      {ok, GetParams} = encode_packet(get_parameters, 0),
      ftdi:sync_send(State#state.ftdi, GetParams),
      {next_state, get_parameters, State, ?DEFAULT_TIMEOUT};
  
  wait_for_hw_version({from_widget, received_dmx, _}, State) ->
  