Skip to content

Commit

Permalink
修改了关键宏
Browse files Browse the repository at this point in the history
  • Loading branch information
xqyjlj committed Aug 12, 2020
1 parent ed0fa15 commit 5d620e4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
8 changes: 4 additions & 4 deletions inc/ld3320.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#define LD3320_PIN_NONE -1

#define LD3320_MODE_ASR 0x08
#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
#define LD3320_MODE_MP3 0x80
#endif
#define LD3320_CLK_IN 22/* LD3320 chip input frequency */

#define LD3320_PLL_11 (uint8_t)((LD3320_CLK_IN/2.0)-1)

#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
#define LD3320_PLL_MP3_19 0x0f
#define LD3320_PLL_MP3_1B 0x18
#define LD3320_PLL_MP3_1D (uint8_t)(((90.0*((LD3320_PLL_11)+1))/(LD3320_CLK_IN))-1)
Expand Down Expand Up @@ -58,7 +58,7 @@ struct ld3320_obj
struct ld3320_port port;
struct rt_spi_device *dev;
void (*asr_over_callback_t)(uint8_t num); /*callback */
#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
char mp3_path[30];
uint32_t mp3_size;
uint32_t mp3_pos;
Expand Down Expand Up @@ -91,7 +91,7 @@ void ld3320_set_asr_over_callback(ld3320_t ops, asr_over_callback_t callback);
void ld3320_addcommand_tolist(ld3320_t ops, char *pass, int num);
void ld3320_addcommand_fromlist(ld3320_t ops);

#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
void ld3320_mp3_start(ld3320_t ops);
void ld3320_set_mp3_file_path(ld3320_t ops, const char * mp3);
#endif
Expand Down
16 changes: 0 additions & 16 deletions inc/ld3320_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@
#include <stdint.h>
#include <rtdevice.h>

#ifdef PKG_USING_LD3320_DEBUG

#ifdef PKG_USING_LD3320_RECV_REPORT
#define LD3320_USING_RECV_REPORT
#endif

#ifdef PKG_USING_LD3320_FINSH
#define LD3320_USING_FINSH
#endif

#endif

#ifdef PKG_USING_LD3320_MP3
#define LD3320_USING_MP3
#endif

void ld3320_write_reg(struct rt_spi_device *device, uint8_t addr, uint8_t data);
uint8_t ld3320_read_reg(struct rt_spi_device *device, uint8_t addr);

Expand Down
20 changes: 10 additions & 10 deletions src/ld3320.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <rtdbg.h>


#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
#include <dfs_posix.h>
#endif

Expand Down Expand Up @@ -70,7 +70,7 @@ static void ld3320_init_common(ld3320_t ops, uint8_t mode)
ld3320_write_reg(ops->obj.dev, 0x1d, LD3320_PLL_ASR_1D);/* set clock frequency 4 */

}
#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
else if (mode == LD3320_MODE_MP3)
{
ld3320_write_reg(ops->obj.dev, 0x1e, 0x00);/* ADC control initialization */
Expand Down Expand Up @@ -112,7 +112,7 @@ static void ld3320_init_asr(ld3320_t ops)
rt_hw_us_delay(1);
}

#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
/**
* @name: ld3320_init_mp3
* @brief: Initialize LD3320 MP3 mode
Expand Down Expand Up @@ -152,7 +152,7 @@ static void ld3320_init_mp3(ld3320_t ops)
#endif


#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
/**
* @name: ld3320_set_mix2spVolume
* @brief:
Expand Down Expand Up @@ -436,7 +436,7 @@ static void ld3320_init_chip(ld3320_t ops, uint8_t mode)
ld3320_set_voiceMaxLength(ops, LD3320_VOICE_MAX_LENGTH);
ld3320_set_noiseTime(ops, LD3320_NOISE_TIME);
}
#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
else if (mode == LD3320_MODE_MP3)
{
ld3320_init_mp3(ops);
Expand Down Expand Up @@ -563,7 +563,7 @@ ld3320_t ld3320_create(char *spi_dev_name, int wr, int rst, int irq, uint8_t mod

ld3320_hw_rst(ops);
ld3320_init_chip(ops, mode);
#ifdef LD3320_USING_FINSH
#ifdef PKG_USING_LD3320_FINSH
ld3320_finsh_init(ops);
#endif
return ops;
Expand Down Expand Up @@ -643,7 +643,7 @@ void ld3320_set_asr_over_callback(ld3320_t ops, asr_over_callback_t callback)
}


#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
/**
* @name: ld3320_mp3_start
* @brief: start LD3320 MP3
Expand Down Expand Up @@ -702,7 +702,7 @@ void ld3320_mp3_start(ld3320_t ops)
#endif


#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
/**
* @name: ld3320_mp3_run
* @brief: LD3320 MP3 mode operation function
Expand Down Expand Up @@ -750,7 +750,7 @@ static void ld3320_mp3_run(ld3320_t ops)
#endif


#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
/**
* @name: ld3320_set_mp3_file_path
* @brief LD3320 set mp3 file path function
Expand Down Expand Up @@ -787,7 +787,7 @@ void ld3320_run(ld3320_t ops, uint8_t mode)
{
ld3320_asr_run(ops);
}
#ifdef LD3320_USING_MP3
#ifdef PKG_USING_LD3320_MP3
else if (mode == LD3320_MODE_MP3)
{
ld3320_mp3_run(ops);
Expand Down
4 changes: 2 additions & 2 deletions src/ld3320_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
#include "ld3320_base.h"

#ifdef LD3320_USING_RECV_REPORT
#ifdef PKG_USING_LD3320_RECV_REPORT
#define DBG_TAG "ld_base"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
Expand Down Expand Up @@ -197,7 +197,7 @@ uint8_t ld3320_read_reg(struct rt_spi_device *device, uint8_t addr)
tmp_addr = addr;
static uint8_t data;
ld3320_spi_recv(device, &tmp_read, &tmp_addr, &data);
#ifdef LD3320_ENABLING_RECV_REPORT
#ifdef PKG_USING_LD3320_RECV_REPORT
LOG_D("read: 0x%02X->0x%02X", tmp_addr, data);
#endif
return data;
Expand Down
2 changes: 1 addition & 1 deletion src/ld3320_finsh.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
#include "ld3320.h"

#ifdef LD3320_USING_FINSH
#ifdef PKG_USING_LD3320_FINSH
static ld3320_t ld3320_head;

void ld3320_finsh_init(ld3320_t ops)
Expand Down

0 comments on commit 5d620e4

Please # to comment.