mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix bug in i2c library where i/o was not set low
you have to write *0* to the clear register to set the port low. always the weird gotcha on that one...
This commit is contained in:
parent
2ebe7f3c64
commit
c3bbbbd672
2 changed files with 5 additions and 1 deletions
|
|
@ -26,6 +26,8 @@ pub fn hello_world() -> usize {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
bio_code!(hello_world_code, HELLO_START, HELLO_END,
|
bio_code!(hello_world_code, HELLO_START, HELLO_END,
|
||||||
"add x1, zero, 0x10",
|
"add x1, zero, 0x10",
|
||||||
|
// "li x2, 0xFFFFFFFF", // set all pins to outputs
|
||||||
|
// "mv x24, x2",
|
||||||
"0:",
|
"0:",
|
||||||
"add x1, x1, 0x1",
|
"add x1, x1, 0x1",
|
||||||
"mv x21, x1",
|
"mv x21, x1",
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,9 @@ bio_code!(
|
||||||
// setup gpios
|
// setup gpios
|
||||||
"mv x20, x0", // sync to clock stream
|
"mv x20, x0", // sync to clock stream
|
||||||
"or x26, x4, x5", // set GPIO mask
|
"or x26, x4, x5", // set GPIO mask
|
||||||
"or x23, x4, x5", // clear SCL/SDA pins to 0 for "output low"
|
"or x12, x4, x5", // form bitmask in true sense
|
||||||
|
"xori x12, x12, -1", // invert because you need to write 0 to set outputs to low
|
||||||
|
"mv x23, x12", // clear SCL/SDA pins to 0 for "output low"
|
||||||
"or x25, x4, x5", // SCL/SDA to inputs
|
"or x25, x4, x5", // SCL/SDA to inputs
|
||||||
// setup done
|
// setup done
|
||||||
"mv x20, x0", // sync to clock stream
|
"mv x20, x0", // sync to clock stream
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue