|
Hi all,
I'm working on a board that uses Python as its primary programming language. I have a GPIO working through sysfs under Linux, and I can also access all the hardware peripherals that I want (serial, A/D, SPI, and I2C).
I'm trying to figure out a reasonable strategy for switching between peripherals and GPIO during operation (not at boot time).
I think the right approach is to initialize all the pins as GPIO inputs. When any peripheral is needed, the Python code turns on the peripheral (perhaps by calling a C function that modifies hardware registers), does whatever it needs to do, and then makes it an input again. I'm not sure how this would work for reading data, e.g. bytes from a serial port. (Will a serial port receive bytes while the pins are GPIO inputs?)
Does this seem like a good approach? Have you seen it handled differently? Better?
Thanks, Brandon
_________________ Brandon Stafford Rascal Micro
|