counter 2.0.0.0
|
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. | |
void counter_cfg_setup | ( | counter_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
void counter_chip_disable | ( | counter_t * | ctx | ) |
Disables counting ( Hardware mode )
ctx | Click object. |
@description This function disables counting in hardware mode.
void counter_chip_enable | ( | counter_t * | ctx | ) |
Enables counting ( Hardware mode )
ctx | Click object. |
@description This function enables counting in hardware mode.
void counter_clead_mrd1 | ( | counter_t * | ctx | ) |
Clears MDR1.
ctx | Click object. |
@description This function clears MDR1.
void counter_clear_cntr | ( | counter_t * | ctx | ) |
Clears CNTR.
ctx | Click object. |
@description This function clears CNTR.
void counter_clear_mrd0 | ( | counter_t * | ctx | ) |
Clears MDR0.
ctx | Click object. |
@description This function clears MDR0.
void counter_clear_str | ( | counter_t * | ctx | ) |
Clears STR.
ctx | Click object. |
Resets all status bits except CEN and U/D. In quadrature mode, if the quadrature clocks have been halted, the status bits CY, BW and CMP are not affected by a “CLR STR” command under the following conditions: CY: If CNTR = FFFFFFFF with status bit U/D = 1 BW: If CNTR = 0 with status bit U/D = 0 CMP: If CNTR = DTR In non-quadrature mode the same rules apply if input A is held at logic low.
@description This function clears STR
void counter_default_cfg | ( | counter_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
@description This function executes default configuration for Counter click.
void counter_disable | ( | counter_t * | ctx | ) |
Disables counting ( Software mode )
ctx | Click object. |
@description This function disables counting in software mode.
void counter_enable | ( | counter_t * | ctx | ) |
Enables counting ( Software mode )
ctx | Click object. |
@description This function enables counting in software mode.
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.
ctx | Click object. |
wr_buf | Write data buffer |
wr_len | Number of byte in write data buffer |
rd_buf | Read data buffer |
rd_len | Number of byte in read data buffer |
@description Generic SPI transfer, for sending and receiving packages
COUNTER_RETVAL counter_init | ( | counter_t * | ctx, |
counter_cfg_t * | cfg ) |
Initialization function.
counter | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
void counter_init_advanced | ( | counter_t * | ctx, |
uint8_t | mdr0_set, | ||
uint8_t | mdr1_set ) |
Initialisation of click board with specific settings.
ctx | Click object. |
mdr0_set | Settings for mdr0. |
mdr1_set | Settings for mdr1. |
@description This function initialize of click board with specific settings.
void counter_initialisation | ( | counter_t * | ctx | ) |
Initialisation of click board with default settings.
ctx | Click object. |
MDR0 settings : 4X quad Free run Counter index disabled Filter clock division 1 MDR1 settings : Counter mode 32 Counter disabled Flags disabled
@description This function initialize of click board with default settings.
void counter_load_cntr | ( | counter_t * | ctx | ) |
Loads CNTR from DTR.
ctx | Click object. |
@description This function loads CNTR from DTR, using click object.
void counter_load_otr | ( | counter_t * | ctx | ) |
Loads OTR from CNTR.
ctx | Click object. |
@description This function loads OTR from CNTR, using click object.
int32_t counter_read_cntr | ( | counter_t * | ctx | ) |
Reads CNTR.
ctx | Click object. |
@description This function reads CNTR, using click object.
int32_t counter_read_dtr | ( | counter_t * | ctx | ) |
Reads DTR.
ctx | Click object. |
@description This function reads DTR, using click object.
uint8_t counter_read_mdr0 | ( | counter_t * | ctx | ) |
Reads MDR0.
ctx | Click object. |
@description This function reads MDR0, using click object.
uint8_t counter_read_mdr1 | ( | counter_t * | ctx | ) |
Reads MDR1.
ctx | Click object. |
@description This function reads MDR1, using click object.
int32_t counter_read_otr | ( | counter_t * | ctx | ) |
Reads OTR.
ctx | Click object. |
@description This function reads OTR, using click object.
uint8_t counter_read_str | ( | counter_t * | ctx | ) |
Reads STR.
ctx | Click object. |
The STR is an 8-bit status register which stores count related status information. B0 - Sign bit. 1: negative, 0: positive B1 - Count direction indicator: 0: count down, 1: count up B2 - Power loss indicator latch; set upon power up B3 - Count enable status: 0: counting disabled, 1: counting enabled B4 - Index latch B5 - Compare (CNTR = DTR) latch B6 - Borrow (CNTR underflow) latch B7 - Carry (CNTR overflow) latch
@description This function reads STR, using click object.
void counter_write_dtr | ( | counter_t * | ctx, |
uint8_t * | buffer ) |
Writes data into DTR.
ctx | Click object. |
buffer | Data to be written into DTR. |
@description This function writes data into DTR, using click object.
void counter_write_mdr0 | ( | counter_t * | ctx, |
uint8_t | settings ) |
Writes data into MDR0.
ctx | Click object. |
settings | MDR0 settings. |
@description This function writes data into MDR0, using click object.
void counter_write_mdr1 | ( | counter_t * | ctx, |
uint8_t | settings ) |
Writes data into MDR1.
ctx | Click object. |
settings | MDR1 settings. |
@description This function writes data into MDR1, using click object.
uint8_t get_int_state | ( | counter_t * | ctx | ) |
Function for get int-pin state.
ctx | Click object. |
@description This function gets int-pin state.