Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #121 from bharrisau/doc3
Browse files Browse the repository at this point in the history
Last set of doc comments
  • Loading branch information
farcaller committed Jul 31, 2014
2 parents e81a134 + 1b54285 commit 5ab4d8d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/drivers/chario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

//! Generic char output trait.

use core::option::{Some, None};
use core::str::{Str, StrSlice};
use core::slice::{Vector, ImmutableVector};
use core::collections::Collection;
use core::iter::{Iterator, range};
use core::iter::range;

use core::mem::zeroed;

Expand Down
6 changes: 5 additions & 1 deletion src/drivers/dht22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Driver for DHT22.

use core::iter::range;
use core::option::{Option, Some, None};
use core::iter::{Iterator, range};

use hal::pin::{GPIO, Low, High, In, Out, GPIOLevel};
use hal::timer::Timer;
Expand All @@ -25,6 +27,8 @@ pub struct DHT22<'a, T, P> {
timer: &'a T,
}

/// Measurement data from the DHT22.
#[allow(missing_doc)]
pub struct Measurements {
pub humidity: f32,
pub temperature: f32,
Expand Down
7 changes: 5 additions & 2 deletions src/drivers/lcd/c12332.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ might be an issue for any other peripheral sharing the same SPI bus.
use core::cell;
use core::slice::ImmutableVector;
use core::mem::zeroed;
use core::option::{Some, None};
use core::iter::{Iterator, range};
use core::iter::range;

use super::font_small_7;
use super::LCD;
Expand All @@ -36,6 +35,7 @@ use hal::timer::Timer;
use hal::pin::GPIO;
use hal::spi::SPI;

/// C12332 driver.
pub struct C12332<'a, S, T, P> {
spi: &'a S,
timer: &'a T,
Expand All @@ -52,6 +52,7 @@ pub struct C12332<'a, S, T, P> {
}

impl<'a, S: SPI, T: Timer, P: GPIO> C12332<'a, S, T, P> {
/// Creates a new C12332 driver instance.
pub fn new(spi: &'a S, timer: &'a T, dc: &'a P, cs: &'a P,
reset: &'a P) -> C12332<'a, S, T, P> {
let lcd = C12332 {
Expand Down Expand Up @@ -115,6 +116,7 @@ impl<'a, S: SPI, T: Timer, P: GPIO> C12332<'a, S, T, P> {
self.cs.set_high();
}

/// Sets an individual pixel.
pub fn set_pixel(&self, x: u32, y: u32, color: u16) {
if x > 127 || y > 31 {
return
Expand All @@ -130,6 +132,7 @@ impl<'a, S: SPI, T: Timer, P: GPIO> C12332<'a, S, T, P> {
}
}

/// Prints a character to the display.
pub fn character(&self, x: u32, y: u32, c: u8) {
let width: u32 = 128;
let height: u32 = 32;
Expand Down
13 changes: 13 additions & 0 deletions src/drivers/lcd/font_small_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Definition of a 9x9 font.
//!
//! Font definition consists of a 4 byte header:
//! - Length of a character definition
//! - Maximum width of a character
//! - Maximum height of a character
//! - Number of bytes per vertical line
//!
//! Each character definition consists of:
//! - Single byte describing actual width of the character
//! - Remaining bytes describe vertical lines from left to right with the
//! LSB defining the top of the line

pub static FONT: &'static [u8] = &[
19,9,9,2, // Length,horz,vert,byte/vert
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
Expand Down
9 changes: 6 additions & 3 deletions src/drivers/lcd/ili9341.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use core::option::{Some, None};
use core::iter::{Iterator, range};
//! Driver for the ILI9341 LCD.

use core::iter::range;

use super::LCD;
use drivers::chario::CharIO;
use hal::timer::Timer;
use hal::pin::GPIO;
use hal::spi::SPI;

/// ILI9341 driver.
pub struct ILI9341<'a, S, T, P> {
spi: &'a S,
timer: &'a T,
Expand All @@ -32,6 +34,7 @@ pub struct ILI9341<'a, S, T, P> {
}

impl<'a, S: SPI, T: Timer, P: GPIO> ILI9341<'a, S, T, P> {
/// Creates a new ILI9341 driver instance.
pub fn new(spi: &'a S, timer: &'a T, dc: &'a P, cs: &'a P, reset: &'a P)
-> ILI9341<'a, S, T, P> {
let lcd = ILI9341 {
Expand Down Expand Up @@ -303,7 +306,7 @@ impl<'a, S: SPI, T: Timer, P: GPIO> LCD for ILI9341<'a, S, T, P> {
}

impl<'a, S: SPI, T: Timer, P: GPIO> CharIO for ILI9341<'a, S, T, P> {
fn putc(&self, value: char) {
fn putc(&self, _: char) {
// TODO(farcaller): implement
}
}
6 changes: 2 additions & 4 deletions src/drivers/lcd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

//! Drivers for TFT LCDs.

use core::option::{Some, None};
use core::iter::{Iterator, range, range_inclusive};
use core::iter::{range, range_inclusive};

use drivers::chario::CharIO;

Expand Down Expand Up @@ -158,8 +157,7 @@ pub trait LCD : CharIO {
#[cfg(test)]
mod test {
use core::mem::zeroed;
use core::option::{Some, None};
use core::iter::{Iterator, Range, range};
use core::iter::{Range, range};
use core::cell::Cell;

use drivers::chario::CharIO;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern crate rlibc;
#[cfg(test)] #[phase(plugin,link)] extern crate std;
#[cfg(test)] extern crate native;

#[warn(missing_doc)] pub mod drivers;
pub mod drivers;
pub mod hal;
pub mod lib;
pub mod os;
Expand Down

0 comments on commit 5ab4d8d

Please sign in to comment.