File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
common-hal/microcontroller Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 61
61
* POSSIBILITY OF SUCH DAMAGE.
62
62
*/
63
63
64
+ #include <math.h>
65
+
64
66
#include "py/mphal.h"
65
67
#include "common-hal/microcontroller/Processor.h"
66
68
@@ -276,6 +278,9 @@ float common_hal_mcu_processor_get_temperature(void) {
276
278
}
277
279
278
280
float common_hal_mcu_processor_get_voltage (void ) {
281
+ #if MICROCONTROLLER_VOLTAGE_DISABLE
282
+ return NAN ;
283
+ #else
279
284
struct adc_sync_descriptor adc ;
280
285
281
286
static Adc * adc_insts [] = ADC_INSTS ;
@@ -320,6 +325,7 @@ float common_hal_mcu_processor_get_voltage(void) {
320
325
adc_sync_deinit (& adc );
321
326
// Multiply by 4 to compensate for SCALEDIOVCC division by 4.
322
327
return (reading / 4095.0f ) * 4.0f ;
328
+ #endif
323
329
}
324
330
325
331
uint32_t common_hal_mcu_processor_get_frequency (void ) {
Original file line number Diff line number Diff line change 75
75
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
76
76
#elif defined(SAME54 )
77
77
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAME54"
78
+ #ifndef MICROCONTROLLER_VOLTAGE_DISABLE
79
+ #define MICROCONTROLLER_VOLTAGE_DISABLE (1)
80
+ #endif
78
81
#endif
79
82
#define SPI_FLASH_MAX_BAUDRATE 24000000
80
83
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
246
249
CIRCUITPY_COMMON_ROOT_POINTERS \
247
250
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT];
248
251
252
+ #ifndef MICROCONTROLLER_VOLTAGE_DISABLE
253
+ #define MICROCONTROLLER_VOLTAGE_DISABLE (0)
254
+ #endif
255
+
249
256
#endif // __INCLUDED_MPCONFIGPORT_H
You can’t perform that action at this time.
0 commit comments