Also, be sure to check which pins on your microcontroller support interrupts.
see now, i got the oled linked to a leonardo the other day and got that running a gfx test routine first time and was happy with just that!! lol.
The parts started arriving today so tomorrow i will mill the mounting pcb on my cnc and then tin it before soldering things on.
I have been watching a few videos on you tube with coding tutorials etc, so i am making a start on things, i have a lot to learn thats for sure!
as soon as i have everything i will start my own thread.
Thank you! That is really helpful!
One thing I am still missing: Is the event payload (as described in the link) just an int that represents what changed? Like in your case the button number? and the event type? Is that what in your case is EV_BTN_DOWN
? And what does the next_state
mean? is that just what has been read from the current button? Does it incorporate any kind of debounce?
Would you mix the event queue with a ātiming queueā for events that should happen at certain times? Like in a sequencer, when the next tick arrives where notes need to be sent out? Or better just use a timer interrupt for this, because it should really not be delayed (or an external interrupt in case the module gets a clock from somewhere else)?
The event type is just an enum:
typedef enum {
EV_WAIT_XVA1,
EV_SLEEP,
EV_TIME,
EV_BTN_DOWN,
EV_BTN_UP,
EV_ENC_BTN_DOWN,
EV_ENC_BTN_UP,
EV_ENC_CW,
EV_ENC_CCW
} event_t;
Then yes, the id is just an int telling the code which one of the buttons triggered the event. Thereās a kind of big case statement in the ui handling code that I can use to figure out which button has been pressed based on the id and act accordingly.
As for next_state, it is, like you said, what has just been read from the button. The current_state was what its last known value was - so, if next_state != current_state, then something has changed - so we generate an event - either button up or down in this case. After sending the event, current_state is updated to next_state.
No explicit debounce, although the MCP23017 wonāt retrigger an interrupt until its status registers are read, and I turn off interrupts on the MCU while I do the processing, so it doesnāt seem to get triggered multiple times. Sometimes I think itās losing state, so no more interrupts get generated, so from time to time I re-read the MCP23017 to sync up everything. I havenāt really noticed too many missing clicks/turns etc, but I havenāt played with it that much yet.
I do have timer events, but theyāre very low resolution - Iām planning on using it for flashing cursors and status leds and that kind of thing. If I were doing something like a sequencer I think I would have the timing bit of that separate from the UI - I donāt think youād want to miss sending a note on time because you were dealing with button presses or screen updates.
Please keep in mind this is the first time Iāve been doing this kind of stuff, so Iām pretty much making it up as I go along.
Cheers
Question
I am playing with the seeed xaio tiday, just trying a few things out , i have linked an i2c ssd1306 display, however everytime i try to check the display and i run the compile for the example i get an error as its asking for something /directory library that i dont have, I cant seem to find an installer in the library manager in the ide app. any suggestions? thanks
C:\Users\home\Documents\Arduino\libraries\ssd1306\src/ssd1306_hal/arduino/io.h:45:14: fatal error: api/deprecated-avr-comp/avr/pgmspace.h: No such file or directory
#include <api/deprecated-avr-comp/avr/pgmspace.h>
after much searching i found that its part of the āArduinoCore-API-masterā now, so i downloaded it, theni looked at the info in the folder and noticed this in the read me:
These repositories donāt contain the needed api
subfolder; to ācompleteā the core you need to copy or symlink the api
folder from this repo to the targetās cores/arduino
folder.
so i copied the required file to the cores folder as stated and it worked. pleased I managed to sort this out, display works fine. more to learnā¦ onward!!>>>>>
Thanks to @MacMannes and @craigyb for some great heads up on things. Some of the code actually made senseā¦ go figure!!
Still need to learn what i need to add and what other parts to use to do a compile etc.
@jaradical the mb_ng is really easy once you get into it, I had to ask a lot of questions as it was a jump from assembly and I hadnāt been there for a few years.
learning some of the scripting as well, but once again like this forum if you ask a question there are good people to help you on the way and give you a nudge in the right direction!
having an issue here with the synth, its all programmed as the installation pdf shows, however if i connect via usb and use teh Xload over usb to get the patch name, or the midi channel ifo, i get nothing in repsonse just the hash symbol like this
XLoad v2.01 (āqā to exit.)
get_bank filename
ā¦
ā¦
if i check on the midi channel and enter the * symbol the app locks up totally.
why do i have a feeling i have bought a duff digilent board.
update
ok got the midi response working:
midi id is currently 1 then set to 0 so its in omni mode
XLoad v2.01 (āqā to exit.)
*
1
* 0
*
0
but if i do get bank file name there is nothign still
get_bank filename
ā¦
ā¦
also using the d command for show all parameter values for current program just gives me lots of FF FF FF
Any ideas ?
Howād you go with?
XLoad āput_bank XVA1_Factory.bankā
Did everything go as planned in that step?
that went in fine
C:\Users\home\Desktop\XVA1>XLoad āput_bank XVA1_Factory.bankā
ā¦
ā¦
C:\Users\home\Desktop\XVA1>
I am assuming the factory bank programs do have names? however the get program name just gives me a blank line then a new line with the hash
update; if i enter # n then i get nothing in return, so i put # n one
then # n gave me # n one in return, surely the factory bank each program has names already?
The factory banks do have names - if you do ā# n somethingā you may have set the name of the current patch to something.
And have you managed to get any sound out of it? Do any of the leds on the cmod give any clues?
will be checking it more tomorrow, I have to grab some cables from the studio and a small programmable controller to check cc# controls and cycle through patches if its working.
will update then, thanks for the input.
ok got it working however its not changing programs, i used a various methods to cycle through the sounds and it just plays the same synth sound all the time, the various #cc work fine. very strangeā¦ sounds nice though!
Perhaps its time to start my own thread!
Yeah - to me it sounds like thereās something amiss with the EEPROM where the patch data is stored and its interface with the FPGA, Iād double check everything in that area.
i have checked it all again this evening, then reprogrammed the board again. checked connections also, all is good, no solder bridges on my pcb mount.
I used Midi-ox this evening to check it over using the instrument panel that allows you to cycle through programs for general midi etc, does the same thing for normal patches.
It is randomly selecting patches, only a handful, it doesnt cycle to a given patch number, its very sporadic in its voice change, but i have heard different voices and even arpegiation voice.
I installed my sequencer software and did a program change on a bar of notes where it changes program using #cc0 and nothing happened it stayed on teh same sound.
Went back to midi-ox and did the patch change again and it did change patches but was sporadic again. is the eeprom bad? the resistors are correct and so is the diode type and polarity in curcuit.
bit wierd this one, when its working it sounds great.
Any suggestions gratefully recieved!!
Ok, I havenāt tried using MIDI program change to cycle through the patches.
For now Iād been doing it via XLoad connected via USB.
What are you entering into xload to do this, incase i am getting that wrong. thanks again @jaradical
Iād been using the ār Nā command:
Hello Craig!
Could you please share your code and schematics for your implementation. I want to build this XVA1 controller and I donāt have any experience in programming.
Thanks in advance!
//Alex
Unfortunately I donāt have a schematic created for it as it was all hand wired and I just reverse engineered the controller by the author and added to it and then expanded his code. So if you can read the code you should be able in theory to create a schematic yourself from it .
I might put the code up on GitHub and let you know if I do. It uses classes which I donāt fully understand.