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

Make use of type dispatch #7

Open
s-celles opened this issue Oct 25, 2018 · 1 comment
Open

Make use of type dispatch #7

s-celles opened this issue Oct 25, 2018 · 1 comment

Comments

@s-celles
Copy link
Contributor

Hello,

Looking at SenseHat.jl code, I noticed (for example)

humidity() = HTS221_humidity()

Maybe you should consider making use of type dispatch

abstract type AbstractSensor end
struct HTS221 <: AbstractSensor
end

humidity()    = humidity(HTS221()) 

Kind regards

PS : I didn't test code

@s-celles
Copy link
Contributor Author

s-celles commented Oct 25, 2018

led_clear could simply be named clear

function led_clear()

sense = SenseHat()
clear(sense.led)

Maybe you should also make use of setproperty! / getproperty

Array(sense.led)  # or sh.led.array ?
sense.led.array = new_array  # setproperty!
sense.led.gamma = new_gamma
gamma = sh.led.gamma

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

No branches or pull requests

1 participant