PixArt Optical Track Sensor, OTS, demo program for P9130 sensor with library. Imported and modified from P9126 demo program. Initial release v1.0.
Dependencies: Pixart_OTS
Fork of OTS_P9130_Demo by
main.cpp@1:4c9b5b2f001e, 2019-02-26 (annotated)
- Committer:
- PixArtHC
- Date:
- Tue Feb 26 23:02:18 2019 +0000
- Revision:
- 1:4c9b5b2f001e
- Parent:
- 0:79d6b8ec630c
- Child:
- 2:be9899699c7c
V1.1, modify typo in comments.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PixArtHC | 0:79d6b8ec630c | 1 | /* mbed Microcontroller Library |
PixArtHC | 0:79d6b8ec630c | 2 | * Copyright (c) 2018 ARM Limited |
PixArtHC | 0:79d6b8ec630c | 3 | * SPDX-License-Identifier: Apache-2.0 |
PixArtHC | 0:79d6b8ec630c | 4 | */ |
PixArtHC | 0:79d6b8ec630c | 5 | |
PixArtHC | 1:4c9b5b2f001e | 6 | /* PAW3007: Finger navigation chip. |
PixArtHC | 0:79d6b8ec630c | 7 | * By PixArt Imaging Inc. |
PixArtHC | 0:79d6b8ec630c | 8 | * Primary Engineer: Hill Chen (PixArt USA) |
PixArtHC | 0:79d6b8ec630c | 9 | * |
PixArtHC | 0:79d6b8ec630c | 10 | * License: Apache-2.0; http://www.apache.org/licenses/LICENSE-2.0 |
PixArtHC | 0:79d6b8ec630c | 11 | */ |
PixArtHC | 0:79d6b8ec630c | 12 | |
PixArtHC | 0:79d6b8ec630c | 13 | /* Revision History |
PixArtHC | 1:4c9b5b2f001e | 14 | * V1.1: February 26, 2019 |
PixArtHC | 1:4c9b5b2f001e | 15 | * Modify typo in comments. |
PixArtHC | 1:4c9b5b2f001e | 16 | * |
PixArtHC | 0:79d6b8ec630c | 17 | * V1.0: February 25, 2019 |
PixArtHC | 0:79d6b8ec630c | 18 | * First release. |
PixArtHC | 0:79d6b8ec630c | 19 | */ |
PixArtHC | 0:79d6b8ec630c | 20 | |
PixArtHC | 0:79d6b8ec630c | 21 | |
PixArtHC | 0:79d6b8ec630c | 22 | #include "mbed.h" |
PixArtHC | 0:79d6b8ec630c | 23 | #include "Pixart_OFN.h" |
PixArtHC | 0:79d6b8ec630c | 24 | |
PixArtHC | 0:79d6b8ec630c | 25 | Serial pc(USBTX, USBRX); |
PixArtHC | 0:79d6b8ec630c | 26 | I2C i2c(I2C_SDA0, I2C_SCL0); |
PixArtHC | 0:79d6b8ec630c | 27 | |
PixArtHC | 0:79d6b8ec630c | 28 | // main() runs in its own thread in the OS |
PixArtHC | 0:79d6b8ec630c | 29 | int main() |
PixArtHC | 0:79d6b8ec630c | 30 | { |
PixArtHC | 0:79d6b8ec630c | 31 | bool Result = false; |
PixArtHC | 0:79d6b8ec630c | 32 | Pixart_OFN *m_Sensor = new Pixart_OFN(&i2c, &pc, 0.25f, Result); |
PixArtHC | 0:79d6b8ec630c | 33 | if(Result) pc.printf("\r\n\n %s %s initialization successfully\r\n", PRODUCT, MODEL); |
PixArtHC | 0:79d6b8ec630c | 34 | else{ pc.printf("\r\n\n %s %s fail on initialization", PRODUCT, MODEL); |
PixArtHC | 0:79d6b8ec630c | 35 | while (true) ; |
PixArtHC | 0:79d6b8ec630c | 36 | } |
PixArtHC | 0:79d6b8ec630c | 37 | |
PixArtHC | 0:79d6b8ec630c | 38 | while (true){ |
PixArtHC | 0:79d6b8ec630c | 39 | #ifndef USE_CALLBACK |
PixArtHC | 0:79d6b8ec630c | 40 | m_Sensor->periodicCallback(); |
PixArtHC | 0:79d6b8ec630c | 41 | wait_ms(250); |
PixArtHC | 0:79d6b8ec630c | 42 | #endif |
PixArtHC | 0:79d6b8ec630c | 43 | } |
PixArtHC | 0:79d6b8ec630c | 44 | } |