Skip to content

Commit

Permalink
Rename crate Si4703
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Oct 11, 2019
1 parent b964346 commit 361beed
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "si470x"
name = "si4703"
version = "0.1.0"
authors = ["Diego Barrios Romero <eldruin@gmail.com>"]
repository = "https://github.com/eldruin/si470x-rs"
repository = "https://github.com/eldruin/si4703-rs"
license = "MIT OR Apache-2.0"
description = "Platform-agnostic Rust driver for the Si470x FM radio turner (receiver) family."
description = "Platform-agnostic Rust driver for the Si4703 and Si4702 FM radio turners (receivers)."
readme = "README.md"
keywords = ["fm", "radio", "receiver", "turner", "embedded-hal-driver"]
categories = ["embedded", "hardware-support", "no-std"]
homepage = "https://github.com/eldruin/si470x-rs"
documentation = "https://docs.rs/si470x"
homepage = "https://github.com/eldruin/si4703-rs"
documentation = "https://docs.rs/si4703"
include = [
"/**/*.rs",
"/Cargo.toml",
Expand All @@ -20,8 +20,8 @@ include = [
]

[badges]
travis-ci = { repository = "eldruin/si470x-rs", branch = "master" }
coveralls = { repository = "eldruin/si470x-rs", branch = "master", service = "github" }
travis-ci = { repository = "eldruin/si4703-rs", branch = "master" }
coveralls = { repository = "eldruin/si4703-rs", branch = "master", service = "github" }

[dependencies]
embedded-hal = { version = "0.2.3", features = ["unproven"] }
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Rust Si470x FM Radio Turner (Receiver) Driver
# Rust Si4703 FM Radio Turner (Receiver) Driver

<!--TODO
[![crates.io](https://img.shields.io/crates/v/si470x.svg)](https://crates.io/crates/si470x)
[![Docs](https://docs.rs/si470x/badge.svg)](https://docs.rs/si470x)
[![crates.io](https://img.shields.io/crates/v/si4703.svg)](https://crates.io/crates/si4703)
[![Docs](https://docs.rs/si4703/badge.svg)](https://docs.rs/si4703)
-->
[![Build Status](https://travis-ci.org/eldruin/si470x-rs.svg?branch=master)](https://travis-ci.org/eldruin/si470x-rs)
[![Coverage Status](https://coveralls.io/repos/github/eldruin/si470x-rs/badge.svg?branch=master)](https://coveralls.io/github/eldruin/si470x-rs?branch=master)
[![Build Status](https://travis-ci.org/eldruin/si4703-rs.svg?branch=master)](https://travis-ci.org/eldruin/si4703-rs)
[![Coverage Status](https://coveralls.io/repos/github/eldruin/si4703-rs/badge.svg?branch=master)](https://coveralls.io/github/eldruin/si4703-rs?branch=master)

This is a platform agnostic Rust driver for the Si470x FM radio turner
(receiver) family using the [`embedded-hal`] traits.
This is a platform agnostic Rust driver for the Si4703 and Si4702 FM radio turners
(receivers) using the [`embedded-hal`] traits.
<!-- TODO
This driver allows you to:
-->
Expand Down Expand Up @@ -55,7 +55,7 @@ then instantiate the appropriate device.
<!--TODO
In the following example an instance of the device Si4703 will be created.
Other devices can be created with similar methods like:
`Si470x::new_si4702(...)`.
`Si4703::new_si4702(...)`.
-->
Please find additional examples using hardware in this repository: [driver-examples]

Expand All @@ -69,7 +69,7 @@ Please find additional examples using hardware in this repository: [driver-examp
## Support

For questions, issues, feature requests, and other changes, please file an
[issue in the github project](https://github.com/eldruin/si470x-rs/issues).
[issue in the github project](https://github.com/eldruin/si4703-rs/issues).

## License

Expand Down
14 changes: 7 additions & 7 deletions src/device_impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{
ic, Band, BitFlags, ChannelSpacing, DeEmphasis, Error, ErrorWithPin, Gpio1Config, Gpio2Config,
Gpio3Config, OutputMode, Register, SeekDirection, SeekMode, SeekingState, Si470x,
Gpio3Config, OutputMode, Register, SeekDirection, SeekMode, SeekingState, Si4703,
};
use core::marker::PhantomData;
use hal::blocking::delay::DelayMs;
Expand All @@ -25,42 +25,42 @@ pub fn reset<E, RSTP: OutputPin<Error = E>, SDAP: OutputPin<Error = E>, DELAY: D
Ok(())
}

impl<I2C, E> Si470x<I2C, ic::Si4702>
impl<I2C, E> Si4703<I2C, ic::Si4702>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
{
/// Create new instance of a Si4703 device
pub fn new_si4702(i2c: I2C) -> Self {
Si470x {
Si4703 {
i2c,
seeking_state: SeekingState::Idle,
_ic: PhantomData,
}
}
}

impl<I2C, E> Si470x<I2C, ic::Si4703>
impl<I2C, E> Si4703<I2C, ic::Si4703>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
{
/// Create new instance of a Si4703 device
pub fn new_si4703(i2c: I2C) -> Self {
Si470x {
Si4703 {
i2c,
seeking_state: SeekingState::Idle,
_ic: PhantomData,
}
}
}

impl<I2C, IC> Si470x<I2C, IC> {
impl<I2C, IC> Si4703<I2C, IC> {
/// Destroy driver instance, return I²C bus instance.
pub fn destroy(self) -> I2C {
self.i2c
}
}

impl<I2C, E, IC> Si470x<I2C, IC>
impl<I2C, E, IC> Si4703<I2C, IC>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
{
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This is a platform agnostic Rust driver for the Si470x FM radio
//! turner (receiver) using the [`embedded-hal`] traits.
//! This is a platform agnostic Rust driver for the Si4702 and Si4703 FM radio
//! turners (receivers) using the [`embedded-hal`] traits.
//!
//! [`embedded-hal`]: https://github.com/rust-embedded/embedded-hal
//!
Expand Down Expand Up @@ -100,9 +100,9 @@ enum SeekingState {
WaitingForStcToClear(bool),
}

/// Si470x device driver
/// Si4703 device driver
#[derive(Debug)]
pub struct Si470x<I2C, IC> {
pub struct Si4703<I2C, IC> {
i2c: I2C,
seeking_state: SeekingState,
_ic: PhantomData<IC>,
Expand Down
4 changes: 2 additions & 2 deletions src/rds.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::{marker, BitFlags, Error, RdsMode, Register, Si470x};
use super::{marker, BitFlags, Error, RdsMode, Register, Si4703};

use hal::blocking::i2c;

impl<I2C, E, IC> Si470x<I2C, IC>
impl<I2C, E, IC> Si4703<I2C, IC>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
IC: marker::WithRds,
Expand Down
4 changes: 2 additions & 2 deletions src/register_access.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{Error, Si470x};
use super::{Error, Si4703};
use hal::blocking::i2c;

const DEVICE_ADDRESS: u8 = 0x10;
Expand Down Expand Up @@ -32,7 +32,7 @@ impl BitFlags {
pub const RDSM: u16 = 1 << 11;
}

impl<I2C, E, IC> Si470x<I2C, IC>
impl<I2C, E, IC> Si4703<I2C, IC>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
{
Expand Down
8 changes: 4 additions & 4 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use hal::i2c::{Mock as I2cMock, Transaction as I2cTrans};
use si470x::{ic, Si470x};
use si4703::{ic, Si4703};

pub const DEV_ADDR: u8 = 0x10;

Expand All @@ -21,11 +21,11 @@ impl BitFlags {
}

#[allow(unused)]
pub fn new_si4703(transactions: &[I2cTrans]) -> Si470x<I2cMock, ic::Si4703> {
Si470x::new_si4703(I2cMock::new(transactions))
pub fn new_si4703(transactions: &[I2cTrans]) -> Si4703<I2cMock, ic::Si4703> {
Si4703::new_si4703(I2cMock::new(transactions))
}

pub fn destroy<IC>(dev: Si470x<I2cMock, IC>) {
pub fn destroy<IC>(dev: Si4703<I2cMock, IC>) {
dev.destroy().done();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extern crate embedded_hal_mock as hal;
extern crate si470x;
extern crate si4703;
use hal::i2c::{Mock as I2cMock, Transaction as I2cTrans};
use si470x::{
use si4703::{
Band, ChannelSpacing as Spacing, DeEmphasis, Error, Gpio1Config, Gpio2Config, Gpio3Config,
OutputMode, Si470x,
OutputMode, Si4703,
};

mod common;
Expand All @@ -16,7 +16,7 @@ const DATA: [u8; 32] = [

#[test]
fn can_create_and_destroy_si4702() {
let dev = Si470x::new_si4702(I2cMock::new(&[]));
let dev = Si4703::new_si4702(I2cMock::new(&[]));
destroy(dev);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/rds.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate embedded_hal_mock as hal;
extern crate si470x;
extern crate si4703;
use hal::i2c::Transaction as I2cTrans;
use si470x::RdsMode;
use si4703::RdsMode;

mod common;
use self::common::{destroy, new_si4703, BitFlags as BF, DEV_ADDR};
Expand Down
4 changes: 2 additions & 2 deletions tests/seek.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extern crate embedded_hal_mock as hal;
extern crate si470x;
extern crate si4703;
#[macro_use]
extern crate nb;
use hal::i2c::Transaction as I2cTrans;
use hal::pin::{Mock as PinMock, State as PinState, Transaction as PinTrans};
use si470x::{Error, ErrorWithPin, SeekDirection, SeekMode};
use si4703::{Error, ErrorWithPin, SeekDirection, SeekMode};

mod common;
use self::common::{destroy, new_si4703, BitFlags as BF, DEV_ADDR};
Expand Down

0 comments on commit 361beed

Please sign in to comment.