Skip to content

Commit 9bca9e3

Browse files
committed
feat: new functions
1 parent d8abdac commit 9bca9e3

File tree

2 files changed

+286
-139
lines changed

2 files changed

+286
-139
lines changed

src/main.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,32 @@ fn main() -> Result<()> {
193193
//let mut mp3_decoder = VS1053::new(spi_driver, /*xrst_pin,*/ xcs_pin, xdcs_pin, dreq_pin);
194194

195195
let mut mp3_decoder = VS1053::new(spi_device, low_spi_device, xcs_pin, xdcs_pin, dreq_pin);
196+
log::info!(
197+
"VS1053 connected:{:?}, chip version:{:?} volume:{:?}",
198+
mp3_decoder.is_chip_connected(),
199+
mp3_decoder.get_chip_version(),
200+
mp3_decoder.get_volume()
201+
);
202+
196203
// player.begin();
197204
// if (player.getChipVersion() == 4) { // Only perform an update if we really are using a VS1053, not. eg. VS1003
198205
// player.loadDefaultVs1053Patches();
199206
// }
200207
// player.switchToMp3Mode();
201208
// player.setVolume(VOLUME);
202209

210+
let res = mp3_decoder.begin();
211+
log::info!("VS1053.begin():{:#?}", res);
212+
mp3_decoder.switch_to_mp3_mode();
213+
mp3_decoder.set_volume(last_configuration.last_volume);
214+
mp3_decoder.set_balance(0);
215+
log::info!(
216+
"VS1053 MP3 decoder connected:{:?}, chip version:{:?} volume:{:?}",
217+
mp3_decoder.is_chip_connected(),
218+
mp3_decoder.get_chip_version(),
219+
mp3_decoder.get_volume()
220+
);
221+
203222
let _wifi = wifi(
204223
app_config.wifi_ssid,
205224
app_config.wifi_psk,
@@ -211,18 +230,15 @@ fn main() -> Result<()> {
211230
let _default_station_url =
212231
// Station::get_fm_frequency_from_id("france_info").unwrap_or(105.5);
213232
Station::get_web_url_from_id(last_configuration.last_station).unwrap_or("http://europe2.lmn.fm/europe2.mp3");
214-
let res = mp3_decoder.begin();
215-
info!("VS1053.begin():{:#?}", res);
216-
// mp3_decoder.setVolume(last_configuration.last_volume);
233+
234+
// mp3_decoder.play_chunk(data, len);
235+
217236
// mp3_decoder.connecttohost("streambbr.ir-media-tec.com/berlin/mp3-128/vtuner_web_mp3/");
218237
// let mut radio = Si4703::new(i2c);
219238
// radio.enable_oscillator().map_err(|e| format!("Enable oscillator error: {:?}", e));
220239
// sleep(Duration::from_millis(500));
221240
// radio.enable().map_err(|e| format!("Enable error: {:?}", e));
222241
// sleep(Duration::from_millis(110));
223-
224-
// ntp::Ntp::new();
225-
226242
// radio.set_volume(Volume::Dbfsm28).map_err(|e| format!("Volume error: {:?}", e));
227243
// radio.set_deemphasis(DeEmphasis::Us50).map_err(|e| format!("Deemphasis error: {:?}", e));
228244
// radio.set_channel_spacing(ChannelSpacing::Khz100).map_err(|e| format!("Channel spacing error: {:?}", e));

0 commit comments

Comments
 (0)