LOGGER  Logger
Data Logging using ESP8266
Macros | Functions
pincounter.h File Reference
#include "basetype.h"

Go to the source code of this file.

Macros

#define MAX_PULSE_COUNTS   2
 < version of this module More...
 

Functions

void pincounterInit ()
 Initialize the counting services, call once at system startup.
 
void pincounterDump ()
 Dump the status of the pin counting routines.
 
uint32_t pincounterPulses (uint8_t *unused, uint8_t pinID)
 
void pincounterSetPulsesSinceBoot (uint8_t pinID, uint32_t pulses, uint8_t sensorID)
 
uint32_t pincounterFrequency (uint8_t *, uint8_t pinID)
 
void pincounterCountPulse (uint8_t pulseID)
 

Detailed Description

Services associated with counting the number of times a pin transitions.

Macro Definition Documentation

#define MAX_PULSE_COUNTS   2

< version of this module

Maximum pulse counts that can be stored.

Function Documentation

void pincounterCountPulse ( uint8_t  pulseID)

Routine to call when a pin has transitioned to low. It is safe to call this from an ISR, but, typically it is called from code that polls sensor devices at a higher level.

Parameters
pulseIDpulse ID is used as a table index
uint32_t pincounterFrequency ( uint8_t *  ,
uint8_t  pinID 
)

Report the frequency in thousands of pulses per minute that the counter is observing. There is some smoothing of the frequency by averaging over multiple counts.

The first parameter is to make the call compatible with sensor reading

Parameters
pinIDID of pin to read
Returns
pulses per minute * 100
uint32_t pincounterPulses ( uint8_t *  unused,
uint8_t  pinID 
)

Report the number of pulses seen. Pulses are counted at each falling edge.

Parameters
unusedto make the call compatible with sensor reading
pinIDID of pin to read
Returns
Number of edges seen since boot.
void pincounterSetPulsesSinceBoot ( uint8_t  pinID,
uint32_t  pulses,
uint8_t  sensorID 
)

Set the number of pulses seen since boot.

Parameters
pinIDID of pin to set count for
pulsespulses since boot for the pin
sensorIDsensor that detects these pulses