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

[#90] I2C slave driver #93

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2bf17f7
Add `slave` to impl_twi_i2c macro
ToddG Oct 27, 2020
29ca8bc
broken : .write()
ToddG Oct 28, 2020
3f0488d
add 'twar' (TWI Address Register) to chips
ToddG Oct 28, 2020
5adf853
use '' in API
ToddG Oct 28, 2020
f33e261
broken: rename to in impl_twi_i2c macro
ToddG Oct 28, 2020
93e9ec8
fix rename of I2c to I2c[Master|Slave]
ToddG Oct 29, 2020
882be77
abstract private fn 'initialize_i2c_master()'
ToddG Oct 29, 2020
881f543
continue trying to abstract 'initialize_i2c_master'
ToddG Oct 29, 2020
57afe0c
DRY master i2c init
ToddG Oct 29, 2020
8439708
Add datasheet notes/comments
ToddG Oct 30, 2020
1cddf33
remove unnec datasheet comments
ToddG Nov 1, 2020
3c70061
add slave start method
ToddG Nov 1, 2020
8166ff4
add slave api stub
ToddG Nov 2, 2020
e99cdbf
wip : adding state machine
ToddG Nov 2, 2020
14c42f5
wip : adding state machine
ToddG Nov 2, 2020
ad29068
wip : add slavestatemachine::new()
ToddG Nov 2, 2020
305e207
wip : genericizing the SlaveState enum
ToddG Nov 2, 2020
981bd1b
wip : genericizing the SlaveState enum
ToddG Nov 2, 2020
f4533f3
wip : adding state transitions
ToddG Nov 2, 2020
c7d2b27
fixed enum return
ToddG Nov 3, 2020
65cf80b
wip building again
ToddG Nov 3, 2020
ad3d1e4
add transition docstrings
ToddG Nov 7, 2020
c0260b8
remove datasheet derived comments
ToddG Nov 7, 2020
c4d1e99
refactor initialize_i2c from static to member function
ToddG Nov 7, 2020
06901e0
wrap state transitions in a result
ToddG Nov 7, 2020
c922850
stub out slave state transitions
ToddG Nov 7, 2020
2d634ce
remove krufty comments
ToddG Nov 7, 2020
ee28700
correct tab alignment
ToddG Nov 7, 2020
396491b
replace register field identifiers
ToddG Nov 7, 2020
c3baa5c
impl slave initialized wait() method
ToddG Nov 7, 2020
9221e09
add ack and nack methods to addressmatched, rxready, and txready
ToddG Nov 8, 2020
eb13ee4
implement slave rx ready
ToddG Nov 8, 2020
c21106b
simplified state api to just nack/ack/{read|write}
ToddG Nov 8, 2020
c09afba
add final state transitions for tx mode
ToddG Nov 8, 2020
53dd0cb
need guidance as to how to finalize the API
ToddG Nov 8, 2020
b5dfd36
need guidance as to how to finalize the API
ToddG Nov 8, 2020
6a55029
add I2C_SLAVE_TRIGGER
ToddG Nov 15, 2020
7376e81
add i2c slave trigger 'is_set' and 'is_clear' methods
ToddG Nov 15, 2020
c66dbf4
Revert "add I2C_SLAVE_TRIGGER"
ToddG Nov 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Cargo.lock
/target
**/*.rs.bk
.idea
rusty-tags.vi
11 changes: 11 additions & 0 deletions avr-hal-generic/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,5 +570,16 @@ macro_rules! impl_twi_i2c {
}
}
}

impl<CLOCK, M> [<$I2c Slave>]<CLOCK, M>
where
CLOCK: $crate::clock::Clock,
{
pub fn start(&mut self) {
// this does not compile
// self.p.$twar.write(|w| unsafe {w.bits(self.address)});
Rahix marked this conversation as resolved.
Show resolved Hide resolved
}
}

}};
}