Integrate color sensor, infrared LEDs and phototransistors into Power Management

This commit is contained in:
2025-02-12 21:26:29 +01:00
parent e5ff1e7610
commit 5407543658
6 changed files with 65 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
#include "ColorDetection.h"
void ColorDetection::begin(void){
Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::RGBW_SENSOR, PowerParameters::CurrentConsumptions::CURRENT_SENSOR_RGBW, COLOR_DETECTION_MAX_EXECUTION_DELAY_MS, NULL);
ColorDetection::configure(VEML_CONFIG{.mode = AUTO,.enabled = true,.exposureTime=MS40});
};
void ColorDetection::configure(VEML_CONFIG config){

View File

@@ -11,9 +11,10 @@
#ifndef ColorDetection_h
#define ColorDetection_h
#include <stdint.h>
#include <Wire.h>
#include "../power/Power.h"
#include <Arduino.h>
#include <Wire.h>
#include <stdint.h>
//Definitions for I2c
#define I2C_MASTER_SCL_IO 2 /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO 1 /*!< GPIO number used for I2C master data */
@@ -28,6 +29,8 @@
#define REG_BLUE 0x0A
#define REG_WHITE 0x0B
#define COLOR_DETECTION_MAX_EXECUTION_DELAY_MS 1
enum duration{
MS40,