Closed AeroNotix closed 11 years ago
Geese Aaron, hold your horses mate :)
Direction needs to be an enum because it's actually Mode, one of at least in, out, pwm.
Closes #1
On 22/07/2013, at 17:38, Aaron France notifications@github.com wrote:
Hi,
I was just looking over this and I thought that possibly a boolean value would be better for direction since you can easily toggle it:
package main
import "fmt" type Direction bool
func main() { d := Direction(true) d = !d fmt.Println(d) }```
For me, string parameters like that can get annoying ("stringly typed"), though since there are only two, it's not so bad. However, you get a few syntactic niceties from using booleans.
My $0.02. — Reply to this email directly or view it on GitHub.
Dave, it's too early friend. I'm having trouble parsing what you just wrote. Can you give me the decaffeinated version?
A boolean lets you do stuff like:
// Toggle pin
Pin.SetDirection(!Pin.Direction())
It was a mistake to call this method Direction, it should be called Mode. There are least three modes that the RPi driver supports, and possibly more.
On 22/07/2013, at 17:50, Aaron France notifications@github.com wrote:
Dave, it's too early friend. I'm having trouble parsing what you just wrote. Can you give me the decaffeinated version?
— Reply to this email directly or view it on GitHub.
Oh I see! So you're going to need to add PWM and thus remove the opportunity for a binary state. Gotcha. Close.
Hi,
I was just looking over this and I thought that possibly a boolean value would be better for direction since you can easily toggle it:
For me, string parameters like that can get annoying ("stringly typed"), though since there are only two, it's not so bad. However, you get a few syntactic niceties from using booleans.
My $0.02.