Device Driver for the MAX11300 20 port ADC/DAC/GPIO device. More...
Device Driver for the MAX11300 20 port ADC/DAC/GPIO device.
This is a highly opinionated driver implementation for the MAX11300 DAC/ADC/GPIO device.
This implemetation has been designed for use in the context of Eurorack modular systems. There are a number of features the MAX11300 offers which are not exposed, as well as a number of configuration decisions that were made in order to simplify usage and improve ergonomics, even at the cost of flexibility.
#include <max11300.h>
Classes | |
struct | Config |
Static Public Member Functions | |
static uint16_t | VoltsTo12BitUint (float volts, MAX11300Types::DacVoltageRange range) |
static float | TwelveBitUintToVolts (uint16_t value, MAX11300Types::AdcVoltageRange range) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Initialize the MAX11300
This method verifies SPI connectivity, configures the chip to operate within the scope of this implementation, and intitalizes all pins by default to High-Z mode.
config | - The MAX11300 configuration |
dma_buffer | a buffer in DMA-accessible memory. Allocate it like this: MAX11300DmaBuffer DMA_BUFFER_MEM_SECTION myBuffer; |
|
inline |
Read the raw 12 bit (0-4095) value of a given ANALOG_IN (ADC) pin.
*note this read is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to read the value |
|
inline |
Read the value of a given ADC pin in volts.
*note this read is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to read the voltage |
|
inline |
Read the state of a GPI pin
*note this read is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to read the value |
|
inline |
Starts to update and synchronize the MAX11300 - This method does the following:
The driver can be stopped by calling Stop().
complete_callback | An optional callback function that's called after each successful update Keep this callback function simple and fast, it's called from an interrupt. |
complete_callback_context | An optional context pointer provided to the complete_callback |
|
inline |
Call this to stop the auto updating, but complete the current update.
|
inlinestatic |
A utility funtion for converting the first 12 bits (0-4095) of an unsigned 16 bit integer value, to a voltage (float) value. The voltage value is scaled and bound to the given voltage range.
value | the 12 bit value to convert |
range | the MAX11300Types::AdcVoltageRange to constrain to |
|
inlinestatic |
A utility funtion for converting a voltage (float) value, bound to a given voltage range, to the first 12 bits (0-4095) of an unsigned 16 bit integer value.
volts | the voltage to convert |
range | the MAX11300Types::DacVoltageRange to constrain to |
|
inline |
Write a raw 12 bit (0-4095) value to a given ANALOG_OUT (DAC) pin
*note this write is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to write the value |
raw_value | - the 12-bit code to write to the given Pin |
|
inline |
Write a voltage value, within the bounds of the configured volatge range, to a given ANALOG_OUT (DAC) pin.
*note this write is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to write the voltage |
voltage | - Target voltage |
|
inline |
Write a digital state to the given GPO pin
*note this write is local, call MAX11300::Start() to sync with the MAX11300
pin | - The pin of which to write the value |
value | - the boolean state to write |