ultrasonic5 2.1.0.0
Ultrasonic 5 Click Driver

API for configuring and manipulating Ultrasonic 5 Click driver. More...

Topics

 Ultrasonic 5 Registers List
 List of registers of Ultrasonic 5 Click driver.
 
 Ultrasonic 5 Registers Settings
 Settings for registers of Ultrasonic 5 Click driver.
 
 Ultrasonic 5 MikroBUS Map
 MikroBUS pin mapping of Ultrasonic 5 Click driver.
 

Functions

void ultrasonic5_cfg_setup (ultrasonic5_cfg_t *cfg)
 Ultrasonic 5 configuration object setup function.
 
err_t ultrasonic5_init (ultrasonic5_t *ctx, ultrasonic5_cfg_t *cfg)
 Ultrasonic 5 initialization function.
 
err_t ultrasonic5_default_cfg (ultrasonic5_t *ctx)
 Ultrasonic 5 default configuration function.
 
err_t ultrasonic5_write_register (ultrasonic5_t *ctx, uint8_t reg, uint8_t data_in)
 Ultrasonic 5 data writing function.
 
err_t ultrasonic5_read_register (ultrasonic5_t *ctx, uint8_t reg, uint8_t *data_out)
 Ultrasonic 5 data reading function.
 
err_t ultrasonic5_check_communication (ultrasonic5_t *ctx)
 Ultrasonic 5 check communication function.
 
void ultrasonic5_set_io1_pin (ultrasonic5_t *ctx)
 Ultrasonic 5 set io1 pin function.
 
void ultrasonic5_clear_io1_pin (ultrasonic5_t *ctx)
 Ultrasonic 5 clear io1 pin function.
 
uint8_t ultrasonic5_get_out4_pin (ultrasonic5_t *ctx)
 Ultrasonic 5 get out4 pin function.
 
err_t ultrasonic5_read_an_pin_value (ultrasonic5_t *ctx, uint16_t *data_out)
 Ultrasonic 5 read AN pin value function.
 
err_t ultrasonic5_read_an_pin_voltage (ultrasonic5_t *ctx, float *data_out)
 Ultrasonic 5 read AN pin voltage level function.
 
err_t ultrasonic5_set_duty_cycle (ultrasonic5_t *ctx, float duty_cycle)
 Ultrasonic 5 sets PWM duty cycle.
 
err_t ultrasonic5_pwm_stop (ultrasonic5_t *ctx)
 Ultrasonic 5 stop PWM module.
 
err_t ultrasonic5_pwm_start (ultrasonic5_t *ctx)
 Ultrasonic 5 start PWM module.
 

Detailed Description

API for configuring and manipulating Ultrasonic 5 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

◆ ultrasonic5_cfg_setup()

void ultrasonic5_cfg_setup ( ultrasonic5_cfg_t * cfg)

Ultrasonic 5 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ultrasonic5_check_communication()

err_t ultrasonic5_check_communication ( ultrasonic5_t * ctx)

Ultrasonic 5 check communication function.

This function checks the communication by reading and verifying the device ID.

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ultrasonic5_clear_io1_pin()

void ultrasonic5_clear_io1_pin ( ultrasonic5_t * ctx)

Ultrasonic 5 clear io1 pin function.

This function clears the IO1 pin to low logic state.

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

◆ ultrasonic5_default_cfg()

err_t ultrasonic5_default_cfg ( ultrasonic5_t * ctx)

Ultrasonic 5 default configuration function.

This function executes a default configuration of Ultrasonic 5 click board.

Parameters
[in]ctx: Click context object. See ultrasonic5_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.

◆ ultrasonic5_get_out4_pin()

uint8_t ultrasonic5_get_out4_pin ( ultrasonic5_t * ctx)

Ultrasonic 5 get out4 pin function.

This function returns the OUT4 pin logic state.

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

◆ ultrasonic5_init()

err_t ultrasonic5_init ( ultrasonic5_t * ctx,
ultrasonic5_cfg_t * cfg )

Ultrasonic 5 initialization function.

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

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

◆ ultrasonic5_pwm_start()

err_t ultrasonic5_pwm_start ( ultrasonic5_t * ctx)

Ultrasonic 5 start PWM module.

This function starts the PWM module output.

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ultrasonic5_pwm_stop()

err_t ultrasonic5_pwm_stop ( ultrasonic5_t * ctx)

Ultrasonic 5 stop PWM module.

This function stops the PWM module output.

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ultrasonic5_read_an_pin_value()

err_t ultrasonic5_read_an_pin_value ( ultrasonic5_t * ctx,
uint16_t * data_out )

Ultrasonic 5 read AN pin value function.

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

Parameters
[in]ctx: Click context object. See ultrasonic5_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.

◆ ultrasonic5_read_an_pin_voltage()

err_t ultrasonic5_read_an_pin_voltage ( ultrasonic5_t * ctx,
float * data_out )

Ultrasonic 5 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 ultrasonic5_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).

◆ ultrasonic5_read_register()

err_t ultrasonic5_read_register ( ultrasonic5_t * ctx,
uint8_t reg,
uint8_t * data_out )

Ultrasonic 5 data reading function.

This function reads data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0xXX - Status bits,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ultrasonic5_set_duty_cycle()

err_t ultrasonic5_set_duty_cycle ( ultrasonic5_t * ctx,
float duty_cycle )

Ultrasonic 5 sets PWM duty cycle.

This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
[in]duty_cycle: PWM duty cycle.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ultrasonic5_set_io1_pin()

void ultrasonic5_set_io1_pin ( ultrasonic5_t * ctx)

Ultrasonic 5 set io1 pin function.

This function sets the IO1 pin to high logic state.

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

◆ ultrasonic5_write_register()

err_t ultrasonic5_write_register ( ultrasonic5_t * ctx,
uint8_t reg,
uint8_t data_in )

Ultrasonic 5 data writing function.

This function writes data to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ultrasonic5_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0xXX - Status bits,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.