Logo
MSP Gas Metering Library
gasMeteringLib.h File Reference

Contains all MSP430 Gas Metering Library enums, structs, macros, function and global variables definitions. More...

#include <msp430.h>
#include <stdint.h>
#include <stdbool.h>

Data Structures

union  GASMETERING_Status_Flags
 The following structure contains all status flags used by the library. More...
 
struct  GASMETERING_System_Configuration
 This structure allows user to provide System Configuration parameters. More...
 
struct  GASMETERING_Meter_Configuration
 This structure allows user to provide Gas Meter configuration parameters. More...
 
struct  GASMETERING_Measurement_Configuration
 This structure allows the user to configure firing and capture setting. More...
 
struct  GASMETERING_Algorithms_Configuration
 This structure allows to configure the Time of Flight Algorithm. More...
 
struct  GASMETERING_HAL_functions
 This structure is use to provide the pointer to Gas Metering HAL functions. More...
 
struct  GASMETERING_Algorithms_Results
 This structure is used by GASMETERING_runAlgorithms to return the results for Abs ToF, Delta ToD and Volume Flow Rate calculations. More...
 
struct  GASMETERING_handle
 This hanlde is initialized when calling GASMETERING_configureUltrasonicMeasurement and GASMETERING_intializeAlgorithm. More...
 
struct  GASMETERING_configuration
 This is the Gas Metering configuration structure. All expect a a pointer to this configuration structure. The Application will define this structure via the configuration files of the library. More...
 

Enumerations

enum  GASMETERING_return_code {
  GASMETERING_return_code_configuration_error = 0, GASMETERING_return_code_init_algorithm_error = 30, GASMETERING_return_code_start_measurement_error = 60, GASMETERING_return_code_update_configuration_error = 120,
  GASMETERING_return_code_no_error = 255
}
 This enum lists all possible APIs return codes. More...
 
enum  GASMETERING_HFXT_freq { GASMETERING_HFXT_freq_4MHz = 40, GASMETERING_HFXT_freq_8MHz = 80 }
 Lists supported crystal frequencies for HFXT. More...
 
enum  GASMETERING_low_power_mode {
  GASMETERING_low_power_mode_active = 0, GASMETERING_low_power_mode_0 = LPM0_bits, GASMETERING_low_power_mode_1 = LPM1_bits, GASMETERING_low_power_mode_2 = LPM2_bits,
  GASMETERING_low_power_mode_3 = LPM3_bits
}
 Lists supported crystal frequencies for HFXT. More...
 
enum  GASMETERING_Algorithm_Computation_Mode {
  GASMETERING_Algorithm_Computation_Mode_0 = 0, GASMETERING_Algorithm_Computation_Mode_1 = 1, GASMETERING_Algorithm_Computation_Mode_2 = 2, GASMETERING_Algorithm_Computation_Mode_4 = 4,
  GASMETERING_Algorithm_Computation_Mode_10 = 10, GASMETERING_Algorithm_Computation_Mode_11 = 11, GASMETERING_Algorithm_Computation_Mode_12 = 12, GASMETERING_Algorithm_Computation_Mode_14 = 14
}
 Lists supported computation modes for gas metering. More...
 
enum  GASMETERING_ADC_Sampling_Freq { GASMETERING_ADC_sampling_freq_100_KHz = 1, GASMETERING_ADC_sampling_freq_200_KHz = 2 }
 Lists supported ADC capture frequencies by the library. More...
 
enum  GASMETERING_Signal_Sampling_frequency { GASMETERING_Signal_Sampling_frequency_800_KHz = 8, GASMETERING_Signal_Sampling_frequency_1000_KHz = 10, GASMETERING_Signal_Sampling_frequency_2000_KHz = 20 }
 Lists supported signal sampling frequencies by the library. More...
 
enum  GASMETERING_TX_line_state_after_firing { GASMETERING_TX_line_state_after_firing_low = 0, GASMETERING_TX_line_state_after_firing_high = 1 }
 Lists the options for TX line status after transmission. More...
 

Functions

GASMETERING_return_code GASMETERING_configureUltrasonicMeasurement (GASMETERING_configuration *pLibraryConfig)
 Configures measurement for first time. More...
 
GASMETERING_return_code GASMETERING_startUltrasonicMeasurement (GASMETERING_configuration *pLibraryConfig)
 Triggers a firing and capture. More...
 
GASMETERING_return_code GASMETERING_updateUltrasonicMeasurement (GASMETERING_configuration *pLibraryConfig)
 Updates measurement configuration during run time. More...
 
GASMETERING_return_code GASMETERING_generateLPMDelay (GASMETERING_configuration *pLibraryConfig, uint16_t delayCount, GASMETERING_low_power_mode mode)
 Generates a low power delay. More...
 
GASMETERING_return_code GASMETERING_intializeAlgorithm (GASMETERING_configuration *pLibraryConfig)
 Initializes algorithm. More...
 
GASMETERING_return_code GASMETERING_runAlgorithm (GASMETERING_configuration *pLibraryConfig, GASMETERING_Algorithms_Results *pResults)
 Runs ToF algorithm. More...
 

Variables

volatile GASMETERING_Status_Flags gGASMETERINGFlags
 
volatile uint16_t gGASMETRINGLEASCIFG_DEBUG
 
const char GASMETERING_version []
 

Detailed Description

Contains all MSP430 Gas Metering Library enums, structs, macros, function and global variables definitions.

Enumeration Type Documentation

Lists supported ADC capture frequencies by the library.

Enumerator
GASMETERING_ADC_sampling_freq_100_KHz 

Configures library for 100 KSPS operation mode.

GASMETERING_ADC_sampling_freq_200_KHz 

Configures library for 200 KSPS operation mode.

Lists supported computation modes for gas metering.

Enumerator
GASMETERING_Algorithm_Computation_Mode_0 

Uses computation method 0 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_1 

Uses computation method 1 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_2 

Uses computation method 2 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_4 

Uses computation method 4 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_10 

Uses computation method 10 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_11 

Uses computation method 11 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_12 

Uses computation method 12 for Abs ToF and Delta ToF.

GASMETERING_Algorithm_Computation_Mode_14 

Uses computation method 14 for Abs ToF and Delta ToF.

Lists supported crystal frequencies for HFXT.

Enumerator
GASMETERING_HFXT_freq_4MHz 

Configures library for 4MHz HFXT operation.

GASMETERING_HFXT_freq_8MHz 

Configures library for 8MHz HFXT operation.

Lists supported crystal frequencies for HFXT.

Enumerator
GASMETERING_low_power_mode_active 

Keeps device in active mode.

GASMETERING_low_power_mode_0 

Device will go to low power mode 0.

GASMETERING_low_power_mode_1 

Device will go to low power mode 1.

GASMETERING_low_power_mode_2 

Device will go to low power mode 2.

GASMETERING_low_power_mode_3 

Device will go to low power mode 3.

This enum lists all possible APIs return codes.

Enumerator
GASMETERING_return_code_configuration_error 

This error is returned if a configuration parameter is out of spec.

GASMETERING_return_code_init_algorithm_error 

This error is returned if an error occurs during algorithm initialization

GASMETERING_return_code_start_measurement_error 

This error is returned if an error occurred during the firing or capturing of ultrasonic signal

GASMETERING_return_code_update_configuration_error 

This error is returned if an error occurred during measurement configuration update

GASMETERING_return_code_no_error 

This return code is use to indicate that no error was detected during API execution

Lists supported signal sampling frequencies by the library.

Enumerator
GASMETERING_Signal_Sampling_frequency_800_KHz 

Configures library for 800 KHz signal sampling frequency.

GASMETERING_Signal_Sampling_frequency_1000_KHz 

Configures library for 1 MHz signal sampling frequency.

GASMETERING_Signal_Sampling_frequency_2000_KHz 

Configures library for 2 MHz signal sampling frequency.

Lists the options for TX line status after transmission.

Enumerator
GASMETERING_TX_line_state_after_firing_low 

Configures TX line low after transmission.

GASMETERING_TX_line_state_after_firing_high 

Configures TX line high after transmission.