{"id":16064700,"url":"https://github.com/eldruin/si4703-rs","last_synced_at":"2025-07-09T01:42:34.495Z","repository":{"id":57667296,"uuid":"215247512","full_name":"eldruin/si4703-rs","owner":"eldruin","description":"Platform-agnostic Rust driver for the Si4703 and Si4702 FM radio turners (receivers).","archived":false,"fork":false,"pushed_at":"2021-06-27T10:05:30.000Z","size":131,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-16T05:28:49.201Z","etag":null,"topics":["driver","embedded","embedded-hal-driver","fm","i2c","radio","receiver","rust","turner"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldruin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-15T08:31:29.000Z","updated_at":"2023-08-10T08:46:23.000Z","dependencies_parsed_at":"2022-09-03T10:10:32.409Z","dependency_job_id":null,"html_url":"https://github.com/eldruin/si4703-rs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fsi4703-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fsi4703-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fsi4703-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fsi4703-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldruin","download_url":"https://codeload.github.com/eldruin/si4703-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902849,"owners_count":20366366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["driver","embedded","embedded-hal-driver","fm","i2c","radio","receiver","rust","turner"],"created_at":"2024-10-09T05:09:11.453Z","updated_at":"2025-03-18T05:30:48.471Z","avatar_url":"https://github.com/eldruin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Si4703 FM Radio Turner (Receiver) Driver\n\n[![crates.io](https://img.shields.io/crates/v/si4703.svg)](https://crates.io/crates/si4703)\n[![Docs](https://docs.rs/si4703/badge.svg)](https://docs.rs/si4703)\n[![Build Status](https://github.com/eldruin/si4703-rs/workflows/Build/badge.svg)](https://github.com/eldruin/si4703-rs/actions?query=workflow%3ABuild)\n[![Coverage Status](https://coveralls.io/repos/github/eldruin/si4703-rs/badge.svg?branch=master)](https://coveralls.io/github/eldruin/si4703-rs?branch=master)\n\nThis is a platform agnostic Rust driver for the Si4703 and Si4702 FM radio turners\n(receivers) using the [`embedded-hal`] traits and I2C.\n\nThis driver allows you to:\n- Enable/disable the device. See: `enable()`.\n- Mute/unmute. See: `mute()`.\n- Configure seek. See: `configure_seek()`.\n- Seek with/without STC interrupts. See: `seek_with_stc_int_pin()`.\n- Tune a frequency with/without STC interrupts. See: `tune_with_stc_int_pin()`.\n- Set volume. See: `set_volume()`.\n- Set band. See: `set_band()`.\n- Set channel spacing. See: `set_channel_spacing()`.\n- Set the GPIO1, GPIO2 and GPIO3 function/status. See: `set_gpio1()`.\n- Enable/disable softmute. See: `enable_softmute()`.\n- Enable/disable auto gain control. See: `enable_auto_gain_control()`.\n- Enable/disable oscillator. See: `enable_oscillator()`.\n- Enable/disable STC interrupts. See: `enable_stc_interrupts()`.\n- Enable/disable audio High-Z. See: `enable_audio_high_z()`.\n- Set de-emphasis. See: `set_deemphasis()`.\n- Set stereo to mono blend level. See: `set_stereo_to_mono_blend_level()`.\n- Set stereo/mono output mode. See: `set_output_mode()`.\n- Read output mode. See: `output_mode()`.\n- Read channel. See: `channel()`.\n- Read device ID. See: `device_id()`.\n- Read chip ID. See: `chip_id()`.\n- Reset and select I2C communication using several methods. See: `reset_and_select_i2c_method1()`.\n- RDS/RBDS (only on Si4703):\n    - Enable/disable RDS. See: `enable_rds()`.\n    - Enable/disable RDS interrupts. See: `enable_rds_interrupts()`.\n    - Read whether a new RDS group is ready. See: `rds_ready()`.\n    - Read whether RDS is synchronized. See: `rds_synchronized()`.\n    - Read RDS data. See: `rds_data()`.\n    - Decode RDS radio text from RDS data. See: `get_rds_radio_text()`.\n    - Fill char array with decoded RDS radio text from RDS data. See: `fill_with_rds_radio_text()`.\n\n[Introductory blog post](https://blog.eldruin.com/si4703-fm-radio-receiver-driver-in-rust/)\n\n## The devices\n\nThe Si4702/03-C19 extends Silicon Laboratories Si4700/Si4701 FM tuner\nfamily, and further increases the ease and attractiveness of adding FM\nradio reception to mobile devices through small size and board area,\nminimum component count, flexible programmability, and superior, proven\nperformance.\n\nThe device offers significant programmability, and caters to the\nsubjective nature of FM listeners and variable FM broadcast environments\nworld-wide through a simplified programming interface and\nmature functionality.\n\nThe Si4703-C incorporates a digital processor for the European Radio Data\nSystem (RDS) and the US Radio Broadcast Data System (RBDS) including all\nrequired symbol decoding, block synchronization, error detection, and\nerror correction functions.\n\nRDS enables data such as station identification and song name to be\ndisplayed to the user. The Si4703-C offers a detailed RDS view and a\nstandard view, allowing adopters to selectively choose granularity of RDS\nstatus, data, and block errors.\n\nDatasheets:\n- [Si4702/Si4703](https://www.silabs.com/documents/public/data-sheets/Si4702-03-C19.pdf)\n\nFurther documentation:\n- [Si4700/01/02/03 Programmer's Guide](https://www.silabs.com/documents/public/application-notes/AN230.pdf)\n- [Using RDS/RBDS with the Si4701/03](https://www.silabs.com/documents/public/application-notes/AN243.pdf)\n- [Si47xx Programming Guide](https://www.silabs.com/documents/public/application-notes/AN332.pdf)\n\n## Usage\n\nTo use this driver, import this crate and an `embedded_hal` implementation,\nthen instantiate the appropriate device.\n\nIn the following example an instance of the device Si4703 will be created.\nAn instance of the Si4702 device can be created with the method:\n`Si4703::new_si4702(...)`.\n\nPlease find additional examples using hardware in this repository: [driver-examples]\n\n[driver-examples]: https://github.com/eldruin/driver-examples\n\n```rust\nuse embedded_hal::blocking::delay::DelayMs;\nuse linux_embedded_hal::{Delay, I2cdev, Pin};\nuse nb::block;\nuse si4703::{\n    reset_and_select_i2c_method1, ChannelSpacing, DeEmphasis, SeekDirection, SeekMode, Si4703,\n    Volume,\n};\n\nfn main() {\n    let mut delay = Delay {};\n    {\n        // Reset and communication protocol selection must be done beforehand\n        let mut sda = Pin::new(2);\n        let mut rst = Pin::new(17);\n        reset_and_select_i2c_method1(\u0026mut rst, \u0026mut sda, \u0026mut delay).unwrap();\n    }\n    let dev = I2cdev::new(\"/dev/i2c-1\").unwrap();\n    let mut radio = Si4703::new(dev);\n    radio.enable_oscillator().unwrap();\n    // Wait for the oscillator to stabilize\n    delay.delay_ms(500_u16);\n    radio.enable().unwrap();\n    // Wait for powerup\n    delay.delay_ms(110_u16);\n\n    radio.set_volume(Volume::Dbfsm28).unwrap();\n    radio.set_deemphasis(DeEmphasis::Us50).unwrap();\n    radio.set_channel_spacing(ChannelSpacing::Khz100).unwrap();\n    radio.unmute().unwrap();\n\n    let stc_int = Pin::new(27);\n    // Seek using STC interrupt pin\n    block!(radio.seek_with_stc_int_pin(SeekMode::Wrap, SeekDirection::Up, \u0026stc_int)).unwrap();\n    let channel = radio.channel().unwrap_or(-1.0);\n    println!(\"Found channel at {:1} MHz\", channel);\n}\n```\n\n## Support\n\nFor questions, issues, feature requests, and other changes, please file an\n[issue in the github project](https://github.com/eldruin/si4703-rs/issues).\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contributing\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\n[`embedded-hal`]: https://github.com/rust-embedded/embedded-hal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldruin%2Fsi4703-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldruin%2Fsi4703-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldruin%2Fsi4703-rs/lists"}