# MIOS32_DIN

## Functions
s32 | MIOS32_DIN_Init (u32 mode)
s32 | MIOS32_DIN_PinGet (u32 pin)
s32 | MIOS32_DIN_SRGet (u32 sr)
u8 | MIOS32_DIN_SRChangedGetAndClear (u32 sr, u8 mask)
s32 | MIOS32_DIN_Handler (void *_callback)

## Detailed Description

DIN functions for MIOS32

## Function Documentation

s32 MIOS32_DIN_Handler | ( | void * | _callback | ) |

Checks for pin changes, and calls given callback function with following parameters:

       void DIN_NotifyToggle(u32 pin, u32 value)

Parameters:

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

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 MIOS32_DIN_Init | ( | u32 | mode | ) |

Initializes DIN driver

Parameters:

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

Returns:
  < 0 if initialisation failed

s32 MIOS32_DIN_PinGet | ( | u32 | pin | ) |

Returns state of a DIN pin

Parameters:

  `[in]` | pin | number (0..127)

Returns:
  1 if pin is Vss (ie. 5V)
  0 if pin is 0V
  -1 if pin not available

Here is the call graph for this function:

u8 MIOS32_DIN_SRChangedGetAndClear | ( | u32 | sr,
|  | u8 | mask |
| ) |  |  |

Returns the DIN pin toggle notifications after a SRIO scan. Should be used to check and clear these flags when processed by a DIN handler for exclusive access (avoid propagation of already handled DIN pin changes)

Examples:
1) if a scan matrix handler processes the DIN pins of the first SR, it should call

       changed = MIOS32_DIN_SRChangedGetAndClear(0, 0xff)

to get a notification, if (and which) pins have toggled during the last scan. The flags will be cleared, so that the remaining handlers won't process the pins of the first DIN register anymore.

2) it's also possible, to check and clear only dedicated pins of the DIN register by applying a different pin mask. E.g.

       changed = MIOS32_DIN_SRChangedGetAndClear(0, 0xc0)

will only check/clear D6 and D7 of the DIN register, the remaining toggle notifications won't be touched and will be forwarded to remaining handlers

Parameters:

  `[in]` | sr | shift register number (0..15)
  `[in]` | mask | pin mask (8bit value)

Returns:
  8bit value which contains the selected (masked) change flags
  no error status (-1)! - if unavailable SR selected, 0x00 will be returned

Here is the call graph for this function:

s32 MIOS32_DIN_SRGet | ( | u32 | sr | ) |

Returns state of a DIN shift register

Parameters:

  `[in]` | sr | shift register number (0..15)

Returns:
  8bit value of shift register
  -1 if shift register not available

Here is the call graph for this function: