indexcounter 2.0.0.0
main.c File Reference

Index Counter Click example. More...

#include "board.h"
#include "log.h"
#include "indexcounter.h"

Functions

void log_display (float rpm_val)
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

uint8_t dir_state
 
uint8_t speed_state
 
uint8_t enable_speed = INDEXCOUNTER_SPEED_ENABLE
 
uint8_t n_pole_pairs = 3
 
uint32_t time_cnt = 0
 
uint32_t pulse_ms
 
uint32_t start_timer = 1
 
float speed_rpm
 

Detailed Description

Index Counter Click example.

Description

This application enables usage of Index counter click board which can be used to measure rotational speed.

The demo application is composed of two sections :

Application Init

Initilaziation of GPIO and write log.

Application Task

This is an example which demonstrates the use of the Index Counter click board. This example shows the direction of movement, Rotations Per Minute ( RPM or speed ) of the three pairs of rotating poles positioned in the sensor operating range. Results are being sent to the Usart Terminal where you can track their changes.

note: Additional Functions :

  • void log_display ( float rpm_val ) - The function displays all results and a float value with a comma with two decimal places.
Author
MikroE Team

Function Documentation

◆ application_init()

void application_init ( void )

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ log_display()

void log_display ( float rpm_val)

◆ main()

int main ( void )

Variable Documentation

◆ dir_state

uint8_t dir_state

◆ enable_speed

uint8_t enable_speed = INDEXCOUNTER_SPEED_ENABLE

◆ n_pole_pairs

uint8_t n_pole_pairs = 3

◆ pulse_ms

uint32_t pulse_ms

◆ speed_rpm

float speed_rpm

◆ speed_state

uint8_t speed_state

◆ start_timer

uint32_t start_timer = 1

◆ time_cnt

uint32_t time_cnt = 0