PAJ7620 Device API class - As developed by RevEng Devs.
More...
#include <RevEng_PAJ7620.h>
PAJ7620 Device API class - As developed by RevEng Devs.
Provides a user friendly interface to the PAJ7620 device
- Author
- Aaron S. Crandall
◆ begin() [1/2]
| uint8_t RevEng_PAJ7620::begin |
( |
| ) |
|
PAJ7620 device initialization and I2C connect to default Wire bus.
- Parameters
-
- Returns
- error code: 0 (false); success: return 1 (true)
◆ begin() [2/2]
| uint8_t RevEng_PAJ7620::begin |
( |
TwoWire * |
chosenWireHandle | ) |
|
PAJ7620 device initialization and I2C connect on specified Wire bus.
Override version:
- Takes a TwoWire pointer allowing the user to pass in a specified I2C bus for devices using alternatives to bus 0 such as: begin(&Wire1) or begin(&Wire2)
- Parameters
-
| chosenWireHandle | A pointer to the Wire handle that should be used to communicate with the PAJ7620 |
- Returns
- error code: 0 (false); success: return 1 (true)
◆ clearGestureInterrupts()
| void RevEng_PAJ7620::clearGestureInterrupts |
( |
| ) |
|
Clear current gesture interrupt vectors without returning gesture value.
- Note
- The gesture interrupt vectors are reset in hardware after any reads
- Parameters
-
- Returns
- none
◆ disable()
| void RevEng_PAJ7620::disable |
( |
| ) |
|
Disables sensor for reading & interrupts.
- Note
- This is the light disable state, not the full I2C shutdown state
- Parameters
-
- Returns
- none
◆ enable()
| void RevEng_PAJ7620::enable |
( |
| ) |
|
Enables sensor for reading & interrupts.
- Parameters
-
- Returns
- none
◆ getCorner()
| Corner RevEng_PAJ7620::getCorner |
( |
| ) |
|
Gets which quadrant an object is in.
- Parameters
-
- Returns
- Corner : [NW, NW, SW, SE] quadrants, middle/buffer, NONE for no object in view
◆ getCursorX()
| int RevEng_PAJ7620::getCursorX |
( |
| ) |
|
Gets cursor object's current X location.
- Note
- Only works in cursor mode
- Parameters
-
- Returns
- int : X coordinate of cursor
◆ getCursorY()
| int RevEng_PAJ7620::getCursorY |
( |
| ) |
|
Gets cursor object's current Y location.
- Note
- Only works in cursor mode
- Parameters
-
- Returns
- int : Y coordinate of cursor
◆ getNoMotionCount()
| int RevEng_PAJ7620::getNoMotionCount |
( |
| ) |
|
Get how long no motion has been seen in gesture mode.
- This counts how long it has been since motions has occurred in front of the sensor. This counts even if there's an object in view when it isn't moving. Eratta: This should return 0..255, but seems to stop at 12. Each "count" is probably 7.2ms, but it's been tough to figure out.
- Returns
- int : ticks value 0..12
◆ getNoObjectCount()
| int RevEng_PAJ7620::getNoObjectCount |
( |
| ) |
|
Get how long since the object left the view in gesture mode.
- When an object has left the sensor's view, this register starts counting up. It's counting in ticks, roughly one per 7.2ms. It maxes out at 255, which happens at about 1830ms
- Returns
- int : ticks value 0..255
◆ getObjectBrightness()
| int RevEng_PAJ7620::getObjectBrightness |
( |
| ) |
|
Read object's "brightness".
- Objects in view have their IR reflection measured. This interface returns a measure of this brightness from 0..255
- Returns
- int brightness: brightness value 0..255
◆ getObjectCenterX()
| int RevEng_PAJ7620::getObjectCenterX |
( |
| ) |
|
Gets Gesture object's current X location.
- Note
- Only works in gesture mode - default coordinates are 0 on right
-
Range seems to be 0..3712 in default gesture mode
- Parameters
-
- Returns
- int : X coordinate of cursor
◆ getObjectCenterY()
| int RevEng_PAJ7620::getObjectCenterY |
( |
| ) |
|
Gets Gesture object's current Y location.
- Note
- Only works in gesture mode - default coordinates are 0 on top
-
Range seems to be 0..3712 in default gesture mode
- Parameters
-
- Returns
- int : Y coordinate of cursor
◆ getObjectSize()
| int RevEng_PAJ7620::getObjectSize |
( |
| ) |
|
Read object's size (in pixels)
- The sensor has a 30x30 IR LED array. This interface returns a count of how many pixels are part of the object in view being tracked.
- Returns
- int size: value 0..900
◆ getObjectVelocityX()
| int RevEng_PAJ7620::getObjectVelocityX |
( |
| ) |
|
Gets object's current X velocity's value.
- Value filtered to zero if object not in view
- Note
- Range seems to be -63..63
- Parameters
-
- Returns
- int : X velocity -63..63
◆ getObjectVelocityX_raw()
| int RevEng_PAJ7620::getObjectVelocityX_raw |
( |
| ) |
|
Gets object's current X velocity's raw value.
- Note
- Range seems to be -63..63
- Parameters
-
- Returns
- int : X velocity -63..63
◆ getObjectVelocityY()
| int RevEng_PAJ7620::getObjectVelocityY |
( |
| ) |
|
Gets object's current Y velocity's value.
- Value filtered to zero if object not in view
- Note
- Range seems to be -63..63
- Parameters
-
- Returns
- int : Y velocity -63..63
◆ getObjectVelocityY_raw()
| int RevEng_PAJ7620::getObjectVelocityY_raw |
( |
| ) |
|
Gets object's current Y velocity's raw value.
- Note
- Range seems to be -63..63
- Parameters
-
- Returns
- int : Y velocity -63..63
◆ getWaveCount()
| int RevEng_PAJ7620::getWaveCount |
( |
| ) |
|
Get current count of waves by user.
- Parameters
-
- Returns
- int : current count of "waves" over the sensor
◆ invertXAxis()
| void RevEng_PAJ7620::invertXAxis |
( |
| ) |
|
Inverts the X (horizontal) axis.
- Allows you to choose the orientation of your coordinate system. In all modes, the X axis is inverted. Left becomes Right, etc. For cursor mode, the X values will flip
- Parameters
-
- Returns
- none
◆ invertYAxis()
| void RevEng_PAJ7620::invertYAxis |
( |
| ) |
|
Inverts the Y (vertical) axis.
- Allows you to choose the orientation of your coordinate system. In all modes, the Y axis is inverted. Up becomes Down, etc. For cursor mode, the Y values will flip
- Parameters
-
- Returns
- none
◆ isCursorInView()
| bool RevEng_PAJ7620::isCursorInView |
( |
| ) |
|
Returns whether an object is in view as a cursor.
- Note
- Only works in cursor mode
- Parameters
-
- Returns
- bool : True if object in view, False if no object in view
◆ isObjectInView()
| bool RevEng_PAJ7620::isObjectInView |
( |
| ) |
|
Gets whether an object is in view or not.
- Parameters
-
- Returns
- bool : true if object in view
◆ readGesture()
| Gesture RevEng_PAJ7620::readGesture |
( |
| ) |
|
Reads the latest gesture from the device.
- This is the central method for reading and calculating the main 9 gestures the PAJ7620 can recognize. It returns a Gesture enum with the read gesture, which can by GES_NONE if no gesture was currently found.
- Note
- Clears interrupt vector of gestures when called
- Parameters
-
- Returns
- Gesture found or Gesture::GES_NONE if no gesture found
◆ setCursorMode()
| void RevEng_PAJ7620::setCursorMode |
( |
| ) |
|
Puts device into Cursor mode.
- Initializes registers for Cursor mode and enables only the cursor interrupts
- Parameters
-
- Returns
- none
◆ setGameSpeed()
| void RevEng_PAJ7620::setGameSpeed |
( |
| ) |
|
Set sensor to "game mode" sampling speed of 240fps.
- Note
- Value of 0x30 for setting comes from PixArt contact
- Parameters
-
- Returns
- none
◆ setGestureEntryTime()
| void RevEng_PAJ7620::setGestureEntryTime |
( |
unsigned long |
newGestureEntryTime | ) |
|
Sets time sensor waits between getGesture call to reading gesture from sensor.
- This time is most important in hardware interrupt driven use of the driver. The PAJ7620's interrupt pin will raise when a gesture is first recognized. If the user is trying to move their hand to do a Backward gesture, they will first trip a lateral (up, down, left, right) gesture, which will immediately raise the interrupt. By increasing this value, the user shall have more time to reach in and complete their intended gesture before the interrupt is handled.
- Note
- Default value for entry time is 0
- Parameters
-
| newGestureEntryTime | : milliseconds (ms) for delay |
- Returns
- none
◆ setGestureExitTime()
| void RevEng_PAJ7620::setGestureExitTime |
( |
unsigned long |
newGestureExitTime | ) |
|
Sets time sensor waits during getGesture() after gesture value read.
- This value represents the time the user has to exit the sensor's field of view before the next gesture might be read, which is most important in the Z axis gestures (forward and backward). Setting this lower makes the driver delay less so the main program can control more of the global timing, but puts responsibility on the coder to take this higher sensitivity into account.
- Note
- Default value for exit time is 200
- Parameters
-
| newGestureEntryTime | : milliseconds (ms) for delay |
- Returns
- none
◆ setGestureMode()
| void RevEng_PAJ7620::setGestureMode |
( |
| ) |
|
Puts device into Gesture mode.
- Initializes registers for Gesture mode and enables only the gesture interrupts
- Parameters
-
- Returns
- none
◆ setNormalSpeed()
| void RevEng_PAJ7620::setNormalSpeed |
( |
| ) |
|
Set sensor to "normal" sampling speed of 120fps.
- Note
- Value of 0xAC for setting comes from PixArt contact
- Parameters
-
- Returns
- none
The documentation for this class was generated from the following files: