M5Unit-GESTURE 0.2.0 git rev:70c2663
Loading...
Searching...
No Matches
unit_PAJ7620U2.hpp File Reference

PAJ7620U2 Unit for M5UnitUnified. More...

#include <M5UnitComponent.hpp>
#include <m5_utility/container/circular_buffer.hpp>
#include <array>
#include <memory>

Go to the source code of this file.

Classes

struct  m5::unit::paj7620u2::Data
 Measurement data group. More...
 
class  m5::unit::UnitPAJ7620U2
 PAJ7620U2 unit. More...
 
struct  m5::unit::UnitPAJ7620U2::config_t
 Settings for begin. More...
 

Namespaces

namespace  m5
 Top level namespace of M5stack.
 
namespace  paj7620u2
 For PAJ7620U2.
 

Enumerations

enum class  m5::unit::paj7620u2::Gesture : uint16_t {
  None , Up = 1U << 0 , Down = 1U << 1 , Left = 1U << 2 ,
  Right = 1U << 3 , Forward = 1U << 4 , Backward = 1U << 5 , Clockwise = 1U << 6 ,
  CounterClockwise = 1U << 7 , Wave = 1U << 8 , Approach = 1U << 9 , HasObject = 1U << 10 ,
  WakeupTrigger = 1U << 11 , Confirm = 1U << 12 , Abort = 1U << 13 , Reserve = 1U << 14 ,
  NoObject = 1U << 15
}
 Gesture type. More...
 
enum class  m5::unit::paj7620u2::Mode : uint8_t { Gesture , Proximity , Cursor }
 Operation Mode. More...
 
enum class  m5::unit::paj7620u2::Frequency : int8_t { Unknown = -1 , Normal , Gaming }
 Frequency Operating frequency. More...
 

Functions

float m5::unit::paj7620u2::idle_time_to_hz (const uint16_t idle_time)
 Convert R_IDLE_TIME register value to frequency in Hz.
 
uint16_t m5::unit::paj7620u2::hz_to_idle_time (const float hz)
 Convert frequency in Hz to R_IDLE_TIME register value.
 

Detailed Description

PAJ7620U2 Unit for M5UnitUnified.

Enumeration Type Documentation

◆ Frequency

enum class m5::unit::paj7620u2::Frequency : int8_t
strong

Frequency Operating frequency.

Enumerator
Unknown 

Unknown freq.

Normal 

120Hz

Gaming 

240Hz

◆ Gesture

enum class m5::unit::paj7620u2::Gesture : uint16_t
strong

Gesture type.

Same as gesture detection interrupt flag bank:0 reg:0x43,0x44

Enumerator
None 

No gesture.

Up 

To up.

Down 

To down.

Left 

To left.

Right 

To right.

Forward 

Closer to the sensor.

Backward 

Away from the sensor.

Clockwise 

Clockwise.

CounterClockwise 

Counter clock wise.

Wave 

Wave.

Approach 

Approach (proximity mode)

HasObject 

Has object (cursor mode)

WakeupTrigger 

Wakeup (trigger mode)

Confirm 

Confirm (confirm mode)

Abort 

Abort (confirm mode)

Reserve 

Reserved.

NoObject 

No object (cursor mode)

◆ Mode

enum class m5::unit::paj7620u2::Mode : uint8_t
strong

Operation Mode.

Enumerator
Gesture 

Detect gesture.

Proximity 

Detect proximity.

Cursor 

Detect XY coordinate.

Function Documentation

◆ hz_to_idle_time()

uint16_t m5::unit::paj7620u2::hz_to_idle_time ( const float hz)
inline

Convert frequency in Hz to R_IDLE_TIME register value.

Parameters
hzFrequency in Hz (must be > 0)
Returns
R_IDLE_TIME[15:0] register value, or 0 if out of range

Formula: idle_time = 31250 / Hz - 77

◆ idle_time_to_hz()

float m5::unit::paj7620u2::idle_time_to_hz ( const uint16_t idle_time)
inline

Convert R_IDLE_TIME register value to frequency in Hz.

Parameters
idle_timeR_IDLE_TIME[15:0] register value
Returns
Frequency in Hz

Formula: Hz = 31250 / (77 + idle_time), where T = 256/8MHz = 32us