Search found 104 matches

by ttmetro
Mon Mar 04, 2019 2:54 am
Forum: General Discussion and Questions
Topic: Dynamically add method to instance
Replies: 7
Views: 4599

Re: Dynamically add method to instance

yes!

Also what I found with a web search is that this is exactly what

Code: Select all

MethodType
is for.
by ttmetro
Sun Mar 03, 2019 7:57 pm
Forum: General Discussion and Questions
Topic: Dynamically add method to instance
Replies: 7
Views: 4599

Re: Dynamically add method to instance

I don't think that binds it to the instance. Hence no reference to "self".

I used a global as a workaround. Not pretty, but works.
by ttmetro
Sun Mar 03, 2019 1:09 am
Forum: General Discussion and Questions
Topic: Dynamically add method to instance
Replies: 7
Views: 4599

Dynamically add method to instance

How do I add a function dynamically to a MicroPython object?

In standard python "MethodType" is used for this, but it seems missing from MicroPython. Is there a workaround?

Thanks,
Bernhard
by ttmetro
Sat Feb 16, 2019 10:01 pm
Forum: General Discussion and Questions
Topic: MicroPython on ParticleIO Argon ESP32
Replies: 2
Views: 2244

Re: MicroPython on ParticleIO Argon ESP32

No.
The nRF is running MicroPython itself. This is how I access the esp32 which is not directly accessible (Making debugging harder).
by ttmetro
Sat Feb 16, 2019 9:06 pm
Forum: General Discussion and Questions
Topic: MicroPython on ParticleIO Argon ESP32
Replies: 2
Views: 2244

MicroPython on ParticleIO Argon ESP32

I've flashed esp32-20180511-v1.9.4.bin to the ESP32 on the ParticleIO Argon using Adafruit's mini-ESP tool. I've successfully flashed other binaries using this tool, so I expect (?) that it flashed MicroPython correctly also. The UART connection between the nRF52840 also seems fine. E.g. I can enter...
by ttmetro
Mon Nov 26, 2018 7:26 pm
Forum: Development of MicroPython
Topic: bound method type check
Replies: 2
Views: 2702

Re: bound method type check

Works perfectly. Thanks!
by ttmetro
Sun Nov 25, 2018 8:55 pm
Forum: Development of MicroPython
Topic: bound method type check
Replies: 2
Views: 2702

bound method type check

How do I check if an object is either a function or bound method?

Application is specifying an interrupt handler (which can be one of these two things). There is a macro to test for functions, but I could not find anything equivalent for methods.
by ttmetro
Mon Nov 19, 2018 7:37 pm
Forum: General Discussion and Questions
Topic: check if object is a generator
Replies: 3
Views: 3528

Re: check if object is a generator

Thanks, works perfect!
by ttmetro
Fri Nov 16, 2018 9:57 pm
Forum: General Discussion and Questions
Topic: check if object is a generator
Replies: 3
Views: 3528

check if object is a generator

How do I check if an object is a coroutine (generator) in micropython?

Code: Select all

from inspect import iscoroutine
is not available.

This appears to work, but (???):

Code: Select all

def iscoroutine(obj):
    return str(type(obj)) == "<class 'generator'>"
by ttmetro
Mon Oct 29, 2018 5:45 pm
Forum: General Discussion and Questions
Topic: Accurate time differences
Replies: 3
Views: 3288

Re: Accurate time differences

Thank you for the responses. As suggested, there are many ways to implement this. @pythoncoder The problem is not accuracy. Cheap crystals are ~100ppm, not even 16-Bit! The issue is dynamic range. A 32-Bit counter counting ms overflows in 50 days or in just over an hour counting us. CircuitPython im...