adi_encoder_init

Function adi_encoder_init 

Source
pub unsafe extern "C" fn adi_encoder_init(
    port_top: u8,
    port_bottom: u8,
    reverse: bool,
) -> i32
Expand description

Creates an encoder object and configures the specified ports accordingly.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of ADI Ports EADDRINUSE - The port is not configured as an encoder

\param port_top The “top” wire from the encoder sensor with the removable cover side up. This should be in port 1, 3, 5, or 7 (‘A’, ‘C’, ‘E’, or ‘G’). \param port_bottom The “bottom” wire from the encoder sensor \param reverse If “true”, the sensor will count in the opposite direction

\return An adi_encoder_t object to be stored and used for later calls to encoder functions