LibDriver PMW3901MB
Loading...
Searching...
No Matches
driver_pmw3901mb.c File Reference

driver pmw3901mb source file More...

#include "driver_pmw3901mb.h"
Include dependency graph for driver_pmw3901mb.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "PixArt Imaging PMW3901MB"
 chip information definition
#define MANUFACTURER_NAME   "PixArt Imaging"
#define SUPPLY_VOLTAGE_MIN   1.8f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   70.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define PMW3901MB_REG_PRODUCT_ID   0x00
 chip register definition
#define PMW3901MB_REG_REVISION_ID   0x01
#define PMW3901MB_REG_MOTION   0x02
#define PMW3901MB_REG_DELTA_X_L   0x03
#define PMW3901MB_REG_DELTA_X_H   0x04
#define PMW3901MB_REG_DELTA_Y_L   0x05
#define PMW3901MB_REG_DELTA_Y_H   0x06
#define PMW3901MB_REG_SQUAL   0x07
#define PMW3901MB_REG_RAW_DATA_SUM   0x08
#define PMW3901MB_REG_MAXIMUM_RAW_DATA   0x09
#define PMW3901MB_REG_MINIMUM_RAW_DATA   0x0A
#define PMW3901MB_REG_SHUTTER_LOWER   0x0B
#define PMW3901MB_REG_SHUTTER_UPPER   0x0C
#define PMW3901MB_REG_OBSERVATION   0x15
#define PMW3901MB_REG_MOTION_BURST   0x16
#define PMW3901MB_REG_POWER_UP_RESET   0x3A
#define PMW3901MB_REG_SHUTDOWN   0x3B
#define PMW3901MB_REG_RAW_DATA_GRAB   0x58
#define PMW3901MB_REG_RAW_DATA_GRAB_STATUS   0x59
#define PMW3901MB_REG_INVERSE_PRODUCT_ID   0x5F

Functions

uint8_t pmw3901mb_init (pmw3901mb_handle_t *handle)
 initialize the chip
uint8_t pmw3901mb_deinit (pmw3901mb_handle_t *handle)
 close the chip
uint8_t pmw3901mb_power_up (pmw3901mb_handle_t *handle)
 power up the chip
uint8_t pmw3901mb_burst_read (pmw3901mb_handle_t *handle, pmw3901mb_motion_t *motion)
 burst read data
uint8_t pmw3901mb_start_frame_capture (pmw3901mb_handle_t *handle)
 start frame capture
uint8_t pmw3901mb_stop_frame_capture (pmw3901mb_handle_t *handle)
 stop frame capture
uint8_t pmw3901mb_get_frame (pmw3901mb_handle_t *handle, uint8_t frame[35][35])
 get the frame
uint8_t pmw3901mb_set_optimum_performance (pmw3901mb_handle_t *handle)
 set the optimum performance
uint8_t pmw3901mb_get_product_id (pmw3901mb_handle_t *handle, uint8_t *id)
 get the product id
uint8_t pmw3901mb_get_inverse_product_id (pmw3901mb_handle_t *handle, uint8_t *id)
 get the inverse product id
uint8_t pmw3901mb_get_revision_id (pmw3901mb_handle_t *handle, uint8_t *id)
 get the revision id
uint8_t pmw3901mb_reset (pmw3901mb_handle_t *handle)
 reset the chip
uint8_t pmw3901mb_shutdown (pmw3901mb_handle_t *handle)
 shutdown the chip
uint8_t pmw3901mb_get_motion (pmw3901mb_handle_t *handle, uint8_t *motion)
 get the motion
uint8_t pmw3901mb_set_motion (pmw3901mb_handle_t *handle, uint8_t motion)
 set the motion
uint8_t pmw3901mb_get_delta_x (pmw3901mb_handle_t *handle, int16_t *delta)
 get the delta x
uint8_t pmw3901mb_get_delta_y (pmw3901mb_handle_t *handle, int16_t *delta)
 get the delta y
uint8_t pmw3901mb_get_motion_burst (pmw3901mb_handle_t *handle, uint8_t *burst, uint8_t len)
 get the motion burst
uint8_t pmw3901mb_get_squal (pmw3901mb_handle_t *handle, uint8_t *squal)
 get the surface quality
uint8_t pmw3901mb_get_raw_data_sum (pmw3901mb_handle_t *handle, uint8_t *sum)
 get the average raw data value
uint8_t pmw3901mb_get_max_raw_data (pmw3901mb_handle_t *handle, uint8_t *max)
 get the maximum raw data value
uint8_t pmw3901mb_get_min_raw_data (pmw3901mb_handle_t *handle, uint8_t *min)
 get the minimum raw data value
uint8_t pmw3901mb_get_shutter (pmw3901mb_handle_t *handle, uint16_t *shutter)
 get the shutter
uint8_t pmw3901mb_get_observation (pmw3901mb_handle_t *handle, uint8_t *observation)
 get the observation
uint8_t pmw3901mb_set_observation (pmw3901mb_handle_t *handle, uint8_t observation)
 set the observation
uint8_t pmw3901mb_get_raw_data_grab (pmw3901mb_handle_t *handle, uint8_t *grab, uint16_t len)
 get the raw data grab
uint8_t pmw3901mb_set_raw_data_grab (pmw3901mb_handle_t *handle, uint8_t *grab, uint16_t len)
 set the raw data grab
uint8_t pmw3901mb_get_raw_data_grab_status (pmw3901mb_handle_t *handle, uint8_t *status)
 get the raw data grab status
uint8_t pmw3901mb_delta_raw_to_delta_cm (pmw3901mb_handle_t *handle, int16_t raw, float height_m, float *cm)
 convert the delta raw to the delta cm
uint8_t pmw3901mb_set_reg (pmw3901mb_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t pmw3901mb_get_reg (pmw3901mb_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t pmw3901mb_info (pmw3901mb_info_t *info)
 get chip's information

Detailed Description

driver pmw3901mb source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-01-08

history

Date Version Author Description
2022/01/08 1.0 Shifeng Li first upload

Definition in file driver_pmw3901mb.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "PixArt Imaging PMW3901MB"

chip information definition

chip name

Definition at line 42 of file driver_pmw3901mb.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_pmw3901mb.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "PixArt Imaging"

manufacturer name

Definition at line 43 of file driver_pmw3901mb.c.

◆ MAX_CURRENT

#define MAX_CURRENT   70.0f

chip max current

Definition at line 46 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_DELTA_X_H

#define PMW3901MB_REG_DELTA_X_H   0x04

delta_x_h register

Definition at line 58 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_DELTA_X_L

#define PMW3901MB_REG_DELTA_X_L   0x03

delta_x_l register

Definition at line 57 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_DELTA_Y_H

#define PMW3901MB_REG_DELTA_Y_H   0x06

delta_y_h register

Definition at line 60 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_DELTA_Y_L

#define PMW3901MB_REG_DELTA_Y_L   0x05

delta_y_l register

Definition at line 59 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_INVERSE_PRODUCT_ID

#define PMW3901MB_REG_INVERSE_PRODUCT_ID   0x5F

inverse product id register

Definition at line 73 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_MAXIMUM_RAW_DATA

#define PMW3901MB_REG_MAXIMUM_RAW_DATA   0x09

maximum raw data register

Definition at line 63 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_MINIMUM_RAW_DATA

#define PMW3901MB_REG_MINIMUM_RAW_DATA   0x0A

minimum raw data register

Definition at line 64 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_MOTION

#define PMW3901MB_REG_MOTION   0x02

motion register

Definition at line 56 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_MOTION_BURST

#define PMW3901MB_REG_MOTION_BURST   0x16

motion burst register

Definition at line 68 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_OBSERVATION

#define PMW3901MB_REG_OBSERVATION   0x15

observation register

Definition at line 67 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_POWER_UP_RESET

#define PMW3901MB_REG_POWER_UP_RESET   0x3A

power up reset register

Definition at line 69 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_PRODUCT_ID

#define PMW3901MB_REG_PRODUCT_ID   0x00

chip register definition

product id register

Definition at line 54 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_RAW_DATA_GRAB

#define PMW3901MB_REG_RAW_DATA_GRAB   0x58

raw data grab register

Definition at line 71 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_RAW_DATA_GRAB_STATUS

#define PMW3901MB_REG_RAW_DATA_GRAB_STATUS   0x59

raw data grab status register

Definition at line 72 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_RAW_DATA_SUM

#define PMW3901MB_REG_RAW_DATA_SUM   0x08

raw data sum register

Definition at line 62 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_REVISION_ID

#define PMW3901MB_REG_REVISION_ID   0x01

revision id register

Definition at line 55 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_SHUTDOWN

#define PMW3901MB_REG_SHUTDOWN   0x3B

shutdown register

Definition at line 70 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_SHUTTER_LOWER

#define PMW3901MB_REG_SHUTTER_LOWER   0x0B

shutter lower register

Definition at line 65 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_SHUTTER_UPPER

#define PMW3901MB_REG_SHUTTER_UPPER   0x0C

shutter upper register

Definition at line 66 of file driver_pmw3901mb.c.

◆ PMW3901MB_REG_SQUAL

#define PMW3901MB_REG_SQUAL   0x07

squal register

Definition at line 61 of file driver_pmw3901mb.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_pmw3901mb.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.8f

chip min supply voltage

Definition at line 44 of file driver_pmw3901mb.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_pmw3901mb.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_pmw3901mb.c.