Browse Source

Remove duplicated examples

pull/4/head v0.2.0
Diego Barrios Romero 4 years ago
parent
commit
0451dbb239
  1. 18
      examples/linux_alarm1.rs
  2. 23
      examples/linux_alarm2.rs

18
examples/linux_alarm1.rs

@ -1,18 +0,0 @@
//! Set the Alarm1 to each week on a week day at a specific time
extern crate linux_embedded_hal as hal;
extern crate ds323x;
use ds323x::{ Ds323x, Hours, WeekdayAlarm1, Alarm1Matching };
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let mut rtc = Ds323x::new_ds3232(dev);
let alarm1 = WeekdayAlarm1 {
weekday: 1,
hour: Hours::H24(7),
minute: 2,
second: 15
};
rtc.set_alarm1_weekday(alarm1, Alarm1Matching::AllMatch).unwrap();
let _dev = rtc.destroy_ds3232();
}

23
examples/linux_alarm2.rs

@ -1,23 +0,0 @@
//! Set the Alarm2 to each day at the same time and enable interrupts on output.
//!
//! The INT/SQW output pin will be set to 1 when it the alarm matches.
extern crate linux_embedded_hal as hal;
extern crate ds323x;
use ds323x::{ Ds323x, Hours, DayAlarm2, Alarm2Matching };
fn main() {
let dev = hal::Spidev::open("/dev/spidev0.0").unwrap();
let chip_select = hal::Pin::new(24);
let mut rtc = Ds323x::new_ds3234(dev, chip_select);
let alarm2 = DayAlarm2 {
day: 1, // does not matter given the chosen matching
hour: Hours::AM(11),
minute: 2
};
rtc.set_alarm2_day(alarm2, Alarm2Matching::HoursAndMinutesMatch).unwrap();
rtc.use_int_sqw_output_as_interrupt().unwrap();
rtc.enable_alarm2_interrupts().unwrap();
let (_dev, _chip_select_pin) = rtc.destroy_ds3234();
}
Loading…
Cancel
Save