summaryrefslogtreecommitdiff
path: root/esp8266/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 /esp8266/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 'esp8266/common-hal/microcontroller/__init__.c')
-rw-r--r--esp8266/common-hal/microcontroller/__init__.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/esp8266/common-hal/microcontroller/__init__.c b/esp8266/common-hal/microcontroller/__init__.c
index 4fb5eee63..6aef23761 100644
--- a/esp8266/common-hal/microcontroller/__init__.c
+++ b/esp8266/common-hal/microcontroller/__init__.c
@@ -25,8 +25,10 @@
*/
#include "common-hal/microcontroller/Pin.h"
-#include "common-hal/microcontroller/Pin.h"
+#include "common-hal/microcontroller/Processor.h"
+
#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/Processor.h"
#include "eagle_soc.h"
#include "ets_alt_task.h"
@@ -52,6 +54,14 @@ void common_hal_mcu_enable_interrupts() {
enable_irq(saved_interrupt_state & ~(1 << ETS_LOOP_ITER_BIT));
}
+// The singleton microcontroller.Processor object, returned by microcontroller.cpu
+// It currently only has properties, and no state.
+mcu_processor_obj_t common_hal_mcu_processor_obj = {
+ .base = {
+ .type = &mcu_processor_type,
+ },
+};
+
// This macro is used to simplify pin definition in boards/<board>/pins.c
#define PIN(p_name, p_gpio_number, p_gpio_function, p_peripheral) \
const mcu_pin_obj_t pin_## p_name = { \