-
Notifications
You must be signed in to change notification settings - Fork 7
Add I2C General Call Commands #10
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
Conversation
@codenio that was quick, questions: |
@codenio I will take a look at the datasheet tonight, and try to test moving your functions to the main class, also a good practice is to have a test code, that way we could test the same things and compare results. Thanks... |
Thanks for prompt response. adding the same in contribution guidelines would help new contributors. Will make those suggested changes and update this PR |
You are right, actually it is the guide, https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/overview. We are working on putting some automatic "guidelines" in the CI built. But, thank you, your suggestion is noted. |
I guess it is in main class "MCP4728", could you check the same..?
test code you mean, example code to test it on actual hardware..? Thanks |
You are right, just to verify that the new features introduced with your Pr are working, I Do have the hardware so I could test :) |
1b10160
to
0e8af0b
Compare
The following changes were made
will modify the implementation to improve readability and get back |
0e8af0b
to
7a41d0a
Compare
All changes done. hope this could be reviewed and merged. Thanks for the prompt responses and suggestions. |
@codenio just to let you know, that I took a briefly look at the changes and test some of the new features, it works. will take some time later to give my official review. Thanks for your contribution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks just that minor comment regarding the coyright mention, also we need to include this new example in the examples.rst file, following the standard provides, this allows the autodocs to build the readthedocs documentation
I have testes this with a modified script provided, using the internal function _read_registers()
to see changes.
Modified Test Code
import board
import adafruit_mcp4728
i2c = board.I2C() # uses board.SCL and board.SDA
mcp4728 = adafruit_mcp4728.MCP4728(i2c)
print(mcp4728._read_registers())
mcp4728.channel_a.value = 65535 # Voltage = VDD
mcp4728.channel_b.value = int(65535 / 2) # VDD/2
mcp4728.channel_c.value = int(65535 / 4) # VDD/4
mcp4728.channel_d.value = 0 # 0V
mcp4728.save_settings() # save current voltages into EEPROM
print(mcp4728._read_registers())
mcp4728.channel_a.value = 0 # Modify output
mcp4728.channel_b.value = 0 # Modify output
mcp4728.channel_c.value = 0 # Modify output
mcp4728.channel_d.value = 65535 # Modify output
print(mcp4728._read_registers())
mcp4728.reset() # reset MCP4728
print(mcp4728._read_registers())
Results
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import mcp4728_generaltest
[(6, False, False, 0), (2047, False, False, 0), (1023, False, False, 0), (0, False, False, 0)]
[(4095, False, False, 0), (2047, False, False, 0), (1023, False, False, 0), (0, False, False, 0)]
[(4095, False, False, 0), (2047, False, False, 0), (1023, False, False, 0), (0, False, False, 0)]
[(6, False, False, 0), (2047, False, False, 0), (1023, False, False, 0), (0, False, False, 0)]
>>>
Changes seems good to me
7a41d0a
to
e235e1d
Compare
@codenio sorry it was not my intention to try to imply that we needed to change the example as you made it. Just to clarify to folks how I did my tests and verify the changes. Your code was perfectly fine to begin with |
realised the same just now, will revert to previous version of the example. |
No we are good, user will not need that feature, and if they needed they will use as we did :) |
e235e1d
to
76e6a70
Compare
you could correct the last one with this General Call Example
------------------------------ |
is there way to check this before pushing..? |
Yes, there is, you could run the following command |
This Commit, - Adds _general_call static methods for executing different general calls to MCP4728 - Adds reset, wakeup and soft_update general call static methods - Updates examples.rst
76e6a70
to
b1caab2
Compare
@jposada202020 , all these short debugging commands can be add into contribution guidelines =) |
@codenio :) I know, I am on it :), I open this discussion in the CircuitPython dev channel that by the way you are invited to participate, is open, for everyone is in the Adafruit discord channel under circuitpython-dev. |
Thanks to stick to the whole process, know we give folks a couple of days and then we could merge. Thanks :) |
thanks for the prompt responses and guidance 👍 |
Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO08X_RVC to 1.0.5 from 1.0.4: > Merge pull request adafruit/Adafruit_CircuitPython_BNO08x_RVC#3 from jposada202020/improxing_docs > "Increase duplicate code check threshold " Updating https://github.com/adafruit/Adafruit_CircuitPython_CAP1188 to 1.3.0 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_CAP1188#21 from jposada202020/separating_properties Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107 to 1.2.0 from 1.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SH1107#5 from lesamouraipourpre/display_offset > "Increase duplicate code check threshold " Updating https://github.com/adafruit/Adafruit_CircuitPython_EMC2101 to 1.1.8 from 1.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_EMC2101#17 from jposada202020/correcting_typo Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS to 4.2.0 from 4.1.5: > Merge pull request adafruit/Adafruit_CircuitPython_LSM6DS#41 from jposada202020/adding_temperature_property Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP4728 to 1.2.0 from 1.1.6: > Merge pull request adafruit/Adafruit_CircuitPython_MCP4728#10 from codenio/feature/general_call Updating https://github.com/adafruit/Adafruit_CircuitPython_SI4713 to 1.3.0 from 1.2.6: > Merge pull request adafruit/Adafruit_CircuitPython_SI4713#18 from sheimers/master > "Increase duplicate code check threshold "
This PR address #9 ,
Thoughts and Comments..?