Closed microbit-matt-hillsdon closed 2 years ago
@microbit-carlos, would be great if you could review. Is there some better option for the original code on the linked issue?
Preview build of the editor with these stubs building now. Will be at: https://review-python-editor-next.microbit.org/mem/ https://github.com/microbit-foundation/python-editor-next/pull/724
Is there some better option for the original code on the linked issue?
Not sure I understand the question, better than what code? Accessing random memory using machine.mem32
?
Not sure I understand the question, better than what code? Accessing random memory using
machine.mem32
?
@microbit-carlos, from what I can read from the source in the screenshot it seems like it's not randomly chosen, but instead to set pin0 into high drive mode. Image is on https://github.com/microbit-foundation/python-editor-next/issues/723#issue-1225065824
Right, sorry, I didn't mean "random" in the literal sense. But I guess that does answer the question about what you were referring to when you said "original code".
That is the only way right now to configure peripherals in MicroPython to something different than what CODAL does (using Python code). So that's why they accessory library has done that.
Nevertheless, even if there was a better way to do that, this PR is still required to correctly parse the machine.mem8/16/32
instances.
Looking at this image:
There is no way to hide the mem
class definition in the API viewer?
I guess is similar to MicroBitDigitalPin
, which as classes that will appear in the API sidebar, but cannot be used in the code.
Is it worth adding a note that the class cannot be instantiated?
I guess is similar to
MicroBitDigitalPin
, which as classes that will appear in the API sidebar, but cannot be used in the code. Is it worth adding a note that the class cannot be instantiated?
I nearly did that, I expected to find text I could reuse on Button
or MicroBitDigitalPin
but we haven't done it there. I also felt that "instantiated" is a bit jargon-y. I'll raise a separate issue.
I nearly did that, I expected to find text I could reuse on
Button
orMicroBitDigitalPin
but we haven't done it there. I also felt that "instantiated" is a bit jargon-y. I'll raise a separate issue.
Raised https://github.com/microbit-foundation/micropython-microbit-stubs/issues/37
https://github.com/microbit-foundation/python-editor-next/issues/723