![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test public
Dependencies: HttpServer_snapshot_mbed-os
MAX9867_RBSP.h
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer* 00021 * Copyright (C) 2017 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 00024 #ifndef MBED_MAX9867_RBSP_H 00025 #define MBED_MAX9867_RBSP_H 00026 00027 #include "mbed.h" 00028 #include "AUDIO_RBSP.h" 00029 #include "R_BSP_Ssif.h" 00030 00031 /** MAX9867_RBSP class, defined on the I2C master bus 00032 * 00033 */ 00034 class MAX9867_RBSP : public AUDIO_RBSP { 00035 public: 00036 00037 /** Create a MAX9867_RBSP object defined on the I2C port 00038 * 00039 * @param sda I2C data line pin 00040 * @param scl I2C clock line pin 00041 * @param sck SSIF serial bit clock 00042 * @param ws SSIF word selection 00043 * @param tx SSIF serial data output 00044 * @param rx SSIF serial data input 00045 * @param int_level Interupt priority (SSIF) 00046 * @param max_write_num The upper limit of write buffer (SSIF) 00047 * @param max_read_num The upper limit of read buffer (SSIF) 00048 */ 00049 MAX9867_RBSP(PinName sda, PinName scl, PinName sck, PinName ws, PinName tx, PinName rx, uint8_t int_level = 0x80, int32_t max_write_num = 16, int32_t max_read_num = 16); 00050 00051 virtual ~MAX9867_RBSP() {} 00052 00053 /** Overloaded power() 00054 * 00055 * @param type true=power up, false=power down 00056 */ 00057 virtual void power(bool type = true); 00058 00059 /** Set I2S interface bit length and mode 00060 * 00061 * @param length Set bit length to 16 bits 00062 * @return true = success, false = failure 00063 */ 00064 virtual bool format(char length); 00065 00066 /** Set sample frequency 00067 * 00068 * @param frequency Sample frequency of data in Hz 00069 * @return true = success, false = failure 00070 * 00071 * The TLV320 supports the following frequencies: 8kHz, 8.021kHz, 32kHz, 44.1kHz, 48kHz 00072 * Default is 44.1kHz 00073 */ 00074 virtual bool frequency(int hz); 00075 00076 /** Get a value of SSIF channel number 00077 * 00078 * @return SSIF channel number 00079 */ 00080 int32_t GetSsifChNo(void) { 00081 return mI2s_.GetSsifChNo(); 00082 }; 00083 00084 /** Enqueue asynchronous write request 00085 * 00086 * @param p_data Location of the data 00087 * @param data_size Number of bytes to write 00088 * @param p_data_conf Asynchronous control block structure 00089 * @return Number of bytes written on success. negative number on error. 00090 */ 00091 virtual int write(void * const p_data, uint32_t data_size, const rbsp_data_conf_t * const p_data_conf = NULL) { 00092 return mI2s_.write(p_data, data_size, p_data_conf); 00093 }; 00094 00095 /** Enqueue asynchronous read request 00096 * 00097 * @param p_data Location of the data 00098 * @param data_size Number of bytes to read 00099 * @param p_data_conf Asynchronous control block structure 00100 * @return Number of bytes read on success. negative number on error. 00101 */ 00102 virtual int read(void * const p_data, uint32_t data_size, const rbsp_data_conf_t * const p_data_conf = NULL) { 00103 return mI2s_.read(p_data, data_size, p_data_conf); 00104 }; 00105 00106 /** Headphone out volume control 00107 * 00108 * @param leftVolumeOut Left headphone-out volume 00109 * @param rightVolumeOut Right headphone-out volume 00110 * @return Returns "true" for success, "false" if parameters are out of range 00111 */ 00112 virtual bool outputVolume(float leftVolumeOut, float rightVolumeOut); 00113 00114 /** Microphone volume 00115 * 00116 * @param VolumeIn Microphone volume 00117 * @return Returns "true" for success, "false" if parameters are out of range 00118 */ 00119 virtual bool micVolume(float VolumeIn); 00120 00121 protected: 00122 char cmd[4]; // the address and command for MAX9867 internal registers 00123 int mAddr; // register write address 00124 private: 00125 I2C mI2c_; // MUST use the I2C port 00126 R_BSP_Ssif mI2s_; 00127 ssif_channel_cfg_t ssif_cfg; 00128 /** Digital interface activation 00129 * 00130 */ 00131 void activateDigitalInterface_(void); 00132 00133 }; 00134 00135 #endif
Generated on Wed Jul 13 2022 05:33:36 by
![doxygen](doxygen.png)