counter 2.0.0.0
counter.h File Reference

This file contains API for Counter Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  counter_t
 Click ctx object definition. More...
 
struct  counter_cfg_t
 Click configuration structure definition. More...
 

Macros

#define COUNTER_MAP_MIKROBUS(cfg, mikrobus)
 
#define COUNTER_RETVAL   uint8_t
 
#define COUNTER_OK   0x00
 
#define COUNTER_INIT_ERROR   0xFF
 
#define COUNTER_CMD_CLR   0x00
 
#define COUNTER_CMD_WR   0x80
 
#define COUNTER_CMD_LOAD   0xC0
 
#define COUNTER_CMD_RD   0X40
 
#define COUNTER_MDR0   0x08
 
#define COUNTER_MDR1   0x10
 
#define COUNTER_DTR   0x18
 
#define COUNTER_CNTR   0x20
 
#define COUNTER_OTR   0x28
 
#define COUNTER_STR   0x30
 
#define COUNTER_NON_QUAD   0x00
 
#define COUNTER_1X_QUAD   0x01
 
#define COUNTER_2X_QUAD   0x02
 
#define COUNTER_4X_QUAD   0x03
 
#define COUNTER_FREE_RUN   0x00
 
#define COUNTER_SINGLE_COUNT   0x04
 
#define COUNTER_RANGE_LIMIT   0x08
 
#define COUNTER_N_MODULE   0x0C
 
#define COUNTER_INDEX_DISABLED   0x00
 
#define COUNTER_INDEX_LOAD_CNTR   0x10
 
#define COUNTER_INDEX_RESET_CNTR   0x20
 
#define COUNTER_INDEX_LOAD_OTR   0x30
 
#define COUNTER_INDEX_NEG   0x00
 
#define COUNTER_INDEX_POS   0x40
 
#define COUNTER_FILTER_CLOCK_DIV1   0x00
 
#define COUNTER_FILTER_CLOCK_DIV2   0x80
 
#define COUNTER_MODE_32   0x00
 
#define COUNTER_MODE_24   0x01
 
#define COUNTER_MODE_16   0x02
 
#define COUNTER_MODE_8   0x03
 
#define COUNTER_ENABLE   0x00
 
#define COUNTER_DISABLE   0x04
 
#define COUNTER_FLAG_DISABLE   0x00
 
#define COUNTER_FLAG_IDX   0x10
 
#define COUNTER_FLAG_CMP   0x20
 
#define COUNTER_FLAG_BW   0x40
 
#define COUNTER_FLAG_FY   0x80
 

Functions

void counter_cfg_setup (counter_cfg_t *cfg)
 Config Object Initialization function.
 
COUNTER_RETVAL counter_init (counter_t *ctx, counter_cfg_t *cfg)
 Initialization function.
 
void counter_default_cfg (counter_t *ctx)
 Click Default Configuration function.
 
void counter_generic_transfer (counter_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void counter_write_mdr0 (counter_t *ctx, uint8_t settings)
 Writes data into MDR0.
 
void counter_write_mdr1 (counter_t *ctx, uint8_t settings)
 Writes data into MDR1.
 
void counter_write_dtr (counter_t *ctx, uint8_t *buffer)
 Writes data into DTR.
 
void counter_load_cntr (counter_t *ctx)
 Loads CNTR from DTR.
 
void counter_load_otr (counter_t *ctx)
 Loads OTR from CNTR.
 
uint8_t counter_read_mdr0 (counter_t *ctx)
 Reads MDR0.
 
uint8_t counter_read_mdr1 (counter_t *ctx)
 Reads MDR1.
 
int32_t counter_read_otr (counter_t *ctx)
 Reads OTR.
 
int32_t counter_read_cntr (counter_t *ctx)
 Reads CNTR.
 
int32_t counter_read_dtr (counter_t *ctx)
 Reads DTR.
 
uint8_t counter_read_str (counter_t *ctx)
 Reads STR.
 
void counter_clear_mrd0 (counter_t *ctx)
 Clears MDR0.
 
void counter_clead_mrd1 (counter_t *ctx)
 Clears MDR1.
 
void counter_clear_cntr (counter_t *ctx)
 Clears CNTR.
 
void counter_clear_str (counter_t *ctx)
 Clears STR.
 
void counter_initialisation (counter_t *ctx)
 Initialisation of click board with default settings.
 
void counter_init_advanced (counter_t *ctx, uint8_t mdr0_set, uint8_t mdr1_set)
 Initialisation of click board with specific settings.
 
void counter_enable (counter_t *ctx)
 Enables counting ( Software mode )
 
void counter_disable (counter_t *ctx)
 Disables counting ( Software mode )
 
void counter_chip_enable (counter_t *ctx)
 Enables counting ( Hardware mode )
 
void counter_chip_disable (counter_t *ctx)
 Disables counting ( Hardware mode )
 
uint8_t get_int_state (counter_t *ctx)
 Function for get int-pin state.
 

Detailed Description

This file contains API for Counter Click driver.