Reference firmware for PixArt's ADBM-A350 sensor and evaluation board. "Hello World" and "Library" contain the exact same files. Please import just one of the two into your mBed compiler as a new program and not as a library.

Welcome to the code repository for PixArt's ADBM-A350 sensor and evaluation board.

For general information about this product, please visit this product's components page here:
https://os.mbed.com/components/ADBM-A350-Finger-Navigation-Optical-Sens/

For guides and tips on how to setup and evaluate the ADBM-A350 sensor with the Nordic nRF52-DK microcontroller using this reference code, please visit this guide:
https://os.mbed.com/teams/PixArt/code/ADBM-A350_referenceCode/wiki/Guide-for-nRF52-DK-Platform

For guides and tips on how to setup and evaluate the ADBM-A350 sensor with any mBed-supported microcontroller using this reference code, please visit this guide:
https://os.mbed.com/teams/PixArt/code/ADBM-A350_referenceCode/wiki/Guide-for-Any-Platform

Committer:
PixArtVY
Date:
Mon Jun 25 21:14:10 2018 +0000
Revision:
0:a051df82fcdf
Child:
1:67d6484416a6
First release.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
PixArtVY 0:a051df82fcdf 1 // ADBM-A350: Finger navigation chip.
PixArtVY 0:a051df82fcdf 2 // Version: 1.0
PixArtVY 0:a051df82fcdf 3 // Latest Revision Date: 14 June 2018
PixArtVY 0:a051df82fcdf 4 // By PixArt Imaging Inc.
PixArtVY 0:a051df82fcdf 5 // Primary Engineer: Vincent Yeh (PixArt USA)
PixArtVY 0:a051df82fcdf 6
PixArtVY 0:a051df82fcdf 7 /*
PixArtVY 0:a051df82fcdf 8 //=======================
PixArtVY 0:a051df82fcdf 9 //Revision History
PixArtVY 0:a051df82fcdf 10 //=======================
PixArtVY 0:a051df82fcdf 11 Version 1.0 -- 14 June 2018
PixArtVY 0:a051df82fcdf 12 First release.
PixArtVY 0:a051df82fcdf 13 */
PixArtVY 0:a051df82fcdf 14
PixArtVY 0:a051df82fcdf 15 #include "mbed.h"
PixArtVY 0:a051df82fcdf 16 #include "registerArrays.h"
PixArtVY 0:a051df82fcdf 17 //#include "I2CcommFunctions.h"
PixArtVY 0:a051df82fcdf 18 #include "SPIcommFunctions.h"
PixArtVY 0:a051df82fcdf 19 //Make sure you only have one of either SPIcommFunctions or I2CcommFunctions enabled. You cannot include both headers.
PixArtVY 0:a051df82fcdf 20
PixArtVY 0:a051df82fcdf 21 int main()
PixArtVY 0:a051df82fcdf 22 {
PixArtVY 0:a051df82fcdf 23 pc.baud(115200); // Set baud rate to 115200. Remember to sync serial terminal baud rate to the same value.
PixArtVY 0:a051df82fcdf 24
PixArtVY 0:a051df82fcdf 25 #ifdef SPImode
PixArtVY 0:a051df82fcdf 26 IO_sel = 1; // Set IO_select pin to be HIGH for SPI.
PixArtVY 0:a051df82fcdf 27 spi.format(8,3); // Set SPI to 8 bits with inverted polarity and phase-shifted to second edge.
PixArtVY 0:a051df82fcdf 28 spi.frequency(100000); // Set frequency for SPI communication.
PixArtVY 0:a051df82fcdf 29 cs = 1; // Initialize chip select as inactive.
PixArtVY 0:a051df82fcdf 30 #endif
PixArtVY 0:a051df82fcdf 31
PixArtVY 0:a051df82fcdf 32 #ifdef I2Cmode
PixArtVY 0:a051df82fcdf 33 IO_sel = 0; // Set IO_select pin to be LOW for I2C.
PixArtVY 0:a051df82fcdf 34 i2c.frequency(400000); // Set frequency for I2C communication.
PixArtVY 0:a051df82fcdf 35 cs = 1; // These two pins are used to determine the device's slave ID.
PixArtVY 0:a051df82fcdf 36 MOSI = 1;
PixArtVY 0:a051df82fcdf 37 #endif
PixArtVY 0:a051df82fcdf 38
PixArtVY 0:a051df82fcdf 39 shutdown = 0;
PixArtVY 0:a051df82fcdf 40 writeRegister(0x3A, 0x5A); //Soft-reset the chip.
PixArtVY 0:a051df82fcdf 41
PixArtVY 0:a051df82fcdf 42 pc.printf("Program START\n\r");
PixArtVY 0:a051df82fcdf 43
PixArtVY 0:a051df82fcdf 44 pc.printf("ID Check: %2X\n\r", readRegister(0x00)); //Checks product ID to make sure communication protocol is working properly.
PixArtVY 0:a051df82fcdf 45 if(readRegister(0x00) != 0x88)
PixArtVY 0:a051df82fcdf 46 {
PixArtVY 0:a051df82fcdf 47 pc.printf("Communication protocol error! Terminating program.\n\r");
PixArtVY 0:a051df82fcdf 48 return 0;
PixArtVY 0:a051df82fcdf 49 }
PixArtVY 0:a051df82fcdf 50
PixArtVY 0:a051df82fcdf 51 load(initialize, initialize_size); //Load register settings from the "initialize" array (see registerArrays.h)
PixArtVY 0:a051df82fcdf 52
PixArtVY 0:a051df82fcdf 53 while(1)
PixArtVY 0:a051df82fcdf 54 {
PixArtVY 0:a051df82fcdf 55 //pc.printf("MOTION bit: %2X\n\r", readRegister(0x02)); //Prints EVENT register for debugging.
PixArtVY 0:a051df82fcdf 56
PixArtVY 0:a051df82fcdf 57 if(readRegister(0x02) & 0x80)
PixArtVY 0:a051df82fcdf 58 {
PixArtVY 0:a051df82fcdf 59 grabData();
PixArtVY 0:a051df82fcdf 60 printData();
PixArtVY 0:a051df82fcdf 61 }
PixArtVY 0:a051df82fcdf 62 }
PixArtVY 0:a051df82fcdf 63 }