DPOT

Functions

s32 DPOT_Init (u32 mode)
s32 DPOT_Set_Value (u8 pot, u16 value)
s32 DPOT_Get_Value (u8 pot)
s32 DPOT_Update (void)

Detailed Description

DPOT module driver

The application interface (API) has been designed to communicate with a variety of digital potentiometer (DPOT) integrated circuit (IC) chips. As of this time, there are no officially supported digital potentiometer modules that are part of the MIDIbox Hardware Platform (MBHP).

The number of DPOTs is software-limitted to 32 by the 'dpot_update_req' variable (32-bit wide unsigned integer). The limit of supported DPOTs will depend upon the limitations of the data bus (SPI or IIC, for example), the limitations of the ICs that contain the DPOTs, and possibly the performance limitations of the MIOS32 core.

This file contains the generic interface that is presented to the MIOS32 application. The IC-specific implementation is contained in a separate file. This allows the the MIOS32_DPOT implementation to be easily modified for any number of DPOT ICs.

DPOT output values (typically specifying the wiper pin position as a percentage of "full scale") are managed in 16bit resolution. Be aware that typical DPOTs have 128 positions or 256 positions, which requires only 8 bits of resolution. The use of 16bit resolution allows for the possibility that a DPOT that features a large resolution can be supported.

Before DPOT changes are applied to the external hardware, this API will comapare the new value with the current one. If equal, the application to the hardware will be omitted, otherwise it will be performed once DPOT_Update() is called.

This method has two advantages:

The voltage configuration jumper of J19 has to be set to appropriately supply the DPOT IC (5V or 3V3), and the 4x1k Pull-Up resistor array should be installed to supply the 3.3V->5V level shifting if 5V supply is used.

An usage example can be found under $MIOS32_PATH/apps/tutorials/026_dpot


Function Documentation

s32 DPOT_Get_Value ( u8  pot  ) 

This function returns the current DPOT value of a DPOT channel.

Parameters:
[in] pot the pot number (0..DPOT_NUM_POTS-1)
Returns:
-1 if pot not available
>= 0 if pot available (16bit output value)
s32 DPOT_Init ( u32  mode  ) 

Initializes DPOT driver Should be called from Init() during startup

Parameters:
[in] mode currently only mode 0 supported
Returns:
< 0 if initialisation failed
s32 DPOT_Set_Value ( u8  pot,
u16  value 
)

This function sets an output channel to a given 16-bit value.

The output value won't be transfered to the module immediately, but will be buffered instead. By calling DPOT_Update() the requested changes will take place.

Parameters:
[in] pot the pot number (0..DPOT_NUM_POTS-1)
[in] value the 16bit value
Returns:
-1 if pin not available
0 on success
s32 DPOT_Update ( void   ) 

Updates the output channels of all DPOT channels Should be called, whenever changes have been requested via DPOT_Set_Value()

Returns:
< 0 on errors

Here is the call graph for this function:


Generated on 22 Jan 2016 for MIOS32 by  doxygen 1.6.1