From fbbf5e9e323c3dc693e6f11888a5e9172b3cbb08 Mon Sep 17 00:00:00 2001 From: Dave Hillier Date: Mon, 11 Jan 2021 21:07:46 +0000 Subject: [PATCH] Added setLed --- src/Bitcraze_PMW3901.cpp | 8 ++++++++ src/Bitcraze_PMW3901.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/Bitcraze_PMW3901.cpp b/src/Bitcraze_PMW3901.cpp index 0bf91d8..b30f5fe 100644 --- a/src/Bitcraze_PMW3901.cpp +++ b/src/Bitcraze_PMW3901.cpp @@ -265,3 +265,11 @@ void Bitcraze_PMW3901::initRegisters() registerWrite(0x5A, 0x50); registerWrite(0x40, 0x80); } + +void Bitcraze_PMW3901::setLed(bool ledOn) +{ + delay(200); + registerWrite(0x7f, 0x14); + registerWrite(0x6f, ledOn ? 0x1c : 0x00); + registerWrite(0x7f, 0x00); +} diff --git a/src/Bitcraze_PMW3901.h b/src/Bitcraze_PMW3901.h index 5b1e867..8ddab80 100644 --- a/src/Bitcraze_PMW3901.h +++ b/src/Bitcraze_PMW3901.h @@ -37,6 +37,8 @@ class Bitcraze_PMW3901 { void enableFrameBuffer(); void readFrameBuffer(char *FBuffer); + void setLed(bool ledOn); + private: uint8_t _cs;