M5Unit-GESTURE 0.0.2 git rev:39d7f12
Loading...
Searching...
No Matches
m5::unit::UnitPAJ7620U2 Class Reference

PAJ7620U2 unit. More...

#include <unit_PAJ7620U2.hpp>

Inheritance diagram for m5::unit::UnitPAJ7620U2:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitPAJ7620U2 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
virtual void update (const bool force=false) override
 
uint8_t rotation () const
 Get the rotation.
 
void setRotate (const uint8_t rot)
 Set the roptation.
 
paj7620u2::Frequency frequency () const
 Gets the inner frequency.
 
bool readFrequency (uint8_t &raw)
 Read the raw frequency.
 
bool readFrequency (paj7620u2::Frequency &f)
 Read the frequency.
 
bool writeFrequency (const paj7620u2::Frequency f)
 Write the frequency.
 
bool readHorizontalFlip (bool &flip)
 Read the horizontal flipping.
 
bool readVerticalFlip (bool &flip)
 Read the vertical flipping.
 
bool writeHorizontalFlip (const bool flip)
 Write the horizontal flipping.
 
bool writeVerticalFlip (const bool flip)
 Write the vertical flipping.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Measurement data by periodic
paj7620u2::Gesture gesture () const
 Oldest gesture.
 
uint8_t brightness () const
 Oldest brightness if Proximity mode.
 
bool approach () const
 Oldest approach status if Proximity mode.
 
uint16_t cursorX () const
 Oldest cursor X if Cursor mode.
 
uint16_t cursorY () const
 Oldest cursor Y if Cursor mode.
 
Periodic measurement
bool startPeriodicMeasurement (const uint32_t intervalMs=0)
 Start periodic measurement in the current settings.
 
bool startPeriodicMeasurement (const paj7620u2::Mode mode, const paj7620u2::Frequency freq, const uint32_t intervalMs)
 Start periodic measurement.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
For detect gesture
bool readGesture (paj7620u2::Gesture &gesture)
 Read gesture.
 
bool readObjectCenter (uint16_t &x, uint16_t &y)
 Object center position.
 
bool readObjectSize (uint16_t &sz)
 Read gesture object size.
 
bool existsObject (bool &exists)
 Is the object present within the detection range?
 
bool readNoObjectCount (uint8_t &cnt)
 State counter with no objects detected.
 
bool readNoMotionCount (uint8_t &cnt)
 State counter which a non-moving object is detected.
 
For detect proximity
bool readProximity (uint8_t &brightness, uint8_t &approach)
 Read proximity.
 
bool readApproachThreshold (uint8_t &high, uint8_t &low)
 Read the threshold for detect approach.
 
bool writeApproachThreshold (const uint8_t high, const uint8_t low)
 Write the threshold for detect approach.
 
For detect cursor
bool readCursor (uint16_t &x, uint16_t &y)
 Cursor position.
 
Detection mode
paj7620u2::Mode mode () const
 Gets the detection mode.
 
bool writeMode (const paj7620u2::Mode m)
 Write the detection mode.
 
General purpose
bool enable (const bool flag)
 Enable/disable sensor.
 
bool enable ()
 enable sensor
 
bool disable ()
 disable sensor
 
bool suspend ()
 suspend
 
bool resume ()
 resume from suspended
 

Protected Member Functions

bool start_periodic_measurement (const uint32_t intervalMs=0)
 
bool start_periodic_measurement (const paj7620u2::Mode mode, const paj7620u2::Frequency freq, const uint32_t intervalMs)
 
bool stop_periodic_measurement ()
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitPAJ7620U2, paj7620u2::Data)
 
bool select_bank (const uint8_t bank, const bool force=false)
 
bool read_banked_register (const uint16_t reg, uint8_t *buf, const size_t len)
 
bool read_banked_register8 (const uint16_t reg, uint8_t &value)
 
bool read_banked_register16 (const uint16_t reg, uint16_t &value)
 
bool write_banked_register (const uint16_t reg, const uint8_t *buf, const size_t len)
 
bool write_banked_register8 (const uint16_t reg, const uint8_t value)
 
bool write_banked_register16 (const uint16_t reg, const uint16_t value)
 
bool update_gesture (paj7620u2::Data &d)
 
bool update_proximity (paj7620u2::Data &d)
 
bool update_cursor (paj7620u2::Data &d)
 
bool read_gesture (paj7620u2::Data &d)
 
bool read_proximity (paj7620u2::Data &d)
 
bool read_cursor (paj7620u2::Data &d)
 
bool was_wakeup ()
 
bool read_chip_id (uint16_t &id)
 
bool read_version (uint8_t &version)
 

Protected Attributes

uint8_t _current_bank {0xFF}
 
paj7620u2::Mode _mode {}
 
paj7620u2::Frequency _frequency {}
 
uint8_t _rotation {}
 
std::unique_ptr< m5::container::CircularBuffer< paj7620u2::Data > > _data {}
 
config_t _cfg {}
 

Detailed Description

PAJ7620U2 unit.

Member Function Documentation

◆ enable()

bool m5::unit::UnitPAJ7620U2::enable ( const bool flag)

Enable/disable sensor.

Parameters
flagtrue:enable false:disable
Returns
True if successful

◆ existsObject()

bool m5::unit::UnitPAJ7620U2::existsObject ( bool & exists)
inline

Is the object present within the detection range?

Parameters
[out]existstrue if exists
Returns
True if successful

◆ readApproachThreshold()

bool m5::unit::UnitPAJ7620U2::readApproachThreshold ( uint8_t & high,
uint8_t & low )

Read the threshold for detect approach.

Parameters
[out]highHigh threshold
[out]lowLowthreshold
Note
Approach:brightness >= high
Not approach: brightness <= low
Warning
Only valid in Proximity mode

◆ readCursor()

bool m5::unit::UnitPAJ7620U2::readCursor ( uint16_t & x,
uint16_t & y )

Cursor position.

Parameters
[out]xX cordinate
[out]yY cordinate
Returns
True if successful
Warning
Only valid in Cursor mode

◆ readFrequency() [1/2]

bool m5::unit::UnitPAJ7620U2::readFrequency ( paj7620u2::Frequency & f)

Read the frequency.

Parameters
[out]fFrequency
Returns
True if successful

◆ readFrequency() [2/2]

bool m5::unit::UnitPAJ7620U2::readFrequency ( uint8_t & raw)

Read the raw frequency.

Parameters
[out]rawraw frequency
Returns
True if successful

◆ readGesture()

bool m5::unit::UnitPAJ7620U2::readGesture ( paj7620u2::Gesture & gesture)

Read gesture.

Parameters
[out]gesture
Returns
True if successful

◆ readNoMotionCount()

bool m5::unit::UnitPAJ7620U2::readNoMotionCount ( uint8_t & cnt)

State counter which a non-moving object is detected.

Parameters
[out]count(tiocks)[0...12]
Returns
True if successful

◆ readNoObjectCount()

bool m5::unit::UnitPAJ7620U2::readNoObjectCount ( uint8_t & cnt)

State counter with no objects detected.

Parameters
[out]count(tiocks)[0...255]
Returns
True if successful

◆ readObjectCenter()

bool m5::unit::UnitPAJ7620U2::readObjectCenter ( uint16_t & x,
uint16_t & y )

Object center position.

Parameters
[out]xX cordinate
[out]yY cordinate
Returns
True if successful

◆ readObjectSize()

bool m5::unit::UnitPAJ7620U2::readObjectSize ( uint16_t & sz)

Read gesture object size.

Parameters
[out]szsize [0~900]
Returns
True if successful

◆ readProximity()

bool m5::unit::UnitPAJ7620U2::readProximity ( uint8_t & brightness,
uint8_t & approach )

Read proximity.

Parameters
[out]brightness0:Out of bounds [1:far ... 255:near]
[out]approarchApproach object
Returns
True if successful

◆ rotation()

uint8_t m5::unit::UnitPAJ7620U2::rotation ( ) const
inline

Get the rotation.

Returns
Rotation [0...3]
See also
setRotatation

◆ setRotate()

void m5::unit::UnitPAJ7620U2::setRotate ( const uint8_t rot)
inline

Set the roptation.

Parameters
rotRotation [0...3]
+-------++
||| || rot:0 up
||| O | left right
+--------+ down
rot 1,2,3... Treat as 90 deg counter-clockwise rotation
uint8_t rotation() const
Get the rotation.
Definition unit_PAJ7620U2.hpp:263

◆ startPeriodicMeasurement() [1/2]

bool m5::unit::UnitPAJ7620U2::startPeriodicMeasurement ( const paj7620u2::Mode mode,
const paj7620u2::Frequency freq,
const uint32_t intervalMs )
inline

Start periodic measurement.

Parameters
modeOperation mode
freqFrequency
intervalMsMeasurement Interval(ms)
Returns
True if successful

◆ startPeriodicMeasurement() [2/2]

bool m5::unit::UnitPAJ7620U2::startPeriodicMeasurement ( const uint32_t intervalMs = 0)
inline

Start periodic measurement in the current settings.

Parameters
intervalMsMeasurement Interval(ms)
Returns
True if successful

◆ stopPeriodicMeasurement()

bool m5::unit::UnitPAJ7620U2::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ writeApproachThreshold()

bool m5::unit::UnitPAJ7620U2::writeApproachThreshold ( const uint8_t high,
const uint8_t low )

Write the threshold for detect approach.

Parameters
highHigh threshold
lowLowthreshold
Note
Approach:brightness >= high
Not approach: brightness <= low
Warning
Only valid in Proximity mode

◆ writeFrequency()

bool m5::unit::UnitPAJ7620U2::writeFrequency ( const paj7620u2::Frequency f)

Write the frequency.

Parameters
fFrequency
Returns
True if successful

◆ writeMode()

bool m5::unit::UnitPAJ7620U2::writeMode ( const paj7620u2::Mode m)

Write the detection mode.

Parameters
modedetection mode
Returns
True if successful