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

added support for EP0099 #5

Merged
merged 7 commits into from
Feb 11, 2021
Merged

added support for EP0099 #5

merged 7 commits into from
Feb 11, 2021

Conversation

cadusk
Copy link
Contributor

@cadusk cadusk commented Feb 8, 2021

EP0099 is a stackable 4-channel relay hat that communicates with
platforms via i2c interface.

Manufacturer: 52pi
Wiki page: https://wiki.52pi.com/index.php/DockerPi_4_Channel_Relay_SKU:_EP-0099

EP0099 is a stackable 4-channel relay hat that communicates with
platforms via i2c interface.

Manufacturer: 52pi
Wiki page: https://wiki.52pi.com/index.php/DockerPi_4_Channel_Relay_SKU:_EP-0099
@googlebot
Copy link

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 @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

ep0099/doc.go Outdated Show resolved Hide resolved
ep0099/doc.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Show resolved Hide resolved
ep0099/doc.go Outdated Show resolved Hide resolved
ep0099/doc.go Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Feb 9, 2021

Codecov Report

Merging #5 (ccc1c29) into main (296894b) will increase coverage by 0.1%.
The diff coverage is 82.9%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main      #5     +/-   ##
=======================================
+ Coverage   63.2%   63.3%   +0.1%     
=======================================
  Files         46      47      +1     
  Lines       4034    4069     +35     
=======================================
+ Hits        2549    2574     +25     
- Misses      1357    1364      +7     
- Partials     128     131      +3     
Impacted Files Coverage Δ
ep0099/ep0099.go 82.9% <82.9%> (ø)
lepton/lepton.go 85.7% <0.0%> (-1.4%) ⬇️
as7262/as7262.go 98.0% <0.0%> (-1.0%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 296894b...ccc1c29. Read the comment docs.

ep0099/ep0099.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Outdated Show resolved Hide resolved
Copy link
Member

@maruel maruel left a comment

Choose a reason for hiding this comment

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

I'm fine with committing as is or with optional changes, as you prefer.

ep0099/ep0099.go Outdated
@@ -32,7 +32,7 @@ func New(bus i2c.Bus, address uint16) (*Dev, error) {

d := &Dev{
i2c: i2c.Dev{Bus: bus, Addr: address},
state: buildChannelsList(),
state: [4]State{StateOff, StateOff, StateOff, StateOff},
Copy link
Member

Choose a reason for hiding this comment

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

It's the default so you can skip the whole line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this makes sense. will remove it.

ep0099/ep0099.go Outdated Show resolved Hide resolved
ep0099/ep0099.go Show resolved Hide resolved
@cadusk
Copy link
Contributor Author

cadusk commented Feb 11, 2021

I like this approach, I just don't see how to figure out which channel we're referring to in method Out since we're passing the index to the array, not to dev.

type (r *Relay) Out(l gpio.Level) error {
	_, err := d.i2c.Write([]byte{channel, byte(StateOn)})
	r.state = StateOn
	return err
}

I've been learning a lot with this PR, maybe there's a way to figure out what channel would be without looping through Relays and comparing d to items in the array.

Maybe this solution needs some more thinking.
I am happy with the results so far and am ok with merging it like this.

@maruel
Copy link
Member

maruel commented Feb 11, 2021

One last point: do you mind following the instruction at #5 (comment)?

@maruel
Copy link
Member

maruel commented Feb 11, 2021

gohci

@maruel maruel merged commit ff2252c into periph:main Feb 11, 2021
@maruel
Copy link
Member

maruel commented Feb 11, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants