File tree Expand file tree Collapse file tree
common-hal/microcontroller Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6161 * POSSIBILITY OF SUCH DAMAGE.
6262 */
6363
64+ #include <math.h>
65+
6466#include "py/mphal.h"
6567#include "common-hal/microcontroller/Processor.h"
6668
@@ -276,6 +278,9 @@ float common_hal_mcu_processor_get_temperature(void) {
276278}
277279
278280float common_hal_mcu_processor_get_voltage (void ) {
281+ #if MICROCONTROLLER_VOLTAGE_DISABLE
282+ return NAN ;
283+ #else
279284 struct adc_sync_descriptor adc ;
280285
281286 static Adc * adc_insts [] = ADC_INSTS ;
@@ -320,6 +325,7 @@ float common_hal_mcu_processor_get_voltage(void) {
320325 adc_sync_deinit (& adc );
321326 // Multiply by 4 to compensate for SCALEDIOVCC division by 4.
322327 return (reading / 4095.0f ) * 4.0f ;
328+ #endif
323329}
324330
325331uint32_t common_hal_mcu_processor_get_frequency (void ) {
Original file line number Diff line number Diff line change 7575#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
7676#elif defined(SAME54 )
7777#define MICROPY_PY_SYS_PLATFORM "MicroChip SAME54"
78+ #ifndef MICROCONTROLLER_VOLTAGE_DISABLE
79+ #define MICROCONTROLLER_VOLTAGE_DISABLE (1)
80+ #endif
7881#endif
7982#define SPI_FLASH_MAX_BAUDRATE 24000000
8083#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
246249 CIRCUITPY_COMMON_ROOT_POINTERS \
247250 mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT];
248251
252+ #ifndef MICROCONTROLLER_VOLTAGE_DISABLE
253+ #define MICROCONTROLLER_VOLTAGE_DISABLE (0)
254+ #endif
255+
249256#endif // __INCLUDED_MPCONFIGPORT_H
You can’t perform that action at this time.
0 commit comments