TLV320DAC3100.Math (tlv320dac3100 v0.1.0)

Copy Markdown View Source

Mathematical conversion and volume scaling utilities for the TLV320DAC3100.

Summary

Functions

Converts a digital dB volume to its corresponding 8-bit register representation.

Finds the 7-bit hex index (0..127) matching the target dB attenuation using table lookup.

Splits a net dB target into a valid {gain_db, attenuation_db} pair, prioritizing the lowest possible analog gain from gain_options.

Functions

db_to_reg_val(db)

Converts a digital dB volume to its corresponding 8-bit register representation.

db_to_uint7(db)

Finds the 7-bit hex index (0..127) matching the target dB attenuation using table lookup.

split_net_volume(net_db, gain_options, max_volume)

Splits a net dB target into a valid {gain_db, attenuation_db} pair, prioritizing the lowest possible analog gain from gain_options.