Search found 53 matches

by v923z
Sat Jun 29, 2019 9:21 am
Forum: Development of MicroPython
Topic: registering python special methods in C class
Replies: 2
Views: 215

Re: registering python special methods in C class

Hi Zoltán, If you still haven't figured out what is wrong, here is a hint: special methods have to be registered in your class definition, where you have the .name , the .make_new, .print methods, and the .locals_dict . In that very structure you should also have .unary_op for things like __len__ , ...
by v923z
Wed Jun 26, 2019 6:38 pm
Forum: Development of MicroPython
Topic: registering python special methods in C class
Replies: 2
Views: 215

registering python special methods in C class

Hi all, I am trying to implement a class in C, and would like to implement the special method __add__() . I was hoping that a+b would be evaluated, if a = testObj() b = testObj() However, I get the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError:...
by v923z
Thu Jan 17, 2019 7:12 pm
Forum: Programs, Libraries and Tools
Topic: fast font rendering on graphical displays
Replies: 9
Views: 842

Re: fast font rendering on graphical displays

To throw in some comments on my solution. The Writer class for monochrome displays uses bit blitting which is done in C. Unfortunately the framebuf blit method has no means of mapping a monochrome font onto a colour framebuf. This has been discussed but was never implemented. I agree, framebuf woul...
by v923z
Wed Jan 16, 2019 7:02 am
Forum: Programs, Libraries and Tools
Topic: fast font rendering on graphical displays
Replies: 9
Views: 842

Re: fast font rendering on graphical displays

Graphics requires the most amount of RAM out of about anything you r likely to do in Micro-Python. I could use an approach on ESP32 that I couldn't use on ESP8266 because of the fact ESP32 has more RAM than ESP8266 Updating 1 pixel at a time to the screen is super super slow. Being able to create a...
by v923z
Tue Jan 15, 2019 9:18 am
Forum: Programs, Libraries and Tools
Topic: fast font rendering on graphical displays
Replies: 9
Views: 842

Re: fast font rendering on graphical displays

One thing I have clean forgotten to mention: for an extra factor of approx. 4 in render time, one can implement aliasing, without any overhead on the RAM. (The transfer times will not be affected.) I don't know, whether this is relevant/interesting or not.
by v923z
Tue Jan 15, 2019 9:08 am
Forum: Programs, Libraries and Tools
Topic: fast font rendering on graphical displays
Replies: 9
Views: 842

Re: fast font rendering on graphical displays

Hi Scott, Thanks for dropping by. Here are a couple of comments. Hi Matt and Zoltán, I'm curious about your use cases for text and in what way speed matters. Is it initial time to display a static value or rapidly changing values like a terminal while compiling? This issue is not so much about the s...
by v923z
Mon Jan 14, 2019 8:58 pm
Forum: Programs, Libraries and Tools
Topic: fast font rendering on graphical displays
Replies: 9
Views: 842

fast font rendering on graphical displays

Hi all, I would like to refer to two postings on this board, related to efficiently using graphical displays, and in particular, rendering fonts. One of them is quite old, in which @pythoncoder was circulating his idea of storing fonts in the flash https://forum.micropython.org/viewtopic.php?f=3&t=2...
by v923z
Fri Nov 30, 2018 7:18 am
Forum: Development of MicroPython
Topic: including math functions in module
Replies: 8
Views: 537

Re: including math functions in module

The general tendency is to make things STATIC unless they need to be shared. From a maintenance standpoint a function that is declared STATIC can be changed arbitrarily and you only need to look within the same source file to find all of the "users" of that function. If a function is made public, t...
by v923z
Thu Nov 29, 2018 9:30 pm
Forum: Development of MicroPython
Topic: including math functions in module
Replies: 8
Views: 537

Re: including math functions in module

Well, if you were going to expose the functions at a C level, you would probably factor them out from the existing functions, since the existing functions take mp_obj_t's rather than floats, so you'll wind up doing a bunch of conversions. For such a small function, it's quite possibly cheaper (both...
by v923z
Thu Nov 29, 2018 6:59 am
Forum: Development of MicroPython
Topic: including math functions in module
Replies: 8
Views: 537

Re: including math functions in module

On the pyboard, they're exposed to python in the math module: MicroPython v1.9.4-479-g828f771e3-dirty on 2018-09-12; PYBv1.1 with STM32F405RG Type "help()" for more information. >>> import math >>> math.radians(90) 1.570796 >>> math.degrees(1.570796) 89.99998 >>> Those functions aren't exposed to C...