Skip to content

Instantly share code, notes, and snippets.

@ZavenArra
Created June 12, 2024 19:24
Show Gist options
  • Save ZavenArra/40f4b5bb481659cfea36cb69ac5191e1 to your computer and use it in GitHub Desktop.
Save ZavenArra/40f4b5bb481659cfea36cb69ac5191e1 to your computer and use it in GitHub Desktop.
/*
* RRIV - Open Source Environmental Data Logging Platform
* Copyright (C) 20202 Zaven Arra [email protected]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include "switched_power.h"
#include "hardware.h"
#include "logs.h"
void setupSwitchedPower()
{
// enable pin on switchable integrated 3v3 boost converter
pinMode(SWITCHED_POWER_ENABLE, OUTPUT);
digitalWrite(SWITCHED_POWER_ENABLE, LOW);
}
void enableSwitchedPower()
{
debug(F("Enabling switched power"));
digitalWrite(SWITCHED_POWER_ENABLE, HIGH);
delay(2000);
digitalWrite(ENABLE_5V, HIGH); //
}
void disableSwitchedPower()
{
debug(F("Disabling switched power"));
digitalWrite(SWITCHED_POWER_ENABLE, LOW);
digitalWrite(ENABLE_5V, LOW); //
}
void cycleSwitchablePower()
{
debug(F("Cycle switched power"));
disableSwitchedPower();
delay(2000);
enableSwitchedPower();
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment