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

Jeramie's untested i2c implementation #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jvens
Copy link

@jvens jvens commented Apr 21, 2016

This is my I2C implementation. I don't have a good way to compile for the MSP430 so you may find some syntax errors and the logic is untested, but it should work. Let me know if you have questions. One thing I just noticed that you will have to fix: remove const from everything except data in struct i2c_packet because that was C++ syntax and won't work on C.

@NoahBirdman
Copy link

Jeramie,

Thank you for the time you spent on this code. I totally understand that I
don't know the best way to do things.
Yes this was spaghetti code and yes it was convoluted. The code was working
but I wasn't sure how to handle nack exceptions.

I was hoping you would offer advice/suggestions not your code. I can
usually figure it out if I have a direction.
I am not going to pull in your code because I want to right my own
firmware. I am really proud of this project and want to say that I
accomplished it.

I do agree with the state machine that does make the most sense and cleans
up the code so much. I will definitely work on implementing this over the
weekend. If I have time I will work through changing over to using the push
pop method. I don't see anything clearly wrong with having a static buffer
other than using up a lot of memory on the chip. That was just the method
that made the most sense to me and didn't require a lot of malloc and free
calls and was something I could get running quickly.

Noah

On Wed, Apr 20, 2016 at 11:52 PM, Jeramie Vens [email protected]
wrote:

This is my I2C implementation. I don't have a good way to compile for the
MSP430 so you may find some syntax errors and the logic is untested, but it
should work. Let me know if you have questions. One thing I just noticed
that you will have to fix: remove const from everything except data in struct

i2c_packet because that was C++ syntax and won't work on C.

You can view, comment on, or merge this pull request online at:

#1
Commit Summary

  • Jeramie's untested i2c implementation

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#1

Noah Bergman
Senior in Electrical Engineering
Iowa State University

IEEE | Vice President
Engineers for a Sustainable World | Vice - President

School Email: [email protected]
Personal Email: [email protected]
Website: noahbergman.com
Phone: 651-247-7668

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

Successfully merging this pull request may close these issues.

2 participants