Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial approach to a Firmata SPI implementation #341

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soundanalogous
Copy link
Member

@soundanalogous soundanalogous commented Jan 8, 2017

This is an initial approach to Firmata SPI support. Consider this a prototype for now. The draft proposal that this implementation is based on is available here: https://github.com/firmata/protocol/blob/master/proposals/spi-proposal.md.

SPI is a difficult protocol to implement in a generic way. The idea with this prototype implementation is to get it out there and have people start testing with various SPI devices to see where it falls short.

A prototype Firmata client implementation is also being explored for firmata.js: https://github.com/firmata/firmata.js/compare/spi-alpha. You can use that to test devices or use it as an example for testing in other programming environments.

Note that both the Arduino implementation and the firmata.js are still changing, but should be stable enough to checkout and test with (just be sure to checkout both at the same time as I'm pushing updates simultaneously).


bool SPIFirmata::handlePinMode(uint8_t pin, int mode)
{
// There is no reason for a user to manually set the SPI pin modes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

pinMode(mCsPin, OUTPUT);

if (argv[10] != END_SYSEX) {
mCsActiveState = argv[10];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to ensure that argv[10] is a valid value (0 or 1)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback to default (SPI_CS_ACTIVE_LOW) if invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants