firmata: addition of support for firmata protocol#20
firmata: addition of support for firmata protocol#20imle wants to merge 4 commits intoperiph:mainfrom
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
@googlebot I signed it! |
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
| "periph.io/x/conn/v3/spi" | ||
| ) | ||
|
|
||
| // I2CAddr i2c default address. |
There was a problem hiding this comment.
Can you make a separate PR for this and the file below? They are unrelated to firmata.
There was a problem hiding this comment.
Didn't mean for that to make it in, will move to another PR.
|
Apologies for the delay. Thanks I'll try to look at it ASAP. |
maruel
left a comment
There was a problem hiding this comment.
Thanks for the PR! That's a lot of functionality, that's really cool.
| @@ -0,0 +1,43 @@ | |||
| package firmata | |||
There was a problem hiding this comment.
For every files: please add copyright.
| "fmt" | ||
| ) | ||
|
|
||
| type AnalogMappingResponse struct { |
There was a problem hiding this comment.
For every public symbols: Please document or make private.
| } | ||
|
|
||
| func ParseAnalogMappingResponse(data []byte) AnalogMappingResponse { | ||
| var response = AnalogMappingResponse{ |
There was a problem hiding this comment.
For most var uses in this PR: var is unnecessary.
|
|
||
| func ParseAnalogMappingResponse(data []byte) AnalogMappingResponse { | ||
| var response = AnalogMappingResponse{ | ||
| AnalogPinToDigital: []uint8{}, |
| return response | ||
| } | ||
|
|
||
| func (a AnalogMappingResponse) String() string { |
There was a problem hiding this comment.
I recommend a pointer receiver otherwise it makes a copy.
| sysExListenerChannels map[SysExCmd]chan []byte | ||
|
|
||
| i2cListeners map[uint8]chan I2CPacket | ||
| i2cMU sync.Mutex |
There was a problem hiding this comment.
Put the mutex above what it protects, not below.
| Close() error | ||
| } | ||
|
|
||
| type Client struct { |
There was a problem hiding this comment.
Can you either export the interface or the struct but not both? I generally prefer the struct unless there's a clear reason like to make a fake/mock easier to use in practice.
| go func() { | ||
| err := c.responseWatcher() | ||
| if err != nil { | ||
| panic(err) |
There was a problem hiding this comment.
Can you make this not be a panic?
| @@ -0,0 +1,114 @@ | |||
| package firmata | |||
There was a problem hiding this comment.
name this file "conv.go", it's more meaningful than util.go.
|
|
||
| func (p *pin) WaitForEdge(timeout time.Duration) bool { | ||
| return false | ||
| return gpio.INVALID.WaitForEdge(timeout) |
|
What I would recommend is to start with only one subsystem, let's say i2c, and go from there. The PR is fairly large and will make the back and forth more difficult. |
I wanted to open this early as it is a significant change and I would really like some input before I get much deeper into this implementation. There are parts of this missing and I have not implemented some of the features yet. This is a work in progress.