Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to use qt sensor in my arm device?

How to use qt sensor in my arm device?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 432 Views 1 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.
  • H Offline
    H Offline
    hkzhou
    wrote on last edited by
    #1

    hi,guys! i am new to qt. english,compile,qt api everything is hard to me . my device has a 6-axis sensor(mpu6500),and i can get data from the sensor in kernel,but i don't how the qt sensor get the data from the kernel,and what kind of data type. now i can run sensor_explorer(a qt sensor examples) on my device, but it can't detect any sensor.what should i do?

    i noticed the note in /qt5sensors-5.6.1-1/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
    #include "linuxsysaccelerometer.h"
    #include <QtCore/QDebug>
    #include <QtCore/QtGlobal>
    #include <QtCore/QFile>
    #include <QtCore/QDebug>
    #include <QtCore/QTimer>

    #include <QtCore/QStringList>

    #include <time.h>
    #include <errno.h>

    char const * const LinuxSysAccelerometer::id("linuxsys.accelerometer");

    // This plugin reads the accelerometer from a sys interface.

    // test machine (laptop):
    // QT_ACCEL_FILEPATH=/sys/devices/platform/lis3lv02d/position
    // QT_ACCEL_DATADIVISOR=7
    // QT_ACCEL_DELIMITER=,

    quint64 produceTimestamp()
    {
    struct timespec tv;
    int ok;

    #ifdef CLOCK_MONOTONIC_RAW
    ok = clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
    if (ok != 0)
    #endif
    ok = clock_gettime(CLOCK_MONOTONIC, &tv);
    Q_ASSERT(ok == 0);

    quint64 result = (tv.tv_sec * 1000000ULL) + (tv.tv_nsec * 0.001); // scale to microseconds
    return result;
    

    }

    if i define environment variables "QT_ACCEL_FILEPATH=sys/devices/mpu6500",qtsensor will read sensor data from "sys/devices/mpu6500" ,but i don't know what kind of data type shoud be read from this sys interface.Feel free to critisize me,i need your help!!!

    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