-
Notifications
You must be signed in to change notification settings - Fork 0
Implement software I2C driver #2
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
This makes sure that function calls which need to spill registers works.
a190cb8 to
c16d2c2
Compare
dlech
left a comment
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.
What are the stats on IRAM and DRAM usage?
0x580 (1408 decimal) bytes IRAM, 0x50 (80 decimal) bytes DRAM There's plenty of room left. |
This makes it much easier to keep the projects in sync.
This prevents a data race which can corrupt the pin state.
The I2C controller code will need access to the real address, but we keep around the fake one to improve codegen for the other code.
8449841 to
475631a
Compare
|
Ninja fix -- Otherwise still ready for re-review. |
dlech
left a comment
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.
LGTM. Just one very minor suggestion.
| *TIMER2_INTCTLSTAT = TIMER_INTCTLSTAT_PRDINTSTAT12; | ||
|
|
||
| // This code runs at 20 kHz, which is 2x the I2C clock rate | ||
| handle_i2c(&SHARED->i2c[0], &i2c_states[0]); |
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.
Just curious why SHARED_HACK doesn't work here. Because of the additional array indexing? Or are we at an offset beyond what the optimized instruction can handle?
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 special lbco/sbco opcodes only work when you actually load/store through the constant table address. They can't be used to compute an effective address (no equivalent of x86 opcode LEA). The only way to get this address is to actually load it as an immediate, in which case we need the real value.
This driver implements I2C on the EV3 sensor ports for use with NXT and third-party peripherals.
This implements a FSM-based software I2C driver for the sensor ports.