K1Guitar/device/AW816/Drv_AW816.h

30 lines
1.1 KiB
C
Raw Normal View History

#ifndef __DRV_AW816_H
#define __DRV_AW816_H
#include <stdint.h>
#include "at32f403a_407.h"
/* AW816 挂接在硬件 I2C1 上PB6=SCL / PB7=SDA与 AD85020B 共用同一总线)
I2C1 wk_i2c1_init() AD85020B I2C */
/* 器件地址7 位地址 0x5A。
= 0x5A<<1 = 0xB4 = 0xB5
AT32 i2c_application i2c_master_transmit/receive 8
&0xFE / |0x01 0xB4 / 0xB5 */
#define AW816_DEV_ADDR 0x5A /* 7 位地址 */
#define AW816_WR_ADDR 0xB4 /* 写地址8 位格式) */
#define AW816_RD_ADDR 0xB5 /* 读地址8 位格式) */
#define AW816_I2C_TIMEOUT 1000
/* I2C 外设I2C1 */
#define AW816_I2C I2C1
/* 函数声明 */
extern void AW816_Init(void);
extern void AW816_Set_Volume(int16_t vol); /* 音量 -9000 ~ 1200 */
extern void AW816_Set_Reverb(uint8_t rev); /* 混响 0~100 */
extern uint8_t AW816_Read_Cmd(uint8_t ctrl, uint8_t *out_lo, uint8_t *out_hi);
#endif