zerocross 2.1.0.0
Zero-Cross Click Driver

API for configuring and manipulating Zero-Cross Click driver. More...

Topics

 Zero-Cross Registers Settings
 Settings for registers of Zero-Cross Click driver.
 
 Zero-Cross MikroBUS Map
 MikroBUS pin mapping of Zero-Cross Click driver.
 

Functions

void zerocross_cfg_setup (zerocross_cfg_t *cfg)
 Zero-Cross configuration object setup function.
 
err_t zerocross_init (zerocross_t *ctx, zerocross_cfg_t *cfg)
 Zero-Cross initialization function.
 
uint8_t zerocross_pin_read (zerocross_t *ctx)
 Zero-Cross pin reading function.
 
void zerocross_get_freq (zerocross_t *ctx, float *freq)
 Zero-Cross frequency reading function.
 

Detailed Description

API for configuring and manipulating Zero-Cross 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

◆ zerocross_cfg_setup()

void zerocross_cfg_setup ( zerocross_cfg_t * cfg)

Zero-Cross configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ zerocross_get_freq()

void zerocross_get_freq ( zerocross_t * ctx,
float * freq )

Zero-Cross frequency reading function.

This function reads the frequency of the Zero-Cross click board.

Parameters
[in]ctx: Click context object. See zerocross_t object definition for detailed explanation.
[out]freq: Read frequency.
Returns
Nothing.
Note
This function is reading the number of ZC events in a span of 1 second to get the frequency.

◆ zerocross_init()

err_t zerocross_init ( zerocross_t * ctx,
zerocross_cfg_t * cfg )

Zero-Cross initialization function.

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

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

◆ zerocross_pin_read()

uint8_t zerocross_pin_read ( zerocross_t * ctx)

Zero-Cross pin reading function.

This function reads the state of the ZC pin of Zero-Cross click board.

Parameters
[in]ctx: Click context object. See zerocross_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.