Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Accessing i2c on windows via i2c-tiny-usb
Forum Updated to NodeBB v4.3 + New Features

Accessing i2c on windows via i2c-tiny-usb

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdwijs
    wrote on last edited by
    #1

    Hi All,

    I have made a small Qt program that runs on a bananapi. this is an ARM chip (Allwinner A20), with native I2C pins. I have made the below linux code to talk to i2c: full code

    I would like to access i2c also on windows. I don't have an accessable i2c port there, so I'm planning to use the i2c-tiny-usb. How can I access the i2c-tiny-usb on windows in my Qt program?

    Kind regards,
    Cedric

    #include <linux/i2c.h>
    #include <linux/i2c-dev.h>
    #include <sys/ioctl.h>
    init():
    i2cHandle = open("/dev/i2c-2", O_RDWR); //get adapter string from above routines
    opResult = ioctl(i2cHandle, I2C_TENBIT, 0); //device is 7 bit address
    read():
    opResult = ioctl(i2cHandle, I2C_SLAVE, msg.address);
    opResult = ::read(i2cHandle, msg.buffer, msg.length);
    write():
    opResult = ioctl(i2cHandle, I2C_SLAVE, msg.address);
    opResult = ::write(i2cHandle, msg.buffer, msg.length);
    close():
    close(i2cHandle);

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      well the site says
      " A windows demo driver and demo application is included to get you started immediately."
      So that seems like a good place to start. How ever that sample talks to driver would be the same
      for Qt.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved