anchor.diff:    PhaseB = gpio_utils:read_bool(GpioPinB_Ref),
     {ok, _LastB_Value} = attrib_utils:get_value(Private, last_B_value),
   
  -  {ok, GpioPinSwRef} = attrib_utils:get_value(Private, gpio_pin_sw_ref),
  -  SwValue = gpio_utils:read_bool(GpioPinSwRef),
  -  {ok, _LastSwValue} = attrib_utils:get_value(Private, last_sw_value),
  -  
     case attrib_utils:get_value(Outputs, value) of
  -    {ok, null} -> Count = 0;
  -    {ok, Count}      -> Count
  +    {ok, null}  -> Count = 0;
  +    {ok, Count} -> Count
     end,
    
     if (LastA_Value) andalso (not PhaseA) ->
  
positive.code:       _DoNothingB -> ok
    end,
  
    case attrib_utils:get_value(Private, gpio_pin_sw_ref) of
        {ok, GpioRefSw} -> gpio_utils:stop(GpioRefSw);
    
        _DoNothingSw -> ok
    end,
    {Config, Inputs, Outputs}.
  
  
  %% ====================================================================
  
negative.code: 
    
    {ok, Outputs1} = attrib_utils:set_values(Outputs, [{value, NewCount},
                                                {status, normal}]),
                                                
    {ok, Private1} = attrib_utils:set_values(Private, [{last_A_value, PhaseA},
                                                {last_B_value, PhaseB}]),
  
    % Return updated block state
    {Config, Inputs, Outputs1, Private1}.
  