summaryrefslogtreecommitdiff
path: root/atmel-samd/common-hal/microcontroller/__init__.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2017-08-31 13:48:30 -0400
committerGitHub <noreply@github.com>2017-08-31 13:48:30 -0400
commitfdb97eda09ca1968df8a919d15ebd1fe191fb57e (patch)
tree600ed31b4d8e7223719a6099fd862c11b9b73e9e /atmel-samd/common-hal/microcontroller/__init__.c
parentf3cd6b0232ababc573ebfb13de12c197e0be6b4d (diff)
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
Diffstat (limited to 'atmel-samd/common-hal/microcontroller/__init__.c')
-rw-r--r--atmel-samd/common-hal/microcontroller/__init__.c10
1 files changed, 10 insertions, 0 deletions
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,