Jump to content

tago

Members
  • Posts

    273
  • Joined

  • Last visited

Posts posted by tago

  1. Hi,

    i'm trying to add some custom code to the NG app.

    I want to set/get a parameter called kb_transpose. It seems that this parameter is part of MBNG_EVENT_CONTROLLER_KB event.

    1.) Do i have to dispatch MBNG_EVENT_CONTROLLER_KB when i want to change the value of kb_transpose?
    2.) How would i get the current value of kb_transpose?

    As you can see i've trouble understanding how i can change parameters via code without using ngc/ngr scripts. I've no idea where parameters are stored and how i can access them. Is there a suitable tutorial for this?


    Your help is greatly appreciated

  2. There is this line in mbng_kb.c

    s8 kb_transpose = (s8)item.custom_flags.KB.kb_transpose;

    What is item.custom_flags.KB.kb_transpose ? It looks like the place where the current transpose value is stored. But how can i modify this value myself?

    Edit: Where is "item" coming from? I see it declared as "mbng_event_item_t" but not where it is referenced to any object.

  3. I'd like to know the best place for the button handler and how to get/set kb_transpose values.

    Here is some pseudo code.

    void APP_Background(void)
    {
    	int old_transpose = kb_transpose;
    	int new_transpose;
    	
    	// up btn pressed	
    	if( MIOS32_BOARD_J5_PinGet(0) == 0) {
    		new_transpose = old_transpose + 12;
    	}
    
    	// down btn pressed
    	if( MIOS32_BOARD_J5_PinGet(1) == 0) {
    		new_transpose = old_transpose - 12;
    	}
    
    	// transpose and handle LEDs
    	if( old_transpose != new_transpose ) {
    
    		kb_transpose = new_transpose;
    
    		if( new_transpose > 0 ) {
    			// enable up LED
    			// disable down LED 
    		} else if (new_transpose < 0 ) {
    			// enable down LED
    			// disable up LED 
    		} else {
    			// disable both LEDs
    		}
    	}
    }

     

  4. Hi Zam,

    thanks for joining in.

    This is from the .ngc manual, right? As far as i understood i have to do it in the ng app itself and can't simply use ngc/ngr.

    Unfortunately i've no clue in which function i should put custom event handlers. Should i put it into APP_TICK (app.c) function?

    But i'm not sure about it.

     

  5. I got the two LEDs working. I assume the switches will work too.

    Now i need some help or hints on the implementation of kb_transpose on these elements. In the end i'd like to have octave up/down tact switches with respective indicator LEDs, as seen on many keyboard controllers.

    It looks like i can't do it via ngc scripts, because there is no event for J5 digital IOs. There is only EVENT_AIN when configured as analog inputs. Is this right?

    But where should i put my custom button handler code in the NG app source? Do i need a new variable for the transpose state or is there already one?

    Any ideas?

    Thank you very much!

     

  6. Hi,

    i'd like to continue working on my keyboard controller project.

    Is there absolutely no way to set up the J5 ports as individual digital IO's in ngc? I'd like to avoid a cumbersome solution modifing the source code. If there is no easy way, then so be it.

     

    May i ask if it's possible to simply do the following?

    I want to setup J5a to have 2 digital ins and two digital outs.

    // init pin 0 and 1 as digital ins (for tact switches)
    MIOS32_BOARD_J5_PinInit(0, MIOS32_BOARD_PIN_MODE_INPUT_PU);
    MIOS32_BOARD_J5_PinInit(1, MIOS32_BOARD_PIN_MODE_INPUT_PU);
    
    
    // init pin 2 and 3 as digital outs (for LEDs)
    MIOS32_BOARD_J5_PinInit(2, MIOS32_BOARD_PIN_MODE_OUTPUT_PP);
    MIOS32_BOARD_J5_PinInit(3, MIOS32_BOARD_PIN_MODE_OUTPUT_PP);

    I assume i'd then have J5a:A0..A1 configured as INs and J5a:A2..A3 as OUTs, right?

     

    Thank you very much!

     

  7. On 6.4.2019 at 7:51 PM, FantomXR said:

    The solution is easy:

    Go and get a MCP1541. You connect USB 5V to the input and it's output you connect to the VREF input on the AINSER8 (of course you need to cut the trace between VREF and +5V on the AINSER) and to the all analog controls that are connected to the AINSER8. 

    This little IC solved all my problems I had with jitter. Especially when running just at 7bit, this should do the trick.

    Just to be sure. Vref is also used on the analog inputs J6 (AINSER8) instead of Vd (5V), right? If i connect pots to J6 they will provide max 4.096V (Vref) to the analog ins.

    Edit: i wonder why the external psu on AINSER64 is only connected to Vref of the ADC, but not to J6-13.

  8. Thanks Peter!

    Yes, it is helpful.

    I understand it that way, that you recommend using a single mios32 installation as global lib. No need to put duplicates in each project folder, because the interface doesn't change often and mostly there are new functions added.

    Hard to decide, i somehow lean towards a self contained per project solution.

  9. Thanks Thorsten!

    I'd like to further understand the structure and workflow of the repository.

    My simplified view: it looks like /apps are the apps and everything else is the 'mios lib' (mios32/modules..). I'd like to know how do you handle changes to the 'mios lib' for all the apps? What if there are some breaking changes? Do you edit/refactor all apps every time this happens or is there some kind of a fixed API that never changes (or very seldom)? How often gets the mios stuff updated? I assume the apps are updated more frequently.

    I'm trying to find an ideal setup for multiple midibox projects. To my modest knowledge it's the best to have each project's includes/dependencies separated from each other to avoid problems compiling them after some time later. In that scenario i'd pull 'mios lib' version updates on per project basis, not for all projects. But does it make sense or should i rather have a global 'mios lib'?

     

    Edit: i only intend to work on app level.

  10. Hi,

    how do you setup multiple projects?

    Do you have a single mios32 installation and put your projects in folders outside of the mios32 folder?

    I mean, if i setup mios/toolchain/global environment vars according to the wiki docs these vars are actually global. So i don't see how this would work for different mios apps which possibly need different env vars or mios versions.

    Doesn't it make more sense to put a new mios installation into each project folder and get rid of the global vars to have the project's dependencies in its respective project folder?

     

    Thank you

     

  11. Currently no J10 in use for now. I wanted to keep J10a clear if i later want to add an SCS. Therefor J10b would be available.

    But the issue i found was, that you can't have mixed DIN/DOUT on a J10 port. That lead me to the J5 ports. The wiring to core would be a mess for a little board with 2 switches and 2 LEDs.

     

    ps. i want to setup two octave up/down buttons with indication LEDs

  12. I want to connect some switches and leds directly to the CORE_STM32F4 via J5a/b ports.

    The NG manual shows an example using them as AINs, but not DIN/DOUT. Then i found the tutorial applications (eg polling_j5_pins) which show how to use them on app level.

    What i dont get, is there a way to setup these ports and its indivdual pins directly in a .NGC file?

  13. Thanks @FantomXR

    I really like your solution.

    The MCP1541 datasheets says 4V output. Is really enough for Vref? What effect has a 1V drop for the A/D converter? Does it mean -20% resolution? If i understand your solution correctly the quality of the Vref is more important than the voltage range.

    Do have to branch the USB power before it goes into the core or can use the 5V of J19 as input voltage for the MCP1541?

     

  14. Thanks @Zam

    So in my case i need a separate voltage regulator for the display, because AINSER needs the full 5V and therefor should be left alone? The displays works from 3.3V to 5V and i suppose a small voltage drop is not much of an issue. What type of regulator should i use?

    I read about bulk or decoupling capacitors. Do you think they could be of help?

  15. Thanks @jojjelito

    I have some further questions if you don't mind, since i don't have much experience in electronics.

    I'd like to power the system via a single USB port.

    Does a separate regulator for the display or AINSER decouple each other in a sufficiently manner?

    How do i get a separate AGND with CORE_STM32?

    Do you mean by 'other OLED PCB', the pcb on the display itself?

×
×
  • Create New...