circuitpython/ports/raspberrypi/common-hal/busio
KurtE 1fad381513 [RP2040] Allow any GPIO pin for RS485 direction pin
As I mentioned in issue #6310 while investigating that the Teensy port
did not support RS485_dir pin on normal GPIO pins, I found that it
was not implemented either as well on some other ports.

So was curious to implement it for RP2040 using same approach as I did
for the MIMXRT in the Pull Request #6328

That is I setup the specified pin as a normal GPIO pin in output mode
and then when you do a write operation it sets the GPIO pin logically
high, and when the write completes I set it logically low.

Note: knowing when I can set it low can be tricky, as you need to make
sure the full output has completed otherwise the data will be corrupted.

I am using:         uart_tx_wait_blocking(self->uart);
Which looks like it is supposed to wait until the busy status is no
longer set, which the Reference manual mentioned, but this is leaving
the line logically set longer than I would like.

however I have tried running it with my hacked up version of the
Python Robotis DynamixelSDK and was able to talk to some AX servos.

I did have to change the library slightly for the RP2040, as the
library was erroring out when you did something like uart.read(5)
and it timed out without receiving anything.  The RP2040 returned
None whereas I think the Teensy returned an empty set, which is what
it looks like the PySerial original code expects.

Not sure if anyone is interested in this, but thought i would
put it out as PR and see.
2022-04-30 14:31:08 -07:00
..
I2C.c common-hal I2C combined write_read 2022-01-31 22:03:30 -05:00
I2C.h run code formatting script 2021-03-15 19:27:36 +05:30
SPI.c Canonical C style for half_duplex = true/false 2022-02-08 23:13:22 -05:00
SPI.h run code formatting script 2021-03-15 19:27:36 +05:30
UART.c [RP2040] Allow any GPIO pin for RS485 direction pin 2022-04-30 14:31:08 -07:00
UART.h [RP2040] Allow any GPIO pin for RS485 direction pin 2022-04-30 14:31:08 -07:00
__init__.c Add initial RP2040 support 2021-01-20 19:16:56 -08:00