First publishment of Shimabara Audio Codec Controller library. Including code for ADAU1361 and UMB-ADAU1361A. Working pretty fine. Checked with LPCXpresso 4337 and Unzen_lpc4337

Dependents:   unzen_sample_LPC4088_quickstart unzen_sample_lpcxpresso_4337_callbacks unzen_sample_nucleo_f746 unzen_delay_sample_nucleo_f746 ... more

shimabaraは、mbedからオーディオ・コーデックのハードウェアを操作するクラス・ライブラリです。このライブラリは雲仙オーディオ・フレームワークと共に使うことを想定して開発しましたが、独立して使うことも可能です。

使い方

shimabaraは BaseAudioCodec, ADAU1361, UMB_ADAU1361Aの三つのクラスを定義しています。いずれのクラスも名前空間simabaraに属しています。実際のアプリケーションで使用するのはshimabara::UMB_ADAU1361Aだけで、このクラスはアクアシグナルのUMB-ADAU1361-Aに対応しています。ヘッダーファイルは umb_adau1361a.hです。

shimabara::UMB_ADAU1361Aのコンストラクタは三つの引数を受け取ります。

  • Fs はサンプル周波数です。これはenum Fs_type型の引数で、やはり名前空間shimabaraに属しています。
  • controller はADAU1361Aが接続されているI2Cポートに対応するI2Cオブジェクトを与えます。shimabaraはこのポートを通してCODECと通信します。
  • Addrには、コーデックのI2Cアドレスを与えます。現時点ではこの引数は0x38固定です。

コンストラクタでオブジェクトを初期化したら、start()メソッドを呼んでください。これでshimabaraはコーデックと通信し、I2Sモードでの動作が始まります。

参考リンク

Committer:
shorie
Date:
Sun May 08 09:52:42 2016 +0000
Revision:
1:ea6d442bd68a
Child:
2:fba0b8afebf0
Refactored naming conventions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shorie 1:ea6d442bd68a 1 /**
shorie 1:ea6d442bd68a 2 * \brief header file for the unzen audio frame work
shorie 1:ea6d442bd68a 3 * \arthur SeiichiHorie
shorie 1:ea6d442bd68a 4 * \date 8/May/2016
shorie 1:ea6d442bd68a 5 */
shorie 1:ea6d442bd68a 6
shorie 1:ea6d442bd68a 7 #ifndef _UMB_ADAU1361A_H_
shorie 1:ea6d442bd68a 8 #define _UMB_ADAU1361A_H_
shorie 1:ea6d442bd68a 9
shorie 1:ea6d442bd68a 10 #include "adau1361.h"
shorie 1:ea6d442bd68a 11 #include "mbed.h"
shorie 1:ea6d442bd68a 12 /**
shorie 1:ea6d442bd68a 13 \brief audio framework name space.
shorie 1:ea6d442bd68a 14 */
shorie 1:ea6d442bd68a 15 namespace audiocodec
shorie 1:ea6d442bd68a 16 {
shorie 1:ea6d442bd68a 17
shorie 1:ea6d442bd68a 18
shorie 1:ea6d442bd68a 19 /**
shorie 1:ea6d442bd68a 20 * \brief UMB-ADAU1361-A audio codec board controller.
shorie 1:ea6d442bd68a 21 * \details
shorie 1:ea6d442bd68a 22 * This class send a set of command to control an UMB-ADAU1361-A codec board.
shorie 1:ea6d442bd68a 23 *
shorie 1:ea6d442bd68a 24 * The hardware desription is here. http://dsps.shop-pro.jp/?pid=82798273
shorie 1:ea6d442bd68a 25 */
shorie 1:ea6d442bd68a 26 class UMB_ADAU1361A:public Adau1361
shorie 1:ea6d442bd68a 27 {
shorie 1:ea6d442bd68a 28 public:
shorie 1:ea6d442bd68a 29 /**
shorie 1:ea6d442bd68a 30 * \brief constructor.
shorie 1:ea6d442bd68a 31 * \param controler Pass the I2C controler object.
shorie 1:ea6d442bd68a 32 * \param Fs Sampling frequency.
shorie 1:ea6d442bd68a 33 * \param Addr I2C device address. value range is from 0 to 127
shorie 1:ea6d442bd68a 34 * \details
shorie 1:ea6d442bd68a 35 * initialize the internal variables.
shorie 1:ea6d442bd68a 36 */
shorie 1:ea6d442bd68a 37 UMB_ADAU1361A( I2C * controler, Fs_Type Fs = audiocodec::Fs_48, unsigned int Addr=0x38 ):
shorie 1:ea6d442bd68a 38 Adau1361( controler, Fs, Addr ){};
shorie 1:ea6d442bd68a 39 protected:
shorie 1:ea6d442bd68a 40 /**
shorie 1:ea6d442bd68a 41 * \brief configuration of the PLL for the desired Fs.
shorie 1:ea6d442bd68a 42 * \details
shorie 1:ea6d442bd68a 43 * Configure the PLL based on the given Fs and hardware clock configuration.
shorie 1:ea6d442bd68a 44 * Fs is stored in fs member variable already. Hadrware clock have to be given
shorie 1:ea6d442bd68a 45 * from the circuit designer. For the UMB-ADAU1361-A, the clock is external
shorie 1:ea6d442bd68a 46 * 12MHz oscillator from the clock input.
shorie 1:ea6d442bd68a 47 */
shorie 1:ea6d442bd68a 48 virtual void configure_pll(void);
shorie 1:ea6d442bd68a 49 /**
shorie 1:ea6d442bd68a 50 * \brief configuration of the the codec for UMB-ADAU1361-A
shorie 1:ea6d442bd68a 51 * \details
shorie 1:ea6d442bd68a 52 * Configure Internal signal pass and parameters for UMB-ADAU1361.
shorie 1:ea6d442bd68a 53 * The all pass-through signals are shut off. All cross channel signals are shut off.
shorie 1:ea6d442bd68a 54 * Monoral output is disabled.
shorie 1:ea6d442bd68a 55 */
shorie 1:ea6d442bd68a 56 virtual void configure_board(void);
shorie 1:ea6d442bd68a 57 };
shorie 1:ea6d442bd68a 58
shorie 1:ea6d442bd68a 59 }
shorie 1:ea6d442bd68a 60
shorie 1:ea6d442bd68a 61 #endif