-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add SCL and SDA defs for I2C[0-2]; redefine I2C_[SCL,SDA] to I2C2 #4102
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,11 +106,17 @@ typedef enum { | |
A4 = P1_30, | ||
A5 = P1_31, | ||
|
||
I2C_SCL = D15, | ||
I2C_SDA = D14, | ||
|
||
// Not connected | ||
NC = (int)0xFFFFFFFF | ||
NC = (int)0xFFFFFFFF, | ||
|
||
I2C_SCL0 = NC, | ||
I2C_SDA0 = NC, | ||
I2C_SCL1 = p10, | ||
I2C_SDA1 = p9, | ||
I2C_SCL2 = p27, // pin used by application board | ||
I2C_SDA2 = p28, // pin used by application board | ||
I2C_SCL = I2C_SCL2, | ||
I2C_SDA = I2C_SDA2, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} PinName; | ||
|
||
typedef enum { | ||
|
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.
Actually, this should probably be declared at the end of the enum. If someone came along and added a new pin, the enum may overflow (since enums increment from the last value). I'm not entirely sure what happens at that point.
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.
Actually I just looked it up, the enum will just upgrade to uint64_t. It's up to you if you want it at the end.
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.
Moving the NC to the bottom and removing the
,
would result in a smaller diff.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.
The thing I was attempting to do here was use NC to indicate I2C0 was not connected on the LPC1768 and allow any error-checking code to kick in. In order to do that, NC needs to be ahead of these lines:
I2C_SCL0 = NC,
I2C_SDA0 = NC,
Alternatively, I could just omit these lines and leave NC at the bottom of the file.
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.
BTW - at this point in this particular file, it seems as though all auto-increment for the enum is pretty much done with and we're in a section where the rest of the enum items are forced to have a specific value.