tino / pyFirmata

Python interface for the Firmata (http://firmata.org/) protocol. It is compliant with Firmata 2.1. Any help with updating to 2.2 is welcome. The Capability Query is implemented, but the Pin State Query feature not yet.
MIT License
578 stars 191 forks source link

Capabilities query parsing #51

Open setnicka opened 7 years ago

setnicka commented 7 years ago

In util.py in function pin_list_to_board_dict there are some assumptions which may not be always true:

For example I have some board, which returns this byte array of capabilities for some pin: [0, 1, 11, 1, 1, 1, 4, 14] I think we need to save capabilities for the pins in more general way.

@tino have you any idea how do you want to implement these features? I am ready to implement them and send a pull request (and other pull request to add pin state queries).

setnicka commented 7 years ago

Hmm I think this would need bigger rewrite - there is problem that the same pin is capable of analog input and digital output, but there is two instances of pin in that case (one in analog list and one in digital list).

I will prepare some patch and send a pull request, but this will lead to some changes in API to correct this bug. Boards definitions should contain real pin numbers for analog inputs (or some mapping of them), or auto configuration should be used.

setnicka commented 7 years ago

Prepared for merge in #52. After this will be merged I am ready to sent more pull requests with new features based on this rewrite :-)