Jump to content


Photo

QT and arduino GPIO, ADC, SPI, Wire


  • Please log in to reply
4 replies to this topic

#1 jim

jim

    Advanced Member

  • Administrators
  • 3,385 posts

Posted 13 February 2015 - 07:06 PM

Hello,
How I can use arduino libs (GPIO, adc read write, digital read write, SPI, Wire) in QT C++ project ?



#2 jim

jim

    Advanced Member

  • Administrators
  • 3,385 posts

Posted 13 February 2015 - 07:06 PM

Hey!

Not tried in C++ but maybe you can try to port needed funcs to C++ class? c_envrionnement is like C++(some base code is in C, others in C++) it should be easier to adapt it to pure C++. For examplen i've ported rcswitch from arduino libs to pcduino in C(to avoid linking with c_environnement)...

See https://github.com/p...o/c_environment to show how code is organized...

Greets,
Alex.



#3 jim

jim

    Advanced Member

  • Administrators
  • 3,385 posts

Posted 13 February 2015 - 07:07 PM

digital wire ported in QT
else need adc, spi, serial
 


#4 jim

jim

    Advanced Member

  • Administrators
  • 3,385 posts

Posted 13 February 2015 - 07:07 PM

hey!

Porting serial class should be easy, in qt documentation you'll found all your needs(http://qt-project.or...port-index.html) If you need a sample code in C I can send u my own code to opening serial port and talking with it...

Porting adc, should be easier since you can found pwm sample 
https://github.com/p...mple/pwm_test.c

It uses:
https://github.com/p...wiring_analog.c

you need to port C code to C++ or mix code

Porting SPI is little more complex, since if you use pcduino v1/v2 spidev module need to use hardware spi bus print a lot of kernel message(printk stuff) and slowing spi communication! You will not be able to compile a spi patched kernel since customized kernel 3.4.29+ refuse to boot!  angry.gif you can try to implement software SPI bitbanging. But in some case software SPI is't useless(TFT...)

Greets,



#5 jim

jim

    Advanced Member

  • Administrators
  • 3,385 posts

Posted 13 February 2015 - 07:07 PM

I2C ported, OLED 1602 Display i2c lib added.
SPI ported, TFT on RA8875 in SPI mode added.
See spi signal by logic analyze, big time between transfer, irrespective of the transmission speed
and CS signal very wide.
for serial no time, later. 
I use PcDuino3.
How I can use IR?
were i can find libs for IR and examples?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users