From fdb97eda09ca1968df8a919d15ebd1fe191fb57e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 31 Aug 2017 13:48:30 -0400 Subject: Add microcontroller.cpu.temperature, for use as a simple sensor on minimal boards. (#211) * Add microcontroller.cpu, the sole instance of microcontroller.Processor. microcontroller.cpu.frequency is the clock frequency, in Hz. microcontroller.cpu.temperature is the reading from the internal temperature sensor, in Celsius. None if not available. * Squeeze firmware size by using -finline-limit. Otherwise non-Express builds were slightly too big. * Update submodules. * Fix documentation glitches --- atmel-samd/common-hal/microcontroller/__init__.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'atmel-samd/common-hal/microcontroller/__init__.c') diff --git a/atmel-samd/common-hal/microcontroller/__init__.c b/atmel-samd/common-hal/microcontroller/__init__.c index 2b9cc8bfc..84cea008b 100644 --- a/atmel-samd/common-hal/microcontroller/__init__.c +++ b/atmel-samd/common-hal/microcontroller/__init__.c @@ -30,6 +30,7 @@ #include "samd21_pins.h" #include "shared-bindings/nvm/ByteArray.h" +#include "shared-bindings/microcontroller/Processor.h" void common_hal_mcu_delay_us(uint32_t delay) { mp_hal_delay_us(delay); @@ -50,8 +51,17 @@ void common_hal_mcu_enable_interrupts(void) { cpu_irq_restore(irq_flags); } +// The singleton microcontroller.Processor object, bound to microcontroller.cpu +// It currently only has properties, and no state. +mcu_processor_obj_t common_hal_mcu_processor_obj = { + .base = { + .type = &mcu_processor_type, + }, +}; + // NVM is only available on Express boards for now. #if CIRCUITPY_INTERNAL_NVM_SIZE > 0 +// The singleton nvm.ByteArray object. nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { .base = { .type = &nvm_bytearray_type, -- cgit v1.2.3