Skip to content

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Aug 29, 2017

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_ to atmel-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.

@dhalbert dhalbert requested a review from tannewt August 29, 2017 19:39
@dhalbert dhalbert self-assigned this Aug 29, 2017
@@ -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) },
Copy link
Member

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.

Copy link
Collaborator Author

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.
Copy link
Member

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.

Copy link
Collaborator Author

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
Copy link
Member

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__
Copy link
Member

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.

Copy link
Collaborator Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants