Page 1 of 1

Use C API in Web Application

Posted: Fri May 26, 2023 1:25 pm
by ZQInreal
Hello everyone,
I am trying to read 4 slow ADC values from expansion connector. Noticed that C API rp_ApinGetValue() can do this. I followed the instruction https://redpitaya.readthedocs.io/en/lat ... .html#comc, and the results were good! However, the Makefile of the example code "analog_inputs.c" is static linked to libm.a/librp.a. And I hope to use it function in my Web Application. My web application is based on rp_lockin+PID. The makefile target is a shared library(.so). When I replace "-static" flag by "-shared" and "-fPIC", a Segmentation Error occurred. I don't know what the problem is, is it that this function can't get through the dynamic link? Or is there a way to use rp_ApinGetValue() in a web application? If not, I'd be happy to look at better ways to satisfy my requirements, such as Qt Streaming APP/ Jupyter Notebook. I hope you will give me some advice on my route. Thanks!

Re: Use C API in Web Application

Posted: Fri May 26, 2023 1:33 pm
by ZQInreal
I want to realize a feedback system by using red pitaya. The Slow ADC inputs as system input, DPIO as the system output. So I may also need to use int rp_DpinSetState() function. For now, I plan to follow the web application steps. But there are problems with the C API. In my case, would Streaming application or Jupiter be a better choice?

Re: Use C API in Web Application

Posted: Fri Jun 02, 2023 10:09 am
by redpitaya
It would be better to stick to using the rp_ApinGetValue() and rp_DpinSetState(). The streaming applications currently only streams data from the fast analog inputs and outputs. Jupyter Notebook has this functionality, but we plan to update it and add documentation in Q3 2023.

Here is a link with the example of reading slow analog outputs through Web Api:
https://redpitaya.readthedocs.io/en/lat ... low-inputs