Jump to content

BLM_SCALAR 16x16 control question


avockley
 Share

Recommended Posts

I am using the example blm-scalar app for mios32 and am trying to convert it in to a organ

midifier. I am having the following 2 problems:

1) In the application, the DIN_BLM_NotifyToggle() function gives pin and pin value. What exactly is the

pin number? Is it the switches counted left-to-right and the top-to-bottom in the matrix?

Also, does the pin value return 1 or 0 when a button is pushed?

2) In the example app, there are 3 values to set which led is turned on or off, led_mod_ix,

led_row_ix, and led_column_ix. What is led_mod_ix? Are row and column counted from 1 or 0?

Link to comment
Share on other sites

  • 1 month later...

i've been working on this for the past couple days, and struggling to understand it, but i think i can help a little.

the pattern of pin numbering will depend on how you wired it up. to find a pattern, just print pin number in a debug message to the mios studio terminal. you can easily figure out what the pin states mean by printing the value too.

led is a lot more tricky, but the answer is where the notes turn the leds on and off. connect your midi keyboard and start hitting notes, eventually you'll see your leds start to light up. use different velocities to change the colors. look at this section of the code:

if( midi_package.event == NoteOff || velocity == 0x00 ) {

// Note Off or velocity == 0x00: clear both LEDs

blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;

#if BLM_SCALAR_NUM_COLOURS >= 2

blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;

#endif

} else if( velocity < 0x40 ) {

// Velocity < 0x40: set green LED, clear red LED

blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;

#if BLM_SCALAR_NUM_COLOURS >= 2

blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;

DEBUG_MSG("green - mod_ix: %d row_ix: %d col_ix: %d mask: %d", led_mod_ix, led_row_ix, led_column_ix, led_mask);

#endif

} else if( velocity < 0x60 ) {

// Velocity < 0x60: clear green LED, set red LED

blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;

#if BLM_SCALAR_NUM_COLOURS >= 2

blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;

DEBUG_MSG("red - mod_ix: %d row_ix: %d col_ix: %d mask: %d", led_mod_ix, led_row_ix, led_column_ix, led_mask);

#endif

} else {

// Velocity >= 0x60: set both LEDs

blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;

#if BLM_SCALAR_NUM_COLOURS >= 2

blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;

DEBUG_MSG("both - mod_ix: %d row_ix: %d col_ix: %d mask: %d", led_mod_ix, led_row_ix, led_column_ix, led_mask);

#endif

those DEBUG_MSG lines are all mine (put #define DEBUG_MSG MIOS32_MIDI_SendDebugMessage in mios32_config.h if you don't have it there). i'm still in the process of decoding this for my own purposes (my blm doesn't match the normal layout), but you'll see the patterns that are being used for column, row, and mod. pay attention to the 0/1 at the end of blm_scalar_led, and the way the operators are used against led_mask. that is resetting the state of the led, and turning on the correct color based on velocity.

i'm still in the process of figuring this out myself, so i'm sorry i can't completely explain things. but this should point you in the right direction.

ultra

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...