From 72fea370ff20ecb2494ab985c4431b4bd691e7cd Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 17 Nov 2025 15:11:05 +0800
Subject: [PATCH] update lighted program

---
 project/lightd/hal/tsl2561.h |   46 +++++++++++++++++++---------------------------
 1 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/project/lightd/hal/tsl2561.h b/project/lightd/hal/tsl2561.h
index 3a92a6a..540a0bd 100644
--- a/project/lightd/hal/tsl2561.h
+++ b/project/lightd/hal/tsl2561.h
@@ -1,42 +1,34 @@
-/********************************************************************************
- *      Copyright:  (C) 2019 LingYun IoT System Studio
+/*********************************************************************************
+ *      Copyright:  (C) 2023 LingYun IoT System Studio
  *                  All rights reserved.
  *
  *       Filename:  tsl2561.h
- *    Description:  This head file is the Lux sensor TSL2561 API functions on RaspberryPi
+ *    Description:  This file is the Lux sensor TSL2561 code
  *
- *        Version:  1.0.0(04/07/19)
+ *        Version:  1.0.0(10/08/23)
  *         Author:  Guo Wenxue <guowenxue@gmail.com>
- *      ChangeLog:  1, Release initial version on "04/07/19 17:42:35"
+ *      ChangeLog:  1, Release initial version on "10/08/23 17:52:00"
+ *
+ * Pin connection:
+ *              TSL2561 Module           Raspberry Pi Board
+ *                   VCC      <----->      #Pin1(3.3V)
+ *                   SDA0     <----->      #Pin27(SDA, BCM GPIO0)
+ *                   SCL0     <----->      #Pin28(SCL, BCM GPIO1)
+ *                   GND      <----->      GND
+ *
+ * /boot/config.txt:
+ *                  dtoverlay=i2c0,pins_0_1
  *
  ********************************************************************************/
 
 #ifndef  _TSL2561_H_
 #define  _TSL2561_H_
 
-#define TSL2561_I2C_ADDR                0x39
+#define TSL2561_I2CDEV                 "/dev/i2c-0"
+#define TSL2561_I2CADDR                 0x39
 
-#define CONTROL_REG                     0x80
-#define REG_COUNT                       4
-
-#define POWER_UP                        0x03
-#define POWER_DOWN                      0x00
-
-/* Register Address  */
-enum
-{
-    /* Channel_0 = DATA0HIGH<<8 + DATA0LOW */
-    DATA0LOW = 0x8C,
-    DATA0HIGH,
-
-    /* Channel_1 = DATA1HIGH<<8 + DATA1LOW */
-    DATA1LOW,
-    DATA1HIGH,
-};
-
-extern int tsl2561_init(void);
-extern void tsl2561_term(void);
-extern float tsl2561_get_lux(void);
+extern int tsl2561_get_lux(float *lux);
 
 #endif   /* ----- #ifndef _TSL2561_H_  ----- */
 
+

--
Gitblit v1.9.1