diff include/BeagleRT.h @ 171:e63563507edd

Added command-line options for the PGA
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 28 Dec 2015 03:53:36 +0100
parents 3c3a1357657d
children 2877bc2cd449
line wrap: on
line diff
--- a/include/BeagleRT.h	Mon Dec 28 03:19:59 2015 +0100
+++ b/include/BeagleRT.h	Mon Dec 28 03:53:36 2015 +0100
@@ -73,6 +73,12 @@
  */
 #define DEFAULT_ADC_LEVEL	-6.0
 
+
+/**
+ * Default level of the Programmable Gain Amplifier in decibels.
+ */
+#define DEFAULT_PGA_GAIN 16
+
 /**
  * Default level of the headphone output in decibels. See BeagleRT_setHeadphoneLevel().
  */
@@ -120,6 +126,8 @@
 	float dacLevel;
 	/// Level for the audio ADC input
 	float adcLevel;
+	/// Gains for the PGA, left and right channels
+	float pgaGain[2];
 	/// Level for the headphone output
 	float headphoneLevel;
 
@@ -484,6 +492,25 @@
  */
 int BeagleRT_setADCLevel(float decibels);
 
+
+/**
+ * \brief Set the gain of the audio preamplifier.
+ *
+ * This function sets the level of the Programmable Gain Amplifier(PGA), which
+ * amplifies the signal before the ADC.
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param decibels Level of the PGA Valid levels range from 0 (lowest) to
+ * 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded.
+ * \param channel Specifies which channel to apply the gain to. Channel 0 is left,
+ * channel 1 is right
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int BeagleRT_setPgaGain(float decibels, int channel);
+
 /**
  * \brief Set the level of the onboard headphone amplifier.
  *