From 2f60747dd3b51321903de9c51789765d41ed83e4 Mon Sep 17 00:00:00 2001 From: ozpv <39195175+ozpv@users.noreply.github.com> Date: Mon, 17 Aug 2026 00:01:22 -0500 Subject: audio driver --- Core/Inc/cs4272.h | 35 +++++++++++++++++++++++++++++++++ Core/Inc/dma.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ Core/Inc/stm32h7xx_it.h | 2 ++ 3 files changed, 89 insertions(+) create mode 100755 Core/Inc/cs4272.h create mode 100755 Core/Inc/dma.h (limited to 'Core/Inc') diff --git a/Core/Inc/cs4272.h b/Core/Inc/cs4272.h new file mode 100755 index 0000000..30e493a --- /dev/null +++ b/Core/Inc/cs4272.h @@ -0,0 +1,35 @@ +/* + * cs4272.h + * + * Created on: Aug 16, 2026 + * Author: ozpv + */ + +#ifndef INC_CS4272_H_ +#define INC_CS4272_H_ + +// cs4272k-czzr 7. REGISTER QUICK REFERENCE +#define MODE_CONTROL_1 0x01 +#define DAC_CONTROL 0x02 +#define DAC_VOLUME_AND_MIXING_CONTROL 0x03 +#define DAC_CH_A_VOLUME_CONTROL 0x04 +#define DAC_CH_B_VOLUME_CONTROL 0x05 +#define ADC_CONTROL 0x06 +#define MODE_CONTROL_2 0x07 +#define CHIP_ID 0x08 + +#define CS4272_CHIP_ID 0x0 + +// set by ncs/ad0 pin +#define CS4272_I2C_ADDR (0b0010000 << 1) + +#define BUFFER_SIZE 512 + +extern volatile int32_t rx_buffer[BUFFER_SIZE]; +extern volatile int32_t tx_buffer[BUFFER_SIZE]; + +extern const uint8_t CS4272_CONFIG[7]; + +uint8_t CS4272_Init(); + +#endif /* INC_CS4272_H_ */ diff --git a/Core/Inc/dma.h b/Core/Inc/dma.h new file mode 100755 index 0000000..cbf3957 --- /dev/null +++ b/Core/Inc/dma.h @@ -0,0 +1,52 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file dma.h + * @brief This file contains all the function prototypes for + * the dma.c file + ****************************************************************************** + * @attention + * + * Copyright (c) 2026 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __DMA_H__ +#define __DMA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* DMA memory to memory transfer handles -------------------------------------*/ + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN Private defines */ + +/* USER CODE END Private defines */ + +void MX_DMA_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __DMA_H__ */ + diff --git a/Core/Inc/stm32h7xx_it.h b/Core/Inc/stm32h7xx_it.h index b176787..c630d61 100755 --- a/Core/Inc/stm32h7xx_it.h +++ b/Core/Inc/stm32h7xx_it.h @@ -55,6 +55,8 @@ void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); +void DMA1_Stream0_IRQHandler(void); +void DMA1_Stream1_IRQHandler(void); void OTG_HS_EP1_OUT_IRQHandler(void); void OTG_HS_EP1_IN_IRQHandler(void); void OTG_HS_IRQHandler(void); -- cgit v1.2.3