soundimpact library  v0.5
Sound impact occurence counting from other cog.
Functions
soundimpact.h File Reference

Monitor sound impact occurrences from another cog.

IMPORTANT: This library is only for making monitoring from another cog more convenient. Your application does not need this to check the sensor's output state. For that, all you need is:

int state = input(pin);

The value of pin should be Propeller I/O connected to sensor's SIG pin. The sensor returns a 1 to state if an impact is detected, or 0 if not. More...

#include "simpletools.h"

Go to the source code of this file.

Functions

int * soundImpact_run (int pin)
 Runs the sound impact tracking process in another cog.
void soundImpact_end (int *processID)
 End sound impact tracking process and recovers cog and stack memory for other purposes.
int soundImpact_getCount (void)
 Get number of impacts since last call to soundImpact_getCount.

Detailed Description

Monitor sound impact occurrences from another cog.

IMPORTANT: This library is only for making monitoring from another cog more convenient. Your application does not need this to check the sensor's output state. For that, all you need is:

int state = input(pin);

The value of pin should be Propeller I/O connected to sensor's SIG pin. The sensor returns a 1 to state if an impact is detected, or 0 if not.

Author
Andy Lindsay
Core Usage
Each call to soundImpact_run launches a monitoring loop into another core so that it. track the number of sound impacts during a certain time. The sensor can also be monitored without launching another core by simply checking its output state. See ...Documents/SimpleIDE/Learn/Examples/Devices/Sensor/Sound Impact for examples of both approaches.
Memory Models
Use with CMM or LMM.
Version
0.5

Function Documentation

void soundImpact_end ( int *  processID)

End sound impact tracking process and recovers cog and stack memory for other purposes.

Parameters
processIDprocess identifier returned by soundImpact_run.
int soundImpact_getCount ( void  )

Get number of impacts since last call to soundImpact_getCount.

Returns
number of sound impacts since last call.
int* soundImpact_run ( int  pin)

Runs the sound impact tracking process in another cog.

Parameters
pinPropeller I/O pin connected to sound impact SIG pin.
Returns
*processID pointer to process identifier for use with soundImpact_end.