analogmux3 2.0.0.0
Analog MUX 3 Click Driver

API for configuring and manipulating Analog MUX 3 Click driver. More...

Topics

 Analog MUX 3 Registers Settings
 Settings for registers of Analog MUX 3 Click driver.
 
 Analog MUX 3 MikroBUS Map
 MikroBUS pin mapping of Analog MUX 3 Click driver.
 

Functions

void analogmux3_cfg_setup (analogmux3_cfg_t *cfg)
 Analog MUX 3 configuration object setup function.
 
err_t analogmux3_init (analogmux3_t *ctx, analogmux3_cfg_t *cfg)
 Analog MUX 3 initialization function.
 
err_t analogmux3_default_cfg (analogmux3_t *ctx)
 Analog MUX 3 default configuration function.
 
err_t analogmux3_generic_write (analogmux3_t *ctx, uint8_t data_in)
 Analog MUX 3 data writing function.
 
void analogmux3_hw_reset (analogmux3_t *ctx)
 Analog MUX 3 reset the device function.
 
err_t analogmux3_set_channel (analogmux3_t *ctx, uint8_t mux_ch)
 Analog MUX 3 set channel function.
 
err_t analogmux3_read_an_pin_value (analogmux3_t *ctx, uint16_t *data_out)
 Analog MUX 3 read AN pin value function.
 
err_t analogmux3_read_an_pin_voltage (analogmux3_t *ctx, float *data_out)
 Analog MUX 3 read AN pin voltage level function.
 

Detailed Description

API for configuring and manipulating Analog MUX 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ analogmux3_cfg_setup()

void analogmux3_cfg_setup ( analogmux3_cfg_t * cfg)

Analog MUX 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See analogmux3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ analogmux3_default_cfg()

err_t analogmux3_default_cfg ( analogmux3_t * ctx)

Analog MUX 3 default configuration function.

This function executes a default configuration of Analog MUX 3 click board.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ analogmux3_generic_write()

err_t analogmux3_generic_write ( analogmux3_t * ctx,
uint8_t data_in )

Analog MUX 3 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ analogmux3_hw_reset()

void analogmux3_hw_reset ( analogmux3_t * ctx)

Analog MUX 3 reset the device function.

This function executes a hardware reset of Analog MUX 3 click board.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ analogmux3_init()

err_t analogmux3_init ( analogmux3_t * ctx,
analogmux3_cfg_t * cfg )

Analog MUX 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See analogmux3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ analogmux3_read_an_pin_value()

err_t analogmux3_read_an_pin_value ( analogmux3_t * ctx,
uint16_t * data_out )

Analog MUX 3 read AN pin value function.

This function reads results of AD conversion of the AN pin.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ analogmux3_read_an_pin_voltage()

err_t analogmux3_read_an_pin_voltage ( analogmux3_t * ctx,
float * data_out )

Analog MUX 3 read AN pin voltage level function.

This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ analogmux3_set_channel()

err_t analogmux3_set_channel ( analogmux3_t * ctx,
uint8_t mux_ch )

Analog MUX 3 set channel function.

This function sets the active channel by using SPI serial interface.

Parameters
[in]ctx: Click context object. See analogmux3_t object definition for detailed explanation.
[in]mux_ch:
  • 0x00 ( ANALOGMUX3_SET_CHANNEL_0 ) - Set active channel 0,
  • 0x01 ( ANALOGMUX3_SET_CHANNEL_1 ) - Set active channel 1,
  • 0x02 ( ANALOGMUX3_SET_CHANNEL_2 ) - Set active channel 2,
  • 0x03 ( ANALOGMUX3_SET_CHANNEL_3 ) - Set active channel 3,
  • 0x04 ( ANALOGMUX3_SET_CHANNEL_4 ) - Set active channel 4,
  • 0x05 ( ANALOGMUX3_SET_CHANNEL_5 ) - Set active channel 5,
  • 0x06 ( ANALOGMUX3_SET_CHANNEL_6 ) - Set active channel 6,
  • 0x07 ( ANALOGMUX3_SET_CHANNEL_7 ) - Set active channel 7,
  • 0xFF ( ANALOGMUX3_SET_NO_CHANNEL )- Disable all channels.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.