antopwm2 2.1.0.0
AN to PWM 2 Click Driver

API for configuring and manipulating AN to PWM 2 Click driver. More...

Topics

 AN to PWM 2 Registers Settings
 Settings for registers of AN to PWM 2 Click driver.
 
 AN to PWM 2 MikroBUS Map
 MikroBUS pin mapping of AN to PWM 2 Click driver.
 

Functions

void antopwm2_cfg_setup (antopwm2_cfg_t *cfg)
 AN to PWM 2 configuration object setup function.
 
err_t antopwm2_init (antopwm2_t *ctx, antopwm2_cfg_t *cfg)
 AN to PWM 2 initialization function.
 
err_t antopwm2_set_digipot (antopwm2_t *ctx, uint8_t wiper)
 AN to PWM 2 set digipot function.
 
err_t antopwm2_read_digipot (antopwm2_t *ctx, uint8_t *data_out)
 AN to PWM 2 read digipot function.
 
err_t antopwm2_set_digipot_otp (antopwm2_t *ctx, uint8_t wiper)
 AN to PWM 2 set digipot otp function.
 
err_t antopwm2_set_frequency (antopwm2_t *ctx, uint32_t freq)
 AN to PWM 2 set frequency function.
 
err_t antopwm2_set_frequency_otp (antopwm2_t *ctx, uint32_t freq)
 AN to PWM 2 set frequency otp function.
 
uint8_t antopwm2_get_int_pin (antopwm2_t *ctx)
 AN to PWM 2 get int pin function.
 

Detailed Description

API for configuring and manipulating AN to PWM 2 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

◆ antopwm2_cfg_setup()

void antopwm2_cfg_setup ( antopwm2_cfg_t * cfg)

AN to PWM 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ antopwm2_get_int_pin()

uint8_t antopwm2_get_int_pin ( antopwm2_t * ctx)

AN to PWM 2 get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ antopwm2_init()

err_t antopwm2_init ( antopwm2_t * ctx,
antopwm2_cfg_t * cfg )

AN to PWM 2 initialization function.

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

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

◆ antopwm2_read_digipot()

err_t antopwm2_read_digipot ( antopwm2_t * ctx,
uint8_t * data_out )

AN to PWM 2 read digipot function.

This function reads a digipot wiper position and status by using I2C serial interface.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
[out]data_out: Output data read: B7-B6 -> status, B5-B0 -> wiper position.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ antopwm2_set_digipot()

err_t antopwm2_set_digipot ( antopwm2_t * ctx,
uint8_t wiper )

AN to PWM 2 set digipot function.

This function sets a digipot wiper position by using I2C serial interface.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
[in]wiper: Digipot wiper to be set (0-63).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ antopwm2_set_digipot_otp()

err_t antopwm2_set_digipot_otp ( antopwm2_t * ctx,
uint8_t wiper )

AN to PWM 2 set digipot otp function.

This function sets a digipot wiper position in OTP mode by using I2C serial interface.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
[in]wiper: Digipot wiper to be set (0-63).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function performs one-time programming, so afterwards no further programming is possible.

◆ antopwm2_set_frequency()

err_t antopwm2_set_frequency ( antopwm2_t * ctx,
uint32_t freq )

AN to PWM 2 set frequency function.

This function sets a frequency output in a range from 500kHz to 1MHz by setting the digipot resistance.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
[in]freq: Frequency in Hz to be set (500000-1000000).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ antopwm2_set_frequency_otp()

err_t antopwm2_set_frequency_otp ( antopwm2_t * ctx,
uint32_t freq )

AN to PWM 2 set frequency otp function.

This function sets a frequency output in a range from 500kHz to 1MHz by setting the digipot resistance in OTP mode.

Parameters
[in]ctx: Click context object. See antopwm2_t object definition for detailed explanation.
[in]freq: Frequency in Hz to be set (500000-1000000).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function performs one-time programming, so afterwards no further programming is possible.