projects
/
gps-watch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9cef125
)
application: Set up pins for the display.
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Fri, 20 Dec 2019 20:09:42 +0000
(21:09 +0100)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000
(20:38 +0100)
This configures I2C0 as well as the GPIO used to control the display's
reset line.
src/application/main.rs
patch
|
blob
|
history
diff --git
a/src/application/main.rs
b/src/application/main.rs
index bd1091f3c2bbca3632de41c8c536bd7619b34d80..39e0e022014463e956cc8add88e4d824b510af02 100644
(file)
--- a/
src/application/main.rs
+++ b/
src/application/main.rs
@@
-33,6
+33,7
@@
use common::systick;
use common::port;
use common::gpio;
use common::nvic;
use common::port;
use common::gpio;
use common::nvic;
+use common::i2c;
use common::usb_serial;
extern {
use common::usb_serial;
extern {
@@
-47,6
+48,18
@@
pub unsafe extern fn main() {
systick::init();
port::init();
systick::init();
port::init();
+ // Configure pins for I2C0.
+ port::set_af(port::PORTC, 8, 2);
+ port::set_af(port::PORTC, 9, 2);
+
+ i2c::configure(i2c::I2C0);
+
+ nvic::disable_irq(8); // I2C0
+
+ // Configure pin for the display's reset line.
+ gpio::set_direction(gpio::GPIOB, 1 << 16, gpio::Direction::Output);
+ port::set_af(port::PORTB, 16, 1);
+
// Configure upper right push button.
gpio::set_direction(gpio::GPIOA, 1 << 12, gpio::Direction::Input);
port::set_af(port::PORTA, 12, 1);
// Configure upper right push button.
gpio::set_direction(gpio::GPIOA, 1 << 12, gpio::Direction::Input);
port::set_af(port::PORTA, 12, 1);