-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add microcontroller.core.temperature, for use as a simple sensor on minimal boards. #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…re. Dummy value returned for now.
Squeeze firmware size by using -finline-limit. Otherwise non-Express builds were slightly too big.
@@ -113,12 +114,13 @@ const mp_obj_module_t mcu_pin_module = { | |||
STATIC const mp_rom_map_elem_t mcu_module_globals_table[] = { | |||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_microcontroller) }, | |||
{ MP_ROM_QSTR(MP_QSTR_delay_us), MP_ROM_PTR(&mcu_delay_us_obj) }, | |||
{ MP_ROM_QSTR(MP_QSTR_core), MP_ROM_PTR(&mcu_core_obj) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break the ESP8266. You probably want to #ifdef it out like nvm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, I implemented core
for ESP8266. core.temperature
does not exist (or at least there's no public API yet) and will return None
. The common-hal
temperature function returns NAN
to signal no value is available. core.frequency
is available and I return that.
//| bytes. Otherwise, read everything that has been buffered. | ||
//| bytes. Otherwise, read everything that arrives until the connection | ||
//| times out. Providing the number of bytes expected is highly recommended | ||
//| because it will be faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase so this isn't in the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, I hope.
return (mp_obj_t)&mcu_core_obj; | ||
} | ||
|
||
//| :mod:`microcontroller.core` --- Microcontroller core information and control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be documented as a mod because properties only work on objects. Instead, document microcontroller.core
as an object of microcontroller.Core
. Please capitalize where appropriate such as the file, docs and QSTR name.
*/ | ||
|
||
#ifndef __MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER___CORE___H__ | ||
#define __MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER___CORE___H__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove __
to match new style header guards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
…gleton class. Clarify some documentation. Transpose support matrix in `shared-bindings/index.rst`. It was getting r-e-a-l-l-y w-i-d-e, especially after adding `core` and `nvm` entries.
adc2ddb
to
3a4d91b
Compare
Add
microcontroller.core.temperature
, for use as a simple sensor on minimal boards.Also added
microcontroller.core.frequency
to return CPU frequency, in int Hertz.Added
-finline-limit=_n_
toatmel-samd/Makefile
to squeeze non-Express enough to fit.This branch crossed the v1.9.2 merge, so I gave up trying to rebase.
Fixes #177.