sam e54: disable microcontroller.cpu.voltage

This hangs, and the usual workarounds didn't work.
This commit is contained in:
Jeff Epler 2020-09-08 09:10:31 -05:00
parent a8e98cda83
commit 1b29ceaf1a
2 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <math.h>
#include "py/mphal.h"
#include "common-hal/microcontroller/Processor.h"
@ -276,6 +278,9 @@ float common_hal_mcu_processor_get_temperature(void) {
}
float common_hal_mcu_processor_get_voltage(void) {
#if MICROCONTROLLER_VOLTAGE_DISABLE
return NAN;
#else
struct adc_sync_descriptor adc;
static Adc* adc_insts[] = ADC_INSTS;
@ -320,6 +325,7 @@ float common_hal_mcu_processor_get_voltage(void) {
adc_sync_deinit(&adc);
// Multiply by 4 to compensate for SCALEDIOVCC division by 4.
return (reading / 4095.0f) * 4.0f;
#endif
}
uint32_t common_hal_mcu_processor_get_frequency(void) {

View File

@ -75,6 +75,9 @@
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
#elif defined(SAME54)
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAME54"
#ifndef MICROCONTROLLER_VOLTAGE_DISABLE
#define MICROCONTROLLER_VOLTAGE_DISABLE (1)
#endif
#endif
#define SPI_FLASH_MAX_BAUDRATE 24000000
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
@ -246,4 +249,8 @@
CIRCUITPY_COMMON_ROOT_POINTERS \
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT];
#ifndef MICROCONTROLLER_VOLTAGE_DISABLE
#define MICROCONTROLLER_VOLTAGE_DISABLE (0)
#endif
#endif // __INCLUDED_MPCONFIGPORT_H