File tree Expand file tree Collapse file tree
shared-bindings/microcontroller Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444//| print(microcontroller.cpu.temperature)
4545//|
4646//| Note that on chips with more than one cpu (such as the RP2040)
47- //| you will need to index the cpu to select which one to get the
48- //| readings from. i.e.
47+ //| microcontroller.cpu will return the value for CPU 0.
48+ //| To get values from other CPUs use microcontroller.cpus indexed by
49+ //| the number of the desired cpu. i.e.
4950//|
50- //| print(microcontroller.cpu [0].temperature)
51- //| print(microcontroller.cpu [1].frequency)"""
51+ //| print(microcontroller.cpus [0].temperature)
52+ //| print(microcontroller.cpus [1].frequency)"""
5253//|
5354
5455//| def __init__(self) -> None:
Original file line number Diff line number Diff line change 5353//| cpu: Processor
5454//| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency``
5555//| (clock frequency).
56- //| This object is the sole instance of `microcontroller.Processor`."""
56+ //| This object is an instance of `microcontroller.Processor`."""
57+ //|
58+
59+ //| cpus: Processor
60+ //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency``
61+ //| (clock frequency) on chips with more than 1 cpu. the index selects which cpu.
62+ //| This object is an instance of `microcontroller.Processor`."""
5763//|
5864
5965//| def delay_us(delay: int) -> None:
@@ -155,6 +161,9 @@ const mp_obj_module_t mcu_pin_module = {
155161STATIC const mp_rom_map_elem_t mcu_module_globals_table [] = {
156162 { MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR_microcontroller ) },
157163 { MP_ROM_QSTR (MP_QSTR_cpu ), MP_ROM_PTR (& common_hal_mcu_processor_obj ) },
164+ #if CIRCUITPY_PROCESSOR_COUNT > 1
165+ { MP_ROM_QSTR (MP_QSTR_cpus ), MP_ROM_PTR (& common_hal_multi_processor_obj ) },
166+ #endif
158167 { MP_ROM_QSTR (MP_QSTR_delay_us ), MP_ROM_PTR (& mcu_delay_us_obj ) },
159168 { MP_ROM_QSTR (MP_QSTR_disable_interrupts ), MP_ROM_PTR (& mcu_disable_interrupts_obj ) },
160169 { MP_ROM_QSTR (MP_QSTR_enable_interrupts ), MP_ROM_PTR (& mcu_enable_interrupts_obj ) },
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ extern const mp_obj_dict_t mcu_pin_globals;
4848#if CIRCUITPY_PROCESSOR_COUNT == 1
4949extern const mcu_processor_obj_t common_hal_mcu_processor_obj ;
5050#elif CIRCUITPY_PROCESSOR_COUNT > 1
51- extern const mp_rom_obj_tuple_t common_hal_mcu_processor_obj ;
51+ extern const mcu_processor_obj_t common_hal_mcu_processor_obj ;
52+ extern const mp_rom_obj_tuple_t common_hal_multi_processor_obj ;
5253#else
5354#error "Invalid processor count"
5455#endif
You can’t perform that action at this time.
0 commit comments