Raspberry Pio Pico Drivers project
Loading...
Searching...
No Matches
adau1361lower.hpp
Go to the documentation of this file.
1
10#ifndef PICO_DRIVER_SRC_CODEC_ADAU1361LOWER_HPP_
11#define PICO_DRIVER_SRC_CODEC_ADAU1361LOWER_HPP_
12#if __has_include(<hardware/i2c.h>) || __has_include(<gmock/gmock.h>) || DOXYGEN_COMPILE
13
14#include "i2c/i2cmaster.hpp"
15
16#if __has_include(<gmock/gmock.h>)
17#include <gmock/gmock.h>
18#endif
19
20namespace rpp_driver {
21
50 public:
59 unsigned int i2c_device_addr);
60 Adau1361Lower() = delete;
61 virtual ~Adau1361Lower() {}
76 virtual void SendCommand(const uint8_t command[], int size);
90 virtual void SendCommandTable(const uint8_t table[][3], int rows);
91
96 virtual bool IsI2CDeviceExisting();
97
103 virtual void InitializeCore();
104
110 virtual void DisablePLL();
111
120 virtual void WaitPllLock(void);
121
132 virtual void ConfigurePll(unsigned int fs, unsigned int master_clock);
133
140 virtual void ConfigureSrc(unsigned int fs);
141
147 virtual void EnableCore();
148
159 virtual void InitializeRegisters();
160
168 virtual void ConfigureSignalPath() = 0;
169
185 virtual void SetLineInputGain(float left_gain, float right_gain, bool mute);
197 virtual void SetAuxInputGain(float left_gain, float right_gain, bool mute);
198
211 virtual void SetLineOutputGain(float left_gain, float right_gain, bool mute);
212
224 virtual void SetHpOutputGain(float left_gain, float right_gain, bool mute);
225
226 protected:
230 const unsigned int device_addr_;
231};
232
233// #ifdef MOCK_METHOD0
234#if __has_include(<gmock/gmock.h>) || DOXYGEN_COMPILE
235// GCOVR_EXCL_START
240 public:
241 explicit MockAdau1361Lower(::rpp_driver::I2cMaster& controller)
242 : Adau1361Lower(controller, 0x3A) {};
243 MOCK_METHOD2(SendCommand, void(const uint8_t command[], int size));
244 MOCK_METHOD2(SendCommandTable, void(const uint8_t table[][3], int rows));
245 MOCK_METHOD0(IsI2CDeviceExisting, bool());
246 MOCK_METHOD0(InitializeCore, void());
247 MOCK_METHOD0(DisablePLL, void());
248 MOCK_METHOD0(WaitPllLock, void());
249 MOCK_METHOD2(ConfigurePll, void(unsigned int fs, unsigned int master_clock));
250 MOCK_METHOD1(ConfigureSrc, void(unsigned int fs));
251 MOCK_METHOD0(EnableCore, void());
252 MOCK_METHOD0(InitializeRegisters, void());
253 MOCK_METHOD0(ConfigureSignalPath, void());
254 MOCK_METHOD3(SetLineInputGain,
255 void(float left_gain, float right_gain, bool mute));
256 MOCK_METHOD3(SetAuxInputGain,
257 void(float left_gain, float right_gain, bool mute));
258 MOCK_METHOD3(SetLineOutputGain,
259 void(float left_gain, float right_gain, bool mute));
260 MOCK_METHOD3(SetHpOutputGain,
261 void(float left_gain, float right_gain, bool mute));
262};
263#endif // __has_include(<gmock/gmock.h>)
264// GCOVR_EXCL_STOP
265} // namespace rpp_driver
266
267#endif // __has_include(<hardware/i2c.h>) || __has_include(<gmock/gmock.h>)
268
269#endif /* PICO_DRIVER_SRC_CODEC_ADAU1361LOWER_HPP_ */
lower part of the Adau1361 CODEC controller class.
Definition: adau1361lower.hpp:49
virtual void InitializeCore()
Reset the core for fresh procedure.
virtual void SetAuxInputGain(float left_gain, float right_gain, bool mute)
Set the aux input gain and enable the relevant mixer.
virtual void EnableCore()
Initialize the core part of the ADAU1361A.
virtual void WaitPllLock(void)
wait until PLL locks.
virtual void SendCommand(const uint8_t command[], int size)
send one command to ADAU1361.
virtual void SendCommandTable(const uint8_t table[][3], int rows)
Send multiple commands to ADAU1361.
virtual void DisablePLL()
stop PLL to re-program.
Adau1361Lower(::rpp_driver::I2cMaster &controller, unsigned int i2c_device_addr)
Construct a new object.
virtual void InitializeRegisters()
Initialize registers for the chip operation.
virtual void SetLineInputGain(float left_gain, float right_gain, bool mute)
Set the line input gain and enable the relevant mixer.
const unsigned int device_addr_
Internal variable to hold the I2C device address.
Definition: adau1361lower.hpp:230
virtual bool IsI2CDeviceExisting()
Check whether I2C device exist or not.
virtual void SetHpOutputGain(float left_gain, float right_gain, bool mute)
Set the headphone output gain and enable the relevant mixer.
virtual void ConfigureSrc(unsigned int fs)
Initialize the SRC with given fs clock.
virtual void ConfigurePll(unsigned int fs, unsigned int master_clock)
Initialize the PLL with given fs and master clock.
virtual void SetLineOutputGain(float left_gain, float right_gain, bool mute)
Set the line output gain and enable the relevant mixer.
::rpp_driver::I2cMaster & i2c_
Internal variable to hold the I2C controller variable.
Definition: adau1361lower.hpp:228
virtual void ConfigureSignalPath()=0
Initialize registers for the signal routing.
I2C Master controller class.
Definition: i2cmaster.hpp:83
Mock class for test.
Definition: adau1361lower.hpp:239
I2C Master Controller.
Collection of the RP2040/RP2350 control.
Definition: adau1361.hpp:17