Jump to content

Recommended Posts

Posted

I launched a widgets demo project on STM32F429 Discovery board. Successfully added GINPUT TOGGLE for external buttons. But can't add support GADC analog input to control slider. ADC initialized by calling gadc_lld_init(). This is done. Dial attached successfully  by gwinAttachDial(ghSlider1, 0, 0); . It returns TRUE.  ginput_lld_dial_poll(DialCallbackFn fn)  called periodically with GINPUT_DIAL_POLL_PERIOD.  gadcLowSpeedStart(GINPUT_DIAL_DEVICE0, samplebuf+0, GADCCallback, (void *)fn);  called by ginput_lld_dial_poll(DialCallbackFn fn) (taken from example). Raw data from ADC in samplebuf. Of course it doesn't work.

Questions:

1. GINPUT_DIAL_DEVICE0. Is this just number of instance and can be any custom number?

2. GADCCallback. Is this any custom user samples post processing  function callback?

3. gadc_lld_nontimerjobI(&pdata->job); called by gadcLowSpeedStart(gU32 physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) and it seems must capture data from the ADC.  It calls only one time after start.  Generally, i don't understand where is a point to input raw data from ADC. What should I do to control the slider  from external analog input?

Posted

Generally you would read the analog input in the dial driver directly.

GADC is designed for when you have a single ADC device with multiple inputs, some of which you want to use for high speed sampling e.g. for audio, and some for low speed sampling such as dial devices. There is currently only one GADC driver, for the SAM7 cpu which has a single ADC that reads 8 input lines simultaneously. GADC is then required to pick off samples at low frequency from sampling that is occurring much faster say for the purpose of GAUDIO.

If you are not in such a circumstance GADC is probably overkill and the dial input analog input can be read directly in the dial driver.

Posted

I did it. I found that the ADC values should be passed as a parameter "rawvalue" to the function DialCallback(gU16 instance, gU16 rawvalue) called by poll timer. Dial attached to sliders works ok. From ADC as well as from encoder.

Now new question. May be not for this topic. How to do text string controlled by dial? Something like frequency readout. I think there is only one way. This is Label. But label can not be attached to simple variable in memory as dial and toggle to objects. Maybe there is an elegant way to do this?

Posted
8 hours ago, AndyV said:

Now new question. May be not for this topic. How to do text string controlled by dial? Something like frequency readout. I think there is only one way. This is Label. But label can not be attached to simple variable in memory as dial and toggle to objects. Maybe there is an elegant way to do this?

That should definitely go into a separate topic :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...