Skip to content

Commit 0d0b723

Browse files
committed
WM8969: Use AD_LOGD
1 parent dfc79d5 commit 0d0b723

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

src/Driver/wm8960/mtb_wm8960.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
6363
result = mtb_wm8960_write(WM8960_REG_PWR_MGMT1, value);
6464
if (! result)
6565
{
66-
WM8960_LOG("Enable VREF and set VMID=50K");
66+
AD_LOGD("Enable VREF and set VMID=50K");
6767
return result;
6868
}
6969

@@ -81,7 +81,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
8181
result = mtb_wm8960_write(WM8960_REG_PWR_MGMT2, value);
8282
if (! result)
8383
{
84-
WM8960_LOG("Enable DACL, DACR, LOUT1 and ROUT1");
84+
AD_LOGD("Enable DACL, DACR, LOUT1 and ROUT1");
8585
return result;
8686
}
8787
}
@@ -93,7 +93,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
9393
result = mtb_wm8960_write(WM8960_REG_CLASS_D_CTL1, 0xF7);
9494
if (! result)
9595
{
96-
WM8960_LOG("Enable Class D");
96+
AD_LOGD("Enable Class D");
9797
return result;
9898
}
9999
}
@@ -126,7 +126,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
126126
result = mtb_wm8960_write(WM8960_REG_PWR_MGMT3, pwr_mgmt3);
127127
if (! result)
128128
{
129-
WM8960_LOG("WM8960_REG_PWR_MGMT3");
129+
AD_LOGD("WM8960_REG_PWR_MGMT3");
130130
return result;
131131
}
132132

@@ -197,7 +197,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
197197
result = mtb_wm8960_write(operation.reg, operation.value);
198198
if (! result)
199199
{
200-
WM8960_LOG("operation");
200+
AD_LOGD("operation");
201201
return result;
202202
}
203203
}
@@ -215,7 +215,7 @@ static bool _mtb_wm8960_config_default(uint8_t features)
215215
static bool _mtb_wm8960_setup_pll(uint32_t mclk_hz,
216216
mtb_wm8960_adc_dac_sample_rate_t sample_rate)
217217
{
218-
WM8960_LOG("_mtb_wm8960_setup_pll");
218+
AD_LOGD("_mtb_wm8960_setup_pll");
219219
bool result;
220220
uint8_t PLLN;
221221
uint32_t PLLK;
@@ -328,7 +328,7 @@ static bool _mtb_wm8960_adjust_volume(uint8_t volume, mtb_wm8960_reg_t left_vol_
328328
mtb_wm8960_reg_t right_vol_reg,
329329
uint16_t update_bit, uint16_t volume_bits_mask)
330330
{
331-
WM8960_LOG("_mtb_wm8960_adjust_volume");
331+
AD_LOGD("_mtb_wm8960_adjust_volume");
332332
/* Volume adjustment is done based on documentation datasheet(rev 4.4) pg 45 */
333333
bool result;
334334
uint16_t data;
@@ -371,7 +371,7 @@ static bool _mtb_wm8960_adjust_volume(uint8_t volume, mtb_wm8960_reg_t left_vol_
371371
//--------------------------------------------------------------------------------------------------
372372

373373
bool mtb_wm8960_set_wire(void* i2c_inst){
374-
WM8960_LOG("mtb_wm8960_set_wire");
374+
AD_LOGD("mtb_wm8960_set_wire");
375375

376376
/* Assign I2C hal object */
377377
i2c_ptr = i2c_inst;
@@ -394,7 +394,7 @@ void mtb_wm8960_set_write_retry_count(uint32_t count){
394394
bool mtb_wm8960_init(uint8_t features)
395395
{
396396
// use Wire and start it
397-
WM8960_LOG("mtb_wm8960_init");
397+
AD_LOGD("mtb_wm8960_init");
398398

399399
bool result = mtb_wm8960_write(WM8960_REG_RESET, 0);
400400
if (!result)
@@ -410,7 +410,7 @@ bool mtb_wm8960_init(uint8_t features)
410410
{
411411
result = _mtb_wm8960_config_default(features);
412412
if (!result) {
413-
WM8960_LOG("_mtb_wm8960_config_default ERROR");
413+
AD_LOGD("_mtb_wm8960_config_default ERROR");
414414
return result;
415415
}
416416
}
@@ -424,7 +424,7 @@ bool mtb_wm8960_init(uint8_t features)
424424
//--------------------------------------------------------------------------------------------------
425425
void mtb_wm8960_free(void)
426426
{
427-
WM8960_LOG("mtb_wm8960_free");
427+
AD_LOGD("mtb_wm8960_free");
428428
i2c_ptr = NULL;
429429
pll_enabled = false;
430430
enabled_features = WM8960_FEATURE_NONE;
@@ -436,7 +436,7 @@ void mtb_wm8960_free(void)
436436
//--------------------------------------------------------------------------------------------------
437437
bool mtb_wm8960_activate(void)
438438
{
439-
WM8960_LOG("mtb_wm8960_activate");
439+
AD_LOGD("mtb_wm8960_activate");
440440
bool result;
441441
uint16_t value;
442442

@@ -513,7 +513,7 @@ bool mtb_wm8960_activate(void)
513513
//--------------------------------------------------------------------------------------------------
514514
bool mtb_wm8960_deactivate(void)
515515
{
516-
WM8960_LOG("mtb_wm8960_deactivate");
516+
AD_LOGD("mtb_wm8960_deactivate");
517517
bool result;
518518
uint16_t value = 0;
519519

@@ -638,7 +638,7 @@ bool i2c_write(uint8_t address, uint8_t data[2]) {
638638
bool mtb_wm8960_write(mtb_wm8960_reg_t enum_reg, uint16_t value){
639639
char msg[80];
640640
snprintf(msg, 80, "mtb_wm8960_write 0x%x = 0x%x", enum_reg, value );
641-
WM8960_LOG(msg);
641+
AD_LOGD(msg);
642642
bool result = false;
643643
uint32_t count=0;
644644
while(!result){
@@ -709,7 +709,7 @@ bool mtb_wm8960_clear(mtb_wm8960_reg_t reg, uint16_t mask)
709709
//--------------------------------------------------------------------------------------------------
710710
bool mtb_wm8960_adjust_input_volume(uint8_t volume)
711711
{
712-
WM8960_LOG("mtb_wm8960_adjust_input_volume");
712+
AD_LOGD("mtb_wm8960_adjust_input_volume");
713713
if (volume > WM8960_LEFT_RIGHT_IN_VOL_INVOL_30dB)
714714
{
715715
return false;
@@ -726,7 +726,7 @@ bool mtb_wm8960_adjust_input_volume(uint8_t volume)
726726
//--------------------------------------------------------------------------------------------------
727727
bool mtb_wm8960_adjust_heaphone_output_volume(uint8_t volume)
728728
{
729-
WM8960_LOG("mtb_wm8960_adjust_heaphone_output_volume");
729+
AD_LOGD("mtb_wm8960_adjust_heaphone_output_volume");
730730
if (volume > WM8960_LOUT1_ROUT1_VOL_OUT1VOL_6dB)
731731
{
732732
return false;
@@ -742,7 +742,7 @@ bool mtb_wm8960_adjust_heaphone_output_volume(uint8_t volume)
742742
//--------------------------------------------------------------------------------------------------
743743
bool mtb_wm8960_adjust_speaker_output_volume(uint8_t volume)
744744
{
745-
WM8960_LOG("mtb_wm8960_adjust_heaphone_output_volume");
745+
AD_LOGD("mtb_wm8960_adjust_heaphone_output_volume");
746746
if (volume > WM8960_LOUT1_ROUT1_VOL_OUT1VOL_6dB)
747747
{
748748
return false;
@@ -775,7 +775,7 @@ bool mtb_wm8960_configure_clocking(uint32_t mclk_hz, bool enable_pll,
775775
mtb_wm8960_word_length_t word_length,
776776
mtb_wm8960_mode_t mode)
777777
{
778-
WM8960_LOG("mtb_wm8960_configure_clocking");
778+
AD_LOGD("mtb_wm8960_configure_clocking");
779779
bool result;
780780
uint16_t dac_div_mask;
781781
uint16_t adc_div_mask;
@@ -872,17 +872,17 @@ bool mtb_wm8960_configure_clocking(uint32_t mclk_hz, bool enable_pll,
872872
}
873873

874874
bool mtb_wm8960_dump(){
875-
WM8960_LOG("mtb_wm8960_dump");
875+
AD_LOGD("mtb_wm8960_dump");
876876
char msg[80];
877877
for (int j=0x1;j<=0x37;j++){
878878
uint16_t data;
879879
if (!mtb_wm8960_read((mtb_wm8960_reg_t)j, &data)){
880-
WM8960_LOG("mtb_wm8960_dump ERROR");
880+
AD_LOGD("mtb_wm8960_dump ERROR");
881881
return false;
882882
}
883883

884884
snprintf(msg, 80, "%x: %x",j, data);
885-
WM8960_LOG(msg);
885+
AD_LOGD(msg);
886886
}
887887
return true;
888888
}

src/Driver/wm8960/mtb_wm8960.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <stdint.h>
3939
#include <stdio.h>
4040
#include <string.h>
41+
#include "DriverCommon.h"
4142

4243
#ifdef ARDUINO
4344
# include <Arduino.h>
@@ -51,11 +52,6 @@ extern "C"
5152

5253
#define WM8960_I2C_ADDRESS (0x1A)
5354

54-
#ifdef ARDUINO
55-
# define WM8960_LOG(msg) Serial.println(msg)
56-
#else
57-
# define WM8960_LOG(msg)
58-
#endif
5955

6056
/**
6157
* \{

0 commit comments

Comments
 (0)