MIOS32_ENC


Data Structures

union  enc_state_t

Functions

s32 MIOS32_ENC_Init (u32 mode)
s32 MIOS32_ENC_ConfigSet (u32 encoder, mios32_enc_config_t config)
mios32_enc_config_t MIOS32_ENC_ConfigGet (u32 encoder)
s32 MIOS32_ENC_StateSet (u32 encoder, u8 new_state)
s32 MIOS32_ENC_StateGet (u32 encoder)
s32 MIOS32_ENC_UpdateStates (void)
s32 MIOS32_ENC_Handler (void *_callback)

Variables

mios32_enc_config_t enc_config [MIOS32_ENC_NUM_MAX]
enc_state_t enc_state [MIOS32_ENC_NUM_MAX]

Detailed Description

Rotary Encoder functions for MIOS32

Function Documentation

mios32_enc_config_t MIOS32_ENC_ConfigGet ( u32  encoder  ) 

Returns encoder configuration

Parameters:
[in] encoder encoder number (0..MIOS32_ENC_NUM_MAX-1)
Returns:
enc_config.cfg.type encoder type (DISABLED/NON_DETENTED/DETENTED1..3)

enc_config.cfg.speed encoder speed mode (NORMAL/FAST/SLOW)

enc_config.cfg.speed_par speed parameter (0-7)

enc_config.cfg.sr shift register (1-16) or application control (0) for the case that encoders are directly connected to GPIO pins

enc_config.cfg.pos pin position of first pin (0, 2, 4 or 6)

s32 MIOS32_ENC_ConfigSet ( u32  encoder,
mios32_enc_config_t  config 
)

Configures Encoder

Parameters:
[in] encoder encoder number (0..MIOS32_ENC_NUM_MAX-1)
[in] config a structure with following members:
  • enc_config.cfg.type: encoder type (DISABLED/NON_DETENTED/DETENTED1..3)
  • enc_config.cfg.speed encoder speed mode (NORMAL/FAST/SLOW)
  • enc_config.cfg.speed_par speed parameter (0-7)
  • enc_config.cfg.sr shift register (1-16) or application control (0) for the case that encoders are directly connected to GPIO pins
  • enc_config.cfg.pos pin position of first pin (0, 2, 4 or 6)
Returns:
< 0 if initialisation failed

s32 MIOS32_ENC_Handler ( void *  _callback  ) 

This handler checks for encoder movements, and calls the given callback function with following parameters on encoder movements:

   void ENC_NotifyToggle(u32 encoder, s32 incrementer)
Parameters:
[in] _callback pointer to callback function
Returns:
< 0 on errors

s32 MIOS32_ENC_Init ( u32  mode  ) 

Initializes encoder driver

Parameters:
[in] mode currently only mode 0 supported
Returns:
< 0 if initialisation failed

s32 MIOS32_ENC_StateGet ( u32  encoder  ) 

This function is only intented for debugging purposes - it returns the current state of the given encoder.

Parameters:
[in] encoder encoder number (0..MIOS32_ENC_NUM_MAX-1)
Returns:
< 0 on errors

s32 MIOS32_ENC_StateSet ( u32  encoder,
u8  new_state 
)

This function can be called from an application to update the state of an encoder that isn't connected to the SRIO chain (in this case, the appr. enc_config.cfg.sr field has to be set to 0!)

Usage examples can be found in following tutorials: 014b_enc_j5_relative and 015b_enc_j5_absolute

Parameters:
[in] encoder encoder number (0..MIOS32_ENC_NUM_MAX-1)
[in] new_state two bits with the new encoder pin values
Returns:
< 0 on errors

s32 MIOS32_ENC_UpdateStates ( void   ) 

This function has to be called after a SRIO scan to update encoder states

Returns:
< 0 on errors


Variable Documentation

mios32_enc_config_t enc_config[MIOS32_ENC_NUM_MAX]

enc_state_t enc_state[MIOS32_ENC_NUM_MAX]


Generated on Tue May 1 19:42:14 2012 for MIOS32 by  doxygen 1.4.7