From: Tilman Sauerbeck Date: Fri, 20 Dec 2019 20:09:42 +0000 (+0100) Subject: application: Set up pins for the display. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=684d0bbaff4c9fc2935eb5281c897ac40b86b73f;p=gps-watch.git application: Set up pins for the display. This configures I2C0 as well as the GPIO used to control the display's reset line. --- diff --git a/src/application/main.rs b/src/application/main.rs index bd1091f..39e0e02 100644 --- 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::i2c; use common::usb_serial; extern { @@ -47,6 +48,18 @@ pub unsafe extern fn main() { 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);