# BLM_SCALAR_MASTER

Collaboration diagram for BLM_SCALAR_MASTER:

## Data Structures
union | sysex_state_t
## Defines
#define | SYSEX_DISACK 0x0e
#define | SYSEX_ACK 0x0f
#define | SYSEX_DISACK_LESS_BYTES_THAN_EXP 0x01
#define | SYSEX_DISACK_MORE_BYTES_THAN_EXP 0x02
#define | SYSEX_DISACK_INVALID_COMMAND 0x0c
#define | SYSEX_BLM_CMD_REQUEST 0x00
#define | SYSEX_BLM_CMD_LAYOUT 0x01
#define | BLM_TIMEOUT_RELOAD_VALUE 10000
#define | BLM_MAX_PACKETS 8
## Enumerations
enum | sysex_cmd_state_t { SYSEX_CMD_STATE_BEGIN, SYSEX_CMD_STATE_CONT, SYSEX_CMD_STATE_END }
## Functions
s32 | BLM_SCALAR_MASTER_Init (u32 mode)
s32 | BLM_SCALAR_MASTER_MIDI_PortSet (u8 blm, mios32_midi_port_t port)
mios32_midi_port_t | BLM_SCALAR_MASTER_MIDI_PortGet (u8 blm)
blm_scalar_master_connection_state_t | BLM_SCALAR_MASTER_ConnectionStateGet (u8 blm)
s32 | BLM_SCALAR_MASTER_ButtonCallback_Init (s32(*button_callback_func)(u8 blm, blm_scalar_master_element_t element_id, u8 button_x, u8 button_y, u8 button_depressed))
s32 | BLM_SCALAR_MASTER_FaderCallback_Init (s32(*fader_callback_func)(u8 blm, u8 fader, u8 value))
s32 | BLM_SCALAR_MASTER_LED_Set (u8 blm, blm_scalar_master_element_t element_id, u8 led_x, u8 led_y, blm_scalar_master_colour_t colour)
blm_scalar_master_colour_t | BLM_SCALAR_MASTER_LED_Get (u8 blm, blm_scalar_master_element_t element_id, u8 led_x, u8 led_y)
s32 | BLM_SCALAR_MASTER_RotateViewSet (u8 blm, u8 rotate_view)
s32 | BLM_SCALAR_MASTER_RotateViewGet (u8 blm)
s32 | BLM_SCALAR_MASTER_RowOffsetSet (u8 blm, u8 row_offset)
s32 | BLM_SCALAR_MASTER_RowOffsetGet (u8 blm)
s32 | BLM_SCALAR_MASTER_NumColumnsGet (u8 blm)
s32 | BLM_SCALAR_MASTER_NumRowsGet (u8 blm)
s32 | BLM_SCALAR_MASTER_NumColoursGet (u8 blm)
s32 | BLM_SCALAR_MASTER_TimeoutCtrSet (u8 blm, u16 ctr)
s32 | BLM_SCALAR_MASTER_TimeoutCtrGet (u8 blm)
s32 | BLM_SCALAR_MASTER_ForceDisplayUpdate (u8 blm)
s32 | BLM_SCALAR_MASTER_MIDI_Receive (mios32_midi_port_t port, mios32_midi_package_t midi_package)
s32 | BLM_SCALAR_MASTER_MIDI_TimeOut (mios32_midi_port_t port)
s32 | BLM_SCALAR_MASTER_SYSEX_Parser (mios32_midi_port_t port, u8 midi_in)
s32 | BLM_SCALAR_MASTER_SendRequest (u8 blm, u8 req)
s32 | BLM_SCALAR_MASTER_Periodic_mS (void)
## Variables
u16 | blm_scalar_master_leds_green [BLM_SCALAR_MASTER_NUM_ROWS]
u16 | blm_scalar_master_leds_red [BLM_SCALAR_MASTER_NUM_ROWS]
u16 | blm_scalar_master_leds_extracolumn_green
u16 | blm_scalar_master_leds_extracolumn_red
u16 | blm_scalar_master_leds_extracolumn_shift_green
u16 | blm_scalar_master_leds_extracolumn_shift_red
u16 | blm_scalar_master_leds_extrarow_green
u16 | blm_scalar_master_leds_extrarow_red
u8 | blm_scalar_master_leds_extra_green
u8 | blm_scalar_master_leds_extra_red

## Detailed Description

BLM_SCALAR_MASTER Driver

## Define Documentation

#define BLM_MAX_PACKETS 8

#define BLM_TIMEOUT_RELOAD_VALUE 10000

#define SYSEX_ACK 0x0f

#define SYSEX_BLM_CMD_LAYOUT 0x01

#define SYSEX_BLM_CMD_REQUEST 0x00

#define SYSEX_DISACK 0x0e

Include files Local definitions

#define SYSEX_DISACK_INVALID_COMMAND 0x0c

#define SYSEX_DISACK_LESS_BYTES_THAN_EXP 0x01

#define SYSEX_DISACK_MORE_BYTES_THAN_EXP 0x02

## Enumeration Type Documentation

enum sysex_cmd_state_t

Local types

Enumerator:

  SYSEX_CMD_STATE_BEGIN |
  SYSEX_CMD_STATE_CONT |
  SYSEX_CMD_STATE_END |

## Function Documentation

s32 BLM_SCALAR_MASTER_ButtonCallback_Init | ( | s32(*)(u8 blm, blm_scalar_master_element_t element_id, u8 button_x, u8 button_y, u8 button_depressed) | button_callback_func | ) |

Installs callback function for BLM16x16 buttons

blm_scalar_master_connection_state_t BLM_SCALAR_MASTER_ConnectionStateGet | ( | u8 | blm | ) |

Returns connection state to MBHP_BLM_SCALAR:

Returns:
  0 no contact yet
  1 contact via MIDI protocol
  2 contact via simplified Lemur protocol

s32 BLM_SCALAR_MASTER_FaderCallback_Init | ( | s32(*)(u8 blm, u8 fader, u8 value) | fader_callback_func | ) |

Installs callback function for faders

s32 BLM_SCALAR_MASTER_ForceDisplayUpdate | ( | u8 | blm | ) |

Enforces a display update

s32 BLM_SCALAR_MASTER_Init | ( | u32 | mode | ) |

Initializes the BLM_SCALAR_MASTER driver Should be called from Init() during startup

Parameters:

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

Returns:
  < 0 if initialisation failed

blm_scalar_master_colour_t BLM_SCALAR_MASTER_LED_Get | ( | u8 | blm,
|  | blm_scalar_master_element_t | element_id,
|  | u8 | led_x,
|  | u8 | led_y |
| ) |  |  |

Returns the current colour of a LED

s32 BLM_SCALAR_MASTER_LED_Set | ( | u8 | blm,
|  | blm_scalar_master_element_t | element_id,
|  | u8 | led_x,
|  | u8 | led_y,
|  | blm_scalar_master_colour_t | colour |
| ) |  |  |

Sets a LED to the given colour

mios32_midi_port_t BLM_SCALAR_MASTER_MIDI_PortGet | ( | u8 | blm | ) |

Returns the currently configured MIDI IN/OUT port for MBHP_BLM_SCALAR communication

Returns:
  0 no communication
  the MIDI port if != 0

s32 BLM_SCALAR_MASTER_MIDI_PortSet | ( | u8 | blm,
|  | mios32_midi_port_t | port |
| ) |  |  |

Sets the IN/OUT port for MBHP_BLM_SCALAR communication

s32 BLM_SCALAR_MASTER_MIDI_Receive | ( | mios32_midi_port_t | port,
|  | mios32_midi_package_t | midi_package |
| ) |  |  |

Receives a MIDI package from APP_NotifyReceivedEvent (-> app.c) if port matches with blm_midi_port

Here is the call graph for this function:

s32 BLM_SCALAR_MASTER_MIDI_TimeOut | ( | mios32_midi_port_t | port | ) |

This function is called from NOTIFY_MIDI_TimeOut() in app.c if the MIDI parser runs into timeout

s32 BLM_SCALAR_MASTER_NumColoursGet | ( | u8 | blm | ) |

Returns the number of colours as reported by the BLM during layout request

s32 BLM_SCALAR_MASTER_NumColumnsGet | ( | u8 | blm | ) |

Returns the number of columns as reported by the BLM during layout request

s32 BLM_SCALAR_MASTER_NumRowsGet | ( | u8 | blm | ) |

Returns the number of columns as reported by the BLM during layout request

s32 BLM_SCALAR_MASTER_Periodic_mS | ( | void |  | ) |

This function should be periodically called each mS

handle Timeout

take over update force flag

send LED changes to BLM16x16

send LED changes to extra buttons

Here is the call graph for this function:

s32 BLM_SCALAR_MASTER_RotateViewGet | ( | u8 | blm | ) |

Returns != 0 if screen currently rotated by 90 grad

s32 BLM_SCALAR_MASTER_RotateViewSet | ( | u8 | blm,
|  | u8 | rotate_view |
| ) |  |  |

Rotates the Screen by 90 grad

s32 BLM_SCALAR_MASTER_RowOffsetGet | ( | u8 | blm | ) |

Returns the current row offset

s32 BLM_SCALAR_MASTER_RowOffsetSet | ( | u8 | blm,
|  | u8 | row_offset |
| ) |  |  |

Sets a row offsets when sending the display data for smaller BLM screens

s32 BLM_SCALAR_MASTER_SendRequest | ( | u8 | blm,
|  | u8 | req |
| ) |  |  |

This function is called to request the layout

Here is the call graph for this function:

s32 BLM_SCALAR_MASTER_SYSEX_Parser | ( | mios32_midi_port_t | port,
|  | u8 | midi_in |
| ) |  |  |

This function parses an incoming sysex stream for MIOS32 commands Called from SysEx hook in app.c

s32 BLM_SCALAR_MASTER_TimeoutCtrGet | ( | u8 | blm | ) |

Returns:
  the current timeout counter

s32 BLM_SCALAR_MASTER_TimeoutCtrSet | ( | u8 | blm,
|  | u16 | ctr |
| ) |  |  |

Directly sets the timeout counter, e.g. to 0 so that the BLM will be disabled until a newly selected port receives a connection request

## Variable Documentation

u8 blm_scalar_master_leds_extra_green

u8 blm_scalar_master_leds_extra_red

u16 blm_scalar_master_leds_extracolumn_green

u16 blm_scalar_master_leds_extracolumn_red

u16 blm_scalar_master_leds_extracolumn_shift_green

u16 blm_scalar_master_leds_extracolumn_shift_red

u16 blm_scalar_master_leds_extrarow_green

u16 blm_scalar_master_leds_extrarow_red

u16 blm_scalar_master_leds_green[BLM_SCALAR_MASTER_NUM_ROWS]

Global variables

u16 blm_scalar_master_leds_red[BLM_SCALAR_MASTER_NUM_ROWS]