Jump to content
AndyV

Can't implement GADC

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites

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.


×
×
  • Create New...