# MIOS32_MF

## Data Structures
union | mf_state_t
## Defines
#define | REPEAT_CTR_RELOAD 31
#define | TIMEOUT_CTR_RELOAD 255
#define | MANUAL_MOVE_CTR_RELOAD 255
## Functions
s32 | MIOS32_MF_Init (u32 mode)
s32 | MIOS32_MF_FaderMove (u32 mf, u16 pos)
s32 | MIOS32_MF_FaderDirectMove (u32 mf, mios32_mf_direction_t direction)
s32 | MIOS32_MF_SuspendSet (u32 mf, u8 suspend)
s32 | MIOS32_MF_SuspendGet (u32 mf)
s32 | MIOS32_MF_TouchDetectionReset (u32 mf)
s32 | MIOS32_MF_ConfigSet (u32 mf, mios32_mf_config_t config)
mios32_mf_config_t | MIOS32_MF_ConfigGet (u32 mf)
s32 | MIOS32_MF_Tick (u16 *ain_values, u16 *ain_deltas)

## Detailed Description

Motorfader functions for MIOS32

## Define Documentation

#define MANUAL_MOVE_CTR_RELOAD 255

#define REPEAT_CTR_RELOAD 31

#define TIMEOUT_CTR_RELOAD 255

## Function Documentation

mios32_mf_config_t MIOS32_MF_ConfigGet | ( | u32 | mf | ) |

returns the MF configuration

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)

Returns:
  mf_config.deadband
  mf_config.pwm_period
  mf_config.pwm_duty_cycle_up
  mf_config.pwm_duty_cycle_down

s32 MIOS32_MF_ConfigSet | ( | u32 | mf,
|  | mios32_mf_config_t | config |
| ) |  |  |

This function configures various MF driver parameters.
see http://www.ucapps.de/mbhp_mf.html for detailed informations about these parameters.

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)
  `[in]` | config | a structure with following members: mf_config.deadband mf_config.pwm_period mf_config.pwm_duty_cycle_up mf_config.pwm_duty_cycle_down

Returns:
  -1 if motor doesn't exist

s32 MIOS32_MF_FaderDirectMove | ( | u32 | mf,
|  | mios32_mf_direction_t | direction |
| ) |  |  |

direct control over the motorfader

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)
  `[in]` | direction | is MF_Standby, MF_Up or MF_Down

Returns:
  -1 if motor doesn't exist

Here is the call graph for this function:

s32 MIOS32_MF_FaderMove | ( | u32 | mf,
|  | u16 | pos |
| ) |  |  |

set target position and move fader

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)
  `[in]` | pos | motorfader position (resolution depends on the used AIN resolution, usually 12bit)

Returns:
  -1 if motor doesn't exist

Here is the call graph for this function:

s32 MIOS32_MF_Init | ( | u32 | mode | ) |

Initializes motorfader driver

Parameters:

  `[in]` | mode | currently only mode 0 supported

Returns:
  < 0 if initialisation failed

Here is the call graph for this function:

s32 MIOS32_MF_SuspendGet | ( | u32 | mf | ) |

returns the suspend state of the motor

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)

Returns:
  -1 if motor doesn't exist
  1 if motor suspended
  0 if motor not suspended

s32 MIOS32_MF_SuspendSet | ( | u32 | mf,
|  | u8 | suspend |
| ) |  |  |

activates/deactivates suspend mode of motor
(function used by touchsensor detection)

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)
  `[in]` | suspend | 1 to enable, 0 to disable suspend

Returns:
  -1 if motor doesn't exist

s32 MIOS32_MF_Tick | ( | u16 * | ain_values,
|  | u16 * | ain_deltas |
| ) |  |  |

Called from AIN DMA interrupt whenever new conversion results are available

Parameters:

  `[in]` | *ain_values | pointer to current conversion results
  `[in]` | *ain_deltas | pointer to differences between old and new results

Returns:
  -1 on errors
  >= 0: mask of 16 "changed" flags which should not cleared (if "changed" flag set, the AIN driver will propagate a new conversion value to the application hook)

Note:
  shouldn't be called directly from application

s32 MIOS32_MF_TouchDetectionReset | ( | u32 | mf | ) |

this function resets the software implemented touch detection, so that the fader is repositioned regardless if it is currently moved or not

Parameters:

  `[in]` | mf | motor number (0..MIOS32_MF_NUM-1)

Returns:
  -1 if motor doesn't exist