PGA2310 Volume Control device for IoAbstraction
22-05-2023
Visit associated GitHub repository
Visit reference documentation page

PGA2310 Volume Control device

Provides a simple analog device that can be used to control a PGA2310 volume device. Left channel is 0 and right channel is 1. The device should be connected on the SPI bus as usual. This should work with Arduino now, and mbed in a patch release coming soon. To use first include the header:

#include <extras/Pga2310VolumeControl.h>

Then initialise globally:

SPIWithSettings spiSettings(&SPI, CS_PIN);
Pga2310VolumeControl pga2310(spiSettings);

And to use it as a floating point value

pga2310.setCurrentFloat(volFlt); // where the value is between 0F and 1F 
float f = pga2310.getCurrentFloat(); // where the value is between 0F and 1F 

or as an integer

pga2310.setCurrentValue(intVal);  // where the value is between 0 and 255
unsigned int val = pga2310.getCurrentValue();  // where the value is between 0 and 255

This covers everything for this device.

These may be of interest

Want to let us know about something?

We use cookies to analyse traffic and to personalise content. We also embed Twitter and Youtube on some pages, these companies have their own privacy policies.

See the privacy policy and terms of use of this site should you need more information or wish to adjust your settings.