Extract LOTS of stuff into an audio API.

Prevent all manner of type and implementation leakage.
This commit is contained in:
Jared Boone 2016-02-05 16:25:43 -08:00
parent 1b793da17f
commit 0294165481
8 changed files with 208 additions and 96 deletions

View file

@ -50,8 +50,6 @@ I2C i2c0(&I2CD0);
SPI ssp0(&SPID1);
SPI ssp1(&SPID2);
wolfson::wm8731::WM8731 audio_codec { i2c0, portapack::wm8731_i2c_address };
si5351::Si5351 clock_generator {
i2c0, hackrf::one::si5351_i2c_address
};
@ -129,17 +127,8 @@ void init() {
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
clock_manager.run_at_full_speed();
clock_manager.start_audio_pll();
audio_codec.init();
i2s::i2s0::configure(
audio::i2s0_config_tx,
audio::i2s0_config_rx,
audio::i2s0_config_dma
);
i2s::i2s0::tx_start();
i2s::i2s0::rx_start();
audio::init();
clock_manager.enable_first_if_clock();
clock_manager.enable_second_if_clock();
clock_manager.enable_codec_clocks();
@ -152,7 +141,7 @@ void shutdown() {
display.shutdown();
radio::disable();
audio_codec.reset();
audio::shutdown();
clock_manager.shutdown();
power.shutdown();