# BLM

## Functions
s32 | BLM_Init (u32 mode)
s32 | BLM_ConfigSet (blm_config_t config)
blm_config_t | BLM_ConfigGet (void)
s32 | BLM_PrepareCol (void)
s32 | BLM_GetRow (void)
s32 | BLM_ButtonHandler (void *_notify_hook)
s32 | BLM_DIN_PinGet (u32 pin)
u8 | BLM_DIN_SRGet (u32 sr)
s32 | BLM_DOUT_PinSet (u32 colour, u32 pin, u32 value)
s32 | BLM_DOUT_PinGet (u32 colour, u32 pin)
s32 | BLM_DOUT_SRSet (u32 colour, u32 sr, u8 value)
u8 | BLM_DOUT_SRGet (u32 colour, u32 sr)
## Variables
u8 | blm_led_row [BLM_NUM_COLOURS][BLM_NUM_ROWS]

## Detailed Description

Button/Single/Duo/Triple (RGB)-LED driver

## Function Documentation

s32 BLM_ButtonHandler | ( | void * | _notify_hook | ) |

This function should be called from a task to check for button changes periodically. Events (change from 0->1 or from 1->0) will be notified via the given callback function <notify_hook> with following parameters: <notifcation-hook>(s32 pin, s32 value)

Returns:
  < 0 on errors

Here is the call graph for this function:

blm_config_t BLM_ConfigGet | ( | void |  | ) |

Returns current BLM configuration

Returns:
  config structure see BLM_ConfigSet()

s32 BLM_ConfigSet | ( | blm_config_t | config | ) |

Configures the BLM driver.

See blm.h for more informations

Parameters:

  `[in]` | config | a structure with following members: config.dout_l1_sr (LED anodes, left side) config.dout_r1_sr (LED anodes, right side) config.dout_cathodes_sr1 (LED cathodes and button selection lines (2 * 4 bit)) config.dout_cathodes_sr2 (optional second SR which outputs the same values) config.cathodes_inv_mask (inversion mask for cathodes) config.dout_l2_sr (for 2-colour LED option) config.dout_r2_sr (for 2-colour LED option) config.dout_l3_sr (for 3-colour LED option) config.dout_r3_sr (for 3-colour LED option) config.debounce_delay (used if debounce mode >= 1)

Returns:
  < 0 if initialisation failed

Here is the call graph for this function:

s32 BLM_DIN_PinGet | ( | u32 | pin | ) |

Returns value of BLM DIN pin

Parameters:

  `[in]` | pin | number of pin

Returns:
  pin value (0 or 1)
  < 0 if pin not available

u8 BLM_DIN_SRGet | ( | u32 | sr | ) |

Returns value of BLM DIN "virtual" shift register

Parameters:

  `[in]` | sr | number of shift register

Returns:
  < 0 if pin not available

s32 BLM_DOUT_PinGet | ( | u32 | colour,
|  | u32 | pin |
| ) |  |  |

Returns red/green/blue LED status

Parameters:

  `[in]` | colour | the colour selection (0/1/2)
  `[in]` | pin | the pin number

Returns:
  < 0 if pin not available

s32 BLM_DOUT_PinSet | ( | u32 | colour,
|  | u32 | pin,
|  | u32 | value |
| ) |  |  |

Sets red/green/blue LED to 0 or Vss

Parameters:

  `[in]` | colour | the colour selection (0/1/2)
  `[in]` | pin | the pin number
  `[in]` | value | the pin value

Returns:
  < 0 if pin not available

Here is the call graph for this function:

u8 BLM_DOUT_SRGet | ( | u32 | colour,
|  | u32 | sr |
| ) |  |  |

Returns content of red or green "virtual" shift register

Parameters:

  `[in]` | colour | the colour selection (0/1/2)
  `[in]` | sr | the shift register number

Returns:
  < 0 if SR not available

s32 BLM_DOUT_SRSet | ( | u32 | colour,
|  | u32 | sr,
|  | u8 | value |
| ) |  |  |

Sets red or green "virtual" shift register

Parameters:

  `[in]` | colour | the colour selection (0/1/2)
  `[in]` | sr | the shift register number
  `[in]` | value | the shift register value

Returns:
  < 0 if SR not available

s32 BLM_GetRow | ( | void |  | ) |

This function gets the DIN values of the selected column.
It should be called from the APP_SRIO_ServiceFinish() hook

Returns:
  < 0 on errors

Here is the call graph for this function:

s32 BLM_Init | ( | u32 | mode | ) |

Initializes the button LED matrix 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 BLM_PrepareCol | ( | void |  | ) |

This function prepares the DOUT register to drive a column.
It should be called from the APP_SRIO_ServicePrepare()

Returns:
  < 0 on errors

Here is the call graph for this function:

## Variable Documentation

u8 blm_led_row[BLM_NUM_COLOURS][BLM_NUM_ROWS]