SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorPawA350.hpp
Go to the documentation of this file.
1
88#pragma once
89
90#include "../../../SensorBuildOpt.h"
91#if !SENSORLIB_EXCLUDE_PAWA350
92
94
98static constexpr uint8_t PAW_A350_SLAVE_ADDRESS = 0x33;
99
136{
137public:
138
147 enum class CpiResolution : uint8_t {
148 CPI_125 = 0,
149 CPI_250 = 1,
150 CPI_500 = 2,
151 CPI_750 = 3,
152 CPI_1000 = 4,
153 CPI_1250 = 5
154 };
155
165 enum class MotionStatus : uint8_t {
166 NO_MOTION = 0,
167 MOTION_DETECTED = 1
168 };
169
182 struct MotionData {
183 int8_t delta_x;
184 int8_t delta_y;
185 };
186
187 SensorPawA350() = default;
188
193 const char *getChipName() const;
194
208 int getProductID() const;
209
219 int getRevisionID() const;
220
234 bool softReset();
235
254 bool checkMotion(MotionStatus &status);
255
269 bool getMotionData(MotionData &data);
270
290 bool setCpi(CpiResolution cpi);
291
296 CpiResolution getCpi() const;
297
314 bool setRunDownshiftTime(uint8_t rd);
315
320 int getRunDownshiftTime() const;
321
337 bool setRest1Period(uint8_t period);
338
343 int getRest1Period() const;
344
360 bool setRest1DownshiftTime(uint8_t r1d);
361
366 int getRest1DownshiftTime() const;
367
382 bool setRest2Period(uint8_t period);
383
388 int getRest2Period() const;
389
404 bool setRest2DownshiftTime(uint8_t r2d);
405
410 int getRest2DownshiftTime() const;
411
426 bool setRest3Period(uint8_t period);
427
432 int getRest3Period() const;
433
444 bool setLedOn(bool enable);
445
450 bool getLedOn() const;
451
465 bool setLedDriveCurrent(uint8_t current);
466
471 int getLedDriveCurrent() const;
472
487 bool setShutterMax(uint16_t value);
488
493 int getShutterMax() const;
494
509 bool setMotionInterruptThreshold(uint8_t threshold);
510
515 int getMotionInterruptThreshold() const;
516
531 bool clearFingerState();
532
541 bool isMotionDetected();
542
553 uint32_t getRunDownshiftTimeMs() const;
554
559 uint32_t getRest1PeriodMs() const;
560
565 uint32_t getRest1DownshiftTimeMs() const;
566
571 uint32_t getRest2PeriodMs() const;
572
577 uint32_t getRest2DownshiftTimeMs() const;
578
583 uint32_t getRest3PeriodMs() const;
584
585protected:
586 bool initImpl(uint8_t param) override;
588};
589
590#endif
@license MIT License
PAW-A350 Optical Finger Navigation Sensor Driver.
uint32_t getRest2PeriodMs() const
Get Rest2 period in milliseconds.
bool checkMotion(MotionStatus &status)
Check motion status.
bool getLedOn() const
Get LED always-on status.
uint32_t getRest1PeriodMs() const
Get Rest1 period in milliseconds.
uint8_t cached_rest1_period
int getProductID() const
Get Product ID.
int getRest2DownshiftTime() const
Get Rest2 to Rest3 downshift time.
bool isMotionDetected()
Quick check if motion detected.
bool initImpl(uint8_t param) override
bool getMotionData(MotionData &data)
Get motion delta data.
bool setLedDriveCurrent(uint8_t current)
Set LED drive current.
int getRest1DownshiftTime() const
Get Rest1 to Rest2 downshift time.
int getRevisionID() const
Get Revision ID.
int getRest1Period() const
Get Rest1 frame period.
bool setRest1Period(uint8_t period)
Set Rest1 frame period.
CpiResolution
Count Per Inch (CPI) Resolution.
@ CPI_125
125 CPI - Lowest resolution, largest range
@ CPI_500
500 CPI - Default resolution
@ CPI_1000
1000 CPI - Recommended for most applications
@ CPI_1250
1250 CPI - Highest resolution
bool setMotionInterruptThreshold(uint8_t threshold)
Set motion interrupt threshold.
uint32_t getRest2DownshiftTimeMs() const
Get Rest2 downshift time in milliseconds.
bool clearFingerState()
Clear finger presence detect flag.
uint32_t getRunDownshiftTimeMs() const
Get Run downshift time in milliseconds.
int getRest2Period() const
Get Rest2 frame period.
int getRunDownshiftTime() const
Get Run to Rest1 downshift time.
SensorPawA350()=default
CpiResolution getCpi() const
Get current CPI resolution.
bool setRest3Period(uint8_t period)
Set Rest3 frame period.
bool setLedOn(bool enable)
Enable/disable LED always-on mode.
int getRest3Period() const
Get Rest3 frame period.
const char * getChipName() const
Get chip name.
MotionStatus
Motion Detection Status.
@ MOTION_DETECTED
Motion occurred, data ready for reading.
@ NO_MOTION
No motion detected.
int getMotionInterruptThreshold() const
Get motion interrupt threshold.
bool setShutterMax(uint16_t value)
Set shutter maximum open time.
bool setRest2Period(uint8_t period)
Set Rest2 frame period.
int getShutterMax() const
Get shutter maximum open time.
uint32_t getRest3PeriodMs() const
Get Rest3 period in milliseconds.
bool setRunDownshiftTime(uint8_t rd)
Set Run to Rest1 downshift time.
bool setRest2DownshiftTime(uint8_t r2d)
Set Rest2 to Rest3 downshift time.
bool setRest1DownshiftTime(uint8_t r1d)
Set Rest1 to Rest2 downshift time.
bool setCpi(CpiResolution cpi)
Set CPI resolution.
int getLedDriveCurrent() const
Get LED drive current setting.
uint32_t getRest1DownshiftTimeMs() const
Get Rest1 downshift time in milliseconds.
bool softReset()
Perform software reset.
int8_t delta_x
X-axis movement (-128 to +127 counts)
int8_t delta_y
Y-axis movement (-128 to +127 counts)