So I got a question, and feel like it’s a ‘dumb’ question, but what the hey, I spent the evening working it out and wanted some input.
I’m messing with the 8x8 scan matrix for MIOS8, and am expanding it a bit for a little project. Was setting up variables for transposing note range and Midi out channel.
At first tried adding to the display using ‘pin’ which is returned from the sm_ButtonHandler, but found it was out of scope in Display_tick(). So above Init() I added sm_button_pin and within SM_NotifyToggle() this:
sm_button_pin=pin;
This works, with sm_button_pin being global. Then added vars for chan_out and note_offset
unsigned char chan_out=0;
This seemed to work but when I tried to set it to 3 or what have you, no change. What I finally did was:
unsigned char chan_out;
And in Init() added this:
char_out=3;
So is there a better/cleaner way? I was thinking it should be in main.h rather then main.c but couldn’t get it working; even tried to add sm-button-pin as an export from sm_simple.asm. My C skills are way behind compared to assembly, feeling bad it took so long just setting and using a variable! Are there any online refs for SDCC and C in general? Have a few dusty C++ books and a couple CCS C manuals, guess I’ll have to clear of the cobwebs ![]()
Thanks,
Yogi