mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
PMW3901 add register write delay (TIME_us_TSWW)
This commit is contained in:
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include "PMW3901.hpp"
|
#include "PMW3901.hpp"
|
||||||
|
|
||||||
|
static constexpr uint32_t TIME_us_TSWW = 11; // - actually 10.5us
|
||||||
|
|
||||||
PMW3901::PMW3901(int bus, enum Rotation yaw_rotation) :
|
PMW3901::PMW3901(int bus, enum Rotation yaw_rotation) :
|
||||||
SPI("PMW3901", PMW3901_DEVICE_PATH, bus, PMW3901_SPIDEV, SPIDEV_MODE0, PMW3901_SPI_BUS_SPEED),
|
SPI("PMW3901", PMW3901_DEVICE_PATH, bus, PMW3901_SPIDEV, SPIDEV_MODE0, PMW3901_SPI_BUS_SPEED),
|
||||||
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
|
||||||
@@ -71,6 +73,7 @@ PMW3901::sensorInit()
|
|||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
||||||
// set performance optimization registers
|
// set performance optimization registers
|
||||||
|
// from PixArt PMW3901MB Optical Motion Tracking chip demo kit V3.20 (21 Aug 2018)
|
||||||
unsigned char v = 0;
|
unsigned char v = 0;
|
||||||
unsigned char c1 = 0;
|
unsigned char c1 = 0;
|
||||||
unsigned char c2 = 0;
|
unsigned char c2 = 0;
|
||||||
@@ -287,6 +290,8 @@ PMW3901::writeRegister(unsigned reg, uint8_t data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
px4_usleep(TIME_us_TSWW);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include <px4_config.h>
|
#include <px4_config.h>
|
||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
#include <px4_getopt.h>
|
#include <px4_getopt.h>
|
||||||
#include <px4_work_queue/ScheduledWorkItem.hpp>
|
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||||
#include <drivers/device/spi.h>
|
#include <drivers/device/spi.h>
|
||||||
#include <conversion/rotation.h>
|
#include <conversion/rotation.h>
|
||||||
#include <lib/perf/perf_counter.h>
|
#include <lib/perf/perf_counter.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user