Jump to content

Recommended Posts

Posted

Hi

Is it possible to integrate the led matrix driver (from sidmatrix test)

with the C scanmatrix example?

I want to drive 64 leds and 32 buttons using a DINX1 and a DOUTX2

Michaël

Posted

I allready looked at that page but none of the links provide the combination of buttons and leds

(correct me if I'm wrong  ???)

in the meantime I've build the button/led matrix with two DOUT registers for the leds

and seperate DIN/DOUT registers for the button matrix (driven by sm_example code)

so I just have to modify the SID ledmatrix example and

add a C style header for the asm functions...

Posted

I've managed to get this to work  :)

I'm using one dout to drive both matrices

and a din/dout for buttons/leds

modifications to scan matrix example:

in main.c:

...
//second shiftregister drives the leds
#define LEDOUT 1
...
void LM_SetRow(){
	MIOS_DOUT_SRSet(LEDOUT,ledtest[sm_col]);
}

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS before the shift register are loaded
/////////////////////////////////////////////////////////////////////////////
void SR_Service_Prepare(void) __wparam
{
  // call the Scan Matrix Driver
  SM_PrepareCol();
  // call the Led Matrix Driver
  LM_SetRow();
}
...
in sm_simple.asm:

...
	global	_sm_button_column
	global	_sm_button_row
	global	_sm_button_value
	global  _sm_col

	;; import lables
	extern	_SM_NotifyToggle

; ==========================================================================

accessram		udata		; (no access ram required, these variables can be located anywhere)

_sm_button_column	res	1	; exported to C, therefore an "_" has been added
_sm_button_row		res	1
_sm_button_value	res	1
_sm_col				res 1

...

SM_PrepareCol
	;; select next DOUT register

	;; (current column + 1) & 0x07
	SET_BSR	sm_selected_column
	incf	sm_selected_column, W, BANKED	; (* see note below)
	andlw	0x07
	;_sm_col is used by LM_SetRow()
	movwf	_sm_col
	call	MIOS_HLP_GetBitANDMask	; (inverted 1 of 8 code)
...

and finally in sm_simple.h:
...
extern unsigned char sm_button_value;
extern unsigned char sm_col;
...

I don't think this is the most efficient way to do this

but it works for me  :)

Michaël

Posted

ever since I saw the clockbox example I wanted to build a drum seq

so it's gonna be a drumseq  :D

you can read some information on my first attempt here:

http://www.midibox.org/forum/index.php?topic=6980.msg45082#msg45082

the new design is based on some of the suggestions

in the "when will come the trseq" thread

feature list:

32 step 8 track drum seq, each step has trig/acc/roll

16 patterns, will be expanded when seq is up and running

patterns are saved on a bankstick

simple UI:

lcd: displaying [bpm pat trknr (edited par)]

32 step buttons + stepleds, leds are dual color to display trig/acc

all functions are accessed with a stepkey + shift combination

pattern selection: stepkey + pattern button

track select/mute: stepkey + track button

rotary encoder for modifying parameters

some pics of the seq:

DSEQ32b.JPG

picture to show the size (it's reeaally compact ;D)

DSEQ32a.JPG

matrix wiring mess:

SEQWIRING.JPG

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...
×
×
  • Create New...