Example Mcu Pseudo-Code - Infineon MERUS MA2304DNS User Manual

Audio amplifier configurator
Hide thumbs Also See for MERUS MA2304DNS:
Table of Contents

Advertisement

User manual for MERUS™ audio amplifier configurator
MA2304DNS/MA2304PNS
Saving and exporting configurations
6.2.1

Example MCU pseudo-code

To export a header file, select "export configuration" in the configuration drop-down menu. When prompted,
select a folder to save the files into.
Below is an example MCU code snippet where the device is first muted, DSP data and device registers are
written and then the device is unmuted for playback:
#include "output.h"
#define MA2304_ADDR 0x20
...
int main()
{
amp_mute(true);
amp_write_code(PROGRAM_MEM_ADDR, PROGRAM_CODE, PROGRAM_PACK_SIZE);
amp_write_code(DATA_MEM_ADDR, DATA_CODE, DATA_PACK_SIZE);
amp_write(REG_ADDRESS_1, REG_DATA_1);
amp_write(REG_ADDRESS_2, REG_DATA_2);
amp_mute(false);
return 0;
}
int amp_write_code(uint16_t addr, uint16_t * code, uint16_t size) {
int i = 0;
// Split 16-bit register address into bytes
uint8_t i2c_buffer;
i2c_buffer = addr >> 8 & 0xff;
i2c_write (MA2304_ADDR, i2c_buffer);
i2c_buffer = addr & 0xff;
i2c_write (MA2304_ADDR, i2c_buffer);
// Write data through I2C
for (i = 0; i < size; i++) {
i2c_buffer = code[i] >> 8 & 0xff;
i2c_write (MA2304_ADDR, i2c_buffer);
i2c_buffer = code[i] & 0xff;
i2c_write (MA2304_ADDR, i2c_buffer);
}
}
Figure 76
Example MCU pseudo-code
User Manual
// Temporary storage
// Register address MSB
// Send byte through I2C
// Register address LSB
// Send byte through I2C
58
V 1.1
2022-09-12

Advertisement

Table of Contents
loading

This manual is also suitable for:

Merus ma2304pns

Table of Contents