Search found 2586 matches

by Roberthh
Thu Apr 22, 2021 7:39 pm
Forum: Programs, Libraries and Tools
Topic: More convenient pin initialization for ESP8266
Replies: 5
Views: 156

Re: More convenient pin initialization for ESP8266

That's fine. I made two minor changes to it: a) Simplify the function mp_pin_make_new() b) Change pyb_pin_print() such that it shows both the pin name and the GPIO number. // constructor(id, ...) mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { ...
by Roberthh
Thu Apr 22, 2021 6:05 pm
Forum: Raspberry Pi microcontroller boards
Topic: working with multiple serial devices
Replies: 2
Views: 84

Re: working with multiple serial devices

You can and should use the PIO for implementing additional uarts. The example code is available.
by Roberthh
Thu Apr 22, 2021 1:07 pm
Forum: Raspberry Pi microcontroller boards
Topic: UART not working with today's version of micropython
Replies: 39
Views: 903

Re: UART not working with today's version of micropython

Yes and no. It uses IRQ for handling the input and output buffers. But you cannot set a handler to get called when data arrives. P.S.: There is still a hiccup in RP2040 using two threads. The UART code has to be in thread0 only. And besides that, the RP2040 stalls (not related to UART) if the thread...
by Roberthh
Thu Apr 22, 2021 1:00 pm
Forum: Raspberry Pi microcontroller boards
Topic: Raspberry Pico Statemachine Restart
Replies: 3
Views: 87

Re: Raspberry Pico Statemachine Restart

The intention is to restart the state machine again from the initial address in it#s initial state. That is useful for state machines that stuck in a certain state, e.g. because the input data was incomplete. Then, timeout checking can be done outside the state machine. A good example is the simplif...
by Roberthh
Thu Apr 22, 2021 12:57 pm
Forum: Raspberry Pi microcontroller boards
Topic: UART not working with today's version of micropython
Replies: 39
Views: 903

Re: UART not working with today's version of micropython

The behavior of the UARt has changed from blocking to non-blocking. Now it is consistent to all other ports. If you call uart.read() and there is not data present, it will return immediately with the Value None. You can set a timeout value in the instantiation of the UART. Or you can check before ca...
by Roberthh
Thu Apr 22, 2021 9:20 am
Forum: MicroPython pyboard
Topic: Most efficient searching within large bytearrays
Replies: 8
Views: 1491

Re: Most efficient searching within large bytearrays

print (bytes(buf).find(b'OK')) #test if buf contains a substring 'OK'

Note: bytes(buf) creates a copy of buf.
by Roberthh
Wed Apr 21, 2021 7:54 pm
Forum: Programs, Libraries and Tools
Topic: More convenient pin initialization for ESP8266
Replies: 5
Views: 156

Re: More convenient pin initialization for ESP8266

It can be done by modifying machine_pin.c. At line 312 the pin number is taken from the argument. That has to extended to compare against a string of known Pin names.I made a trial build by: a) extending the _pin_obj_t structure in modmachine.h to: typedef struct _pyb_pin_obj_t { mp_obj_base_t base;...
by Roberthh
Wed Apr 21, 2021 4:03 pm
Forum: Raspberry Pi microcontroller boards
Topic: [SOLVED] #include "tusb.h" not working
Replies: 8
Views: 177

Re: #include "tusb.h" not working

I simply call make in the ports/rp2 directory. By default there is a Makefile as wrapper to cmake.

Edit: I do not add any include "tusb.h". No need to fo so.
by Roberthh
Wed Apr 21, 2021 3:17 pm
Forum: Raspberry Pi microcontroller boards
Topic: [SOLVED] #include "tusb.h" not working
Replies: 8
Views: 177

Re: #include "tusb.h" not working

I can build that without any changes to scripts. So maybe you start over with: make clean and make I had that problem too initially, but that went away after Feb 12 with the. I cannot find the discussion I had about that any more. maybe related: https://github.com/micropython/micropython/pull/6791 h...
by Roberthh
Wed Apr 21, 2021 2:14 pm
Forum: Raspberry Pi microcontroller boards
Topic: [SOLVED] #include "tusb.h" not working
Replies: 8
Views: 177

Re: #include "tusb.h" not working

AFAIK, I had to deinit these submodules first and then update them again.