Skip to content

Commit

Permalink
Make library compile on H7
Browse files Browse the repository at this point in the history
  • Loading branch information
sebromero committed May 7, 2024
1 parent 34ba77e commit b59b709
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ void Board::setAllPeripheralsPower(bool on){
#endif
}

#if defined(ARDUINO_PORTENTA_C33)
void Board::setAnalogDigitalConverterPower(bool on){
if(on){
PMIC.getControl()->turnLDO1On(Ldo1Mode::Normal);
Expand All @@ -259,6 +260,7 @@ void Board::setAnalogDigitalConverterPower(bool on){
PMIC.getControl()->turnLDO1Off(Ldo1Mode::Standby);
}
}
#endif

void Board::setCommunicationPeripheralsPower(bool on){
if(on)
Expand Down
9 changes: 6 additions & 3 deletions src/Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <Arduino.h>
#include <Arduino_PF1550.h>
#include "wireUtils.h"
#include "WireUtils.h"


#if defined(ARDUINO_PORTENTA_C33)
Expand Down Expand Up @@ -199,25 +199,27 @@ class Board {
*/
void deepSleepUntilWakeupEvent();

#if defined(ARDUINO_PORTENTA_C33)
/**
* @brief Toggle the peripherals' power on Portenta C33 (ADC, RGB LED, Secure Element, Wifi and Bluetooth).
* @param on True to turn on the power, false to turn it off.
*/
void setAllPeripheralsPower(bool on);


/**
* @brief Toggles the communication peripherials' power on Portenta C33 (Wifi, Bluetooth and Secure Element)
* @param on True to turn on the power, false to turn it off.
*/
void setCommunicationPeripheralsPower(bool on);

#if defined(ARDUINO_PORTENTA_C33)
/**
* @brief Toggles the power of the analog digital converter on Portenta C33.
* @param on True to turn on the power, false to turn it off.
*/
void setAnalogDigitalConverterPower(bool on);

#endif
/**
* @brief Set the reference voltage on Portenta C33. This value is used by the ADC to convert analog values to digital values.
* This can be particularly useful to increase the accuracy of the ADC when working with low voltages
Expand All @@ -226,7 +228,8 @@ class Board {
* @return True if the voltage was set successfully, false otherwise.
*/
bool setReferenceVoltage(float voltage);
#endif

// TODO add function to shut down the fuel gauge / and hibernate mode

private:
static uint8_t getRailVoltage(float voltage, int context);
Expand Down

0 comments on commit b59b709

Please sign in to comment.