Main Page | Directories | File List | Globals | Examples

bsAdcInputDevice.h File Reference

interface to the analog input device BM7003. More...

#include <bluemelon/types.h>
#include <bluesense/external/bsDeviceInterface.h>
#include <bluesense/external/bsDeviceTable.h>

Defines

#define ADC_INPUT_COUNT   6
#define ADC_MAX_VREF   5000
#define BLUESENSE_ADCIN_MAX_RESOLUTION   10

Typedefs

typedef _bsAdcInputDevice_specificsStruct * bsAdcInputDevice_specifics_t

Functions

DECLSPEC bsAdcInputDevice_specifics_t bsAdcInputDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsAdcInputDevice_requestSetVoltageReference (bsAdcInputDevice_specifics_t adcIn, uint16_t voltageReference)
DECLSPEC uint8_t bsAdcInputDevice_requestSetSampleDelay (bsAdcInputDevice_specifics_t adcIn, uint16_t sampleDelay)
DECLSPEC uint8_t bsAdcInputDevice_requestSetResolution (bsAdcInputDevice_specifics_t adcIn, uint8_t resolution)
DECLSPEC uint8_t bsAdcInputDevice_requestSetConfiguration (bsAdcInputDevice_specifics_t adcIn, uint16_t refVoltage, uint16_t sampleDelay, uint8_t resolution)
DECLSPEC uint8_t bsAdcInputDevice_requestGetConfiguration (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint8_t bsAdcInputDevice_getRequestSetConfigDone (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint8_t bsAdcInputDevice_getRequestGetConfigDone (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint8_t bsAdcInputDevice_configPending (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint16_t bsAdcInputDevice_getCurrentVoltageReference (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint16_t bsAdcInputDevice_getCurrentSampleDelay (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint8_t bsAdcInputDevice_getCurrentResolution (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint32_t bsAdcInputDevice_getSampleCount (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint16_t bsAdcInputDevice_getLastSampledInput (bsAdcInputDevice_specifics_t adcIn, bsAdcInputDevice_portEnum port)
DECLSPEC void bsAdcInputDevice_setTimeOutUs (bsAdcInputDevice_specifics_t adcIn, uint32_t timeOutUs)
DECLSPEC uint32_t bsAdcInputDevice_getTimeOutUs (bsAdcInputDevice_specifics_t adcIn)
void bsAdcInputDevice_reset (bsAdcInputDevice_specifics_t adcIn)
DECLSPEC uint8_t bsAdcInputDevice_getChangedInputsMask (bsAdcInputDevice_specifics_t adcIn)


Detailed Description

interface to the analog input device BM7003.

The BM7003 can be used to convert analogue signals into digital values. The module contains six inputs for different analogue signals. Via software you can configure the resolution of the AD coversion from 1 to 10 bits. The sample rate canbe adjusted in steps of 1 ms to a maximum of 1000 samples per second.


Define Documentation

#define ADC_INPUT_COUNT   6
 

The number of ADC ports of an analog input module

#define ADC_MAX_VREF   5000
 

The maximul allowd vref setting. 5000mV = 5V

#define BLUESENSE_ADCIN_MAX_RESOLUTION   10
 

The resolution can be set between 1 and 10


Typedef Documentation

typedef struct _bsAdcInputDevice_specificsStruct* bsAdcInputDevice_specifics_t
 

This (opaque) structure represents the device specific data of an adcInputDevice

Examples:
analogue_in.c.


Function Documentation

DECLSPEC uint8_t bsAdcInputDevice_configPending bsAdcInputDevice_specifics_t  adcIn  ) 
 

Checks if a configuration is being currently being set or being retrieved

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
1 if busy, 0 if done

DECLSPEC uint8_t bsAdcInputDevice_getChangedInputsMask bsAdcInputDevice_specifics_t  adcIn  ) 
 

In the case of an event getChangedInputsMask returns an 8 bit value indicating which inputs have changed. The mask is set to zero after calling this function. bit 0 set --> input 0 changed

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
the mask

DECLSPEC uint8_t bsAdcInputDevice_getCurrentResolution bsAdcInputDevice_specifics_t  adcIn  ) 
 

Obtain the last retrieved resolution settings.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
the last retrieved resolution settings

DECLSPEC uint16_t bsAdcInputDevice_getCurrentSampleDelay bsAdcInputDevice_specifics_t  adcIn  ) 
 

Obtain the last retrieved sample delay settings.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
the last retrieved sample delay settings

DECLSPEC uint16_t bsAdcInputDevice_getCurrentVoltageReference bsAdcInputDevice_specifics_t  adcIn  ) 
 

Obtain the last retrieved voltage reference settings.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
the last retrieved voltage reference settings

DECLSPEC bsAdcInputDevice_specifics_t bsAdcInputDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

Returns a adc instance from a device info pointer (obtained from the device table).

Returns:
the instance of an adc Interface. Or null if the device is inaccessible (eg. wrong type, not found).
Examples:
analogue_in.c.

DECLSPEC uint16_t bsAdcInputDevice_getLastSampledInput bsAdcInputDevice_specifics_t  adcIn,
bsAdcInputDevice_portEnum  port
 

Retrieve the last received sample at a certain port.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
port the index of the port. Must lie between 0 and ADC_INPUT_COUNT.
See also:
ADC_INPUT_COUNT
Returns:
the last taken sample
Examples:
analogue_in.c.

DECLSPEC uint8_t bsAdcInputDevice_getRequestGetConfigDone bsAdcInputDevice_specifics_t  adcIn  ) 
 

Checks if the configuration request is finished

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
1 if configuration was retrieved, 0 if still busy

DECLSPEC uint8_t bsAdcInputDevice_getRequestSetConfigDone bsAdcInputDevice_specifics_t  adcIn  ) 
 

Checks if the configuration set request is finished

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
1 if request finished, 0 if request still busy

DECLSPEC uint32_t bsAdcInputDevice_getSampleCount bsAdcInputDevice_specifics_t  adcIn  ) 
 

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
returns the total number of samples received since the start of the application

DECLSPEC uint32_t bsAdcInputDevice_getTimeOutUs bsAdcInputDevice_specifics_t  adcIn  ) 
 

Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
Returns:
the time out value in microseconds.

DECLSPEC uint8_t bsAdcInputDevice_requestGetConfiguration bsAdcInputDevice_specifics_t  adcIn  ) 
 

Request to obtain the configuration settings from a adcInput Device.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data

DECLSPEC uint8_t bsAdcInputDevice_requestSetConfiguration bsAdcInputDevice_specifics_t  adcIn,
uint16_t  refVoltage,
uint16_t  sampleDelay,
uint8_t  resolution
 

Request the adcInput device to set a new reference voltage, sample delay and resolution

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
refVoltage the new reference voltage in mv, should lie between 1000 and ADC_MAX_VREF.
See also:
ADC_MAX_VREF
Parameters:
sampleDelay sets the delay in ms (0-65535) between samples.
resolution the sample resolution in bits, should lie between 1 and BLUESENSE_ADCIN_MAX_RESOLUTION.
See also:
BLUESENSE_ADCIN_MAX_RESOLUTION
Examples:
analogue_in.c.

DECLSPEC uint8_t bsAdcInputDevice_requestSetResolution bsAdcInputDevice_specifics_t  adcIn,
uint8_t  resolution
 

Requests the adcInput device to set a new sample resolution

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
resolution the sample resolution in bits, should lie between 1 and BLUESENSE_ADCIN_MAX_RESOLUTION.
See also:
BLUESENSE_ADCIN_MAX_RESOLUTION

DECLSPEC uint8_t bsAdcInputDevice_requestSetSampleDelay bsAdcInputDevice_specifics_t  adcIn,
uint16_t  sampleDelay
 

Requests the adcInput device to set a new sample delay

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
sampleDelay sets the delay in ms (0-65535) between samples.

DECLSPEC uint8_t bsAdcInputDevice_requestSetVoltageReference bsAdcInputDevice_specifics_t  adcIn,
uint16_t  voltageReference
 

Requests the adcInput device to set a new reference voltage

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
voltageReference the new reference voltage in mv, should lie between 1000 and ADC_MAX_VREF.
See also:
ADC_MAX_VREF

void bsAdcInputDevice_reset bsAdcInputDevice_specifics_t  adcIn  ) 
 

Resets the software state. The timeout value is set to the default value. The configuration is requested from the device

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data

DECLSPEC void bsAdcInputDevice_setTimeOutUs bsAdcInputDevice_specifics_t  adcIn,
uint32_t  timeOutUs
 

Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
adcIn a pointer to the adcInputdevice's instance specific data
timeOutUs the value in microseconds which is the maximum duraion between a request and its answer.


Generated on Mon Jan 21 17:51:55 2008 for BlueSense by  doxygen 1.4.4