# AINSER

## Functions
s32 | AINSER_Init (u32 mode)
s32 | AINSER_NumModulesGet (void)
s32 | AINSER_NumModulesSet (u8 num_modules)
s32 | AINSER_EnabledGet (u8 module)
s32 | AINSER_EnabledSet (u8 module, u8 enabled)
s32 | AINSER_MuxedGet (u8 module)
s32 | AINSER_MuxedSet (u8 module, u8 muxed)
s32 | AINSER_NumPinsGet (u8 module)
s32 | AINSER_NumPinsSet (u8 module, u8 num_pins)
s32 | AINSER_DeadbandGet (u8 module)
s32 | AINSER_DeadbandSet (u8 module, u8 deadband)
s32 | AINSER_PinGet (u8 module, u8 pin)
s32 | AINSER_PreviousPinValueGet (void)
s32 | AINSER_Handler (void(*_callback)(u32 module, u32 pin, u32 value))

## Detailed Description

AINSER module driver

## Function Documentation

s32 AINSER_DeadbandGet | ( | u8 | module | ) |

Returns:
  the deadband which is used to notify changes
  < 0 on error

s32 AINSER_DeadbandSet | ( | u8 | module,
|  | u8 | deadband |
| ) |  |  |

Sets the difference between last and current pot value which has to be achieved to trigger the callback function passed to AINSER_Handler()

Returns:
  < 0 on error

s32 AINSER_EnabledGet | ( | u8 | module | ) |

Returns:
  the enable mask for modules which should be scanned

s32 AINSER_EnabledSet | ( | u8 | module,
|  | u8 | enabled |
| ) |  |  |

Sets the enable mask for modules which should be scanned

s32 AINSER_Handler | ( | void(*)(u32 module, u32 pin, u32 value) | _callback | ) |

This function should be periodically called to scan AIN pin changes.

A scan of a single multiplexer selection takes ca. 50 uS on a LPC1769 with MIOS32_SPI_PRESCALER_8

Whenever a pin has changed, the given callback function will be called.
Example:

       void AINSER_NotifyChanged(u32 pin, u16 value);

Parameters:

  `[in]` | _callback | pointer to callback function

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 AINSER_Init | ( | u32 | mode | ) |

Initializes AINSER driver Should be called from Init() during startup

Parameters:

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

Returns:
  < 0 if initialisation failed

Here is the call graph for this function:

s32 AINSER_MuxedGet | ( | u8 | module | ) |

Return values:

  | 0 | if 1-to-8 multiplexers disabled for the given module
  | 1 | if 1-to-8 multiplexers enabled for the given module (default)

s32 AINSER_MuxedSet | ( | u8 | module,
|  | u8 | muxed |
| ) |  |  |

Enables/disables the 1-to-8 multiplexer handling.
Use muxed=0 for AINSER8 module, and muxed=1 for AINSER64 module (default)

s32 AINSER_NumModulesGet | ( | void |  | ) |

Returns:
  the number of modules which are scanned

s32 AINSER_NumModulesSet | ( | u8 | num_modules | ) |

Sets the number of modules which should be scanned

Returns:
  < 0 on error (e.g. unsupported number of modules)

s32 AINSER_NumPinsGet | ( | u8 | module | ) |

Returns:
  the number of AIN pins per module which are scanned

s32 AINSER_NumPinsSet | ( | u8 | module,
|  | u8 | num_pins |
| ) |  |  |

Sets the number of AIN pins per module which should be scanned

Returns:
  < 0 on error (e.g. unsupported number of pins)

s32 AINSER_PinGet | ( | u8 | module,
|  | u8 | pin |
| ) |  |  |

Returns:
  the AIN pin value of the given module and pin
  < 0 if wrong module or pin selected!

s32 AINSER_PreviousPinValueGet | ( | void |  | ) |

Returns:
  the previous value of the pin which has triggered the NotifyChanged hook.
  Only valid when function is called from this hook!