mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-14 06:21:41 +02:00
Integrate color sensor, infrared LEDs and phototransistors into Power Management
This commit is contained in:
@ -64,6 +64,10 @@ uint32_t LightDetection::getAverageValue(photoTransistors sensor, uint32_t measu
|
||||
};
|
||||
|
||||
void LightDetection::beginInfrared(void){
|
||||
Power::waitForCurrentAllowance(
|
||||
PowerParameters::PowerConsumers::PT_IR,
|
||||
PowerParameters::CurrentConsumptions::CURRENT_PT * 4,
|
||||
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL);
|
||||
digitalWrite(IR_PT_ENABLE,true);
|
||||
pinMode(IR_PT_ENABLE, OUTPUT);
|
||||
pinMode(IR_PT_FRONT_ADC, INPUT);
|
||||
@ -73,6 +77,10 @@ void LightDetection::beginInfrared(void){
|
||||
};
|
||||
|
||||
void LightDetection::beginDaylight(void){
|
||||
Power::waitForCurrentAllowance(
|
||||
PowerParameters::PowerConsumers::PT_DL,
|
||||
PowerParameters::CurrentConsumptions::CURRENT_PT * 2,
|
||||
LIGHT_DETECTION_MAX_EXECUTION_DELAY_MS, NULL);
|
||||
digitalWrite(DL_PT_ENABLE,true);
|
||||
pinMode(DL_PT_ENABLE, OUTPUT);
|
||||
pinMode(DL_PT_BOTTOM_ADC, INPUT);
|
||||
@ -99,6 +107,7 @@ uint16_t LightDetection::readIRPT(photoTransistors sensor){
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Power::releaseCurrent(PowerParameters::PowerConsumers::PT_IR);
|
||||
//digitalWrite(IR_PT_ENABLE,LOW);
|
||||
return result;
|
||||
};
|
||||
@ -117,6 +126,7 @@ uint16_t LightDetection::readDLPT(photoTransistors sensor){
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Power::releaseCurrent(PowerParameters::PowerConsumers::PT_DL);
|
||||
digitalWrite(DL_PT_ENABLE,LOW);
|
||||
return result;
|
||||
};
|
Reference in New Issue
Block a user