|
upm
1.6.0
Sensor/Actuator repository for libmraa (v1.9.0)
|

Go to the source code of this file.
Data Structures | |
| struct | _rsc_context |
Functions | |
| rsc_context | rsc_init (int bus, int cs_ee_pin, int cs_adc_pin) |
| upm_result_t | rsc_close (rsc_context dev) |
| upm_result_t | rsc_get_sensor_name (rsc_context dev, uint8_t *sensor_name) |
| upm_result_t | rsc_get_sensor_serial_number (rsc_context dev, uint8_t *rsc_number) |
| float | rsc_get_pressure_range (rsc_context dev) |
| float | rsc_get_minimum_pressure (rsc_context dev) |
| PRESSURE_U | rsc_get_pressure_unit (rsc_context dev) |
| PRESSURE_T | rsc_get_pressure_type (rsc_context dev) |
| upm_result_t | rsc_get_initial_adc_values (rsc_context dev, uint8_t *adc_init_values) |
| upm_result_t | rsc_retrieve_coefficients (rsc_context dev) |
| upm_result_t | rsc_setup_adc (rsc_context dev, uint8_t *adc_init_values) |
| float | rsc_get_temperature (rsc_context dev) |
| float | rsc_get_pressure (rsc_context dev) |
| upm_result_t | rsc_set_mode (rsc_context dev, RSC_MODE mode) |
| upm_result_t | rsc_set_data_rate (rsc_context dev, RSC_DATA_RATE dr) |
Typedefs | |
| typedef struct _rsc_context * | rsc_context |
| rsc_context rsc_init | ( | int | bus, |
| int | cs_ee_pin, | ||
| int | cs_adc_pin | ||
| ) |
RSC initialization.
This device supports SPI. The sensor has two chip select pins since there are two ways to access content on the sensor - EEPROM/ADC. We will not be using the SPI CS here because that would work for all SPI operations. Hence, you are expected to initialize any 2 gpio pins for CS by providing the pin numbers.
| bus | SPI bus to use. |
| cs_ee_pin | The CS pin for accessing the EEPROM |
| cs_adc_pin | The CS pin for accessing the ADC |

| upm_result_t rsc_close | ( | rsc_context | dev | ) |
RSC Close function
| dev | The device context |

| upm_result_t rsc_get_sensor_name | ( | rsc_context | dev, |
| uint8_t * | sensor_name | ||
| ) |
This function fills up a character array provided to it with the sensor name that it reads from the EEPROM. NOTE: The length of the array will always have to be RSC_SENSOR_NAME_LEN
| dev | The device context |
| sensor_name | Pointer to a uint8_t array with length RSC_SENSOR_NAME_LEN. This array will be filled up with the sensor name read from the EEPROM. |

| upm_result_t rsc_get_sensor_serial_number | ( | rsc_context | dev, |
| uint8_t * | rsc_number | ||
| ) |
This function fills up a character array provided to it with the sensor serial number that it reads from the EEPROM. NOTE: The length of the array will always have to be RSC_SENSOR_NUMBER_LEN
| dev | The device context |
| sensor_name | Pointer to a uint8_t array with length RSC_SENSOR_NUMBER_LEN. This array will be filled up with the serial number |

| float rsc_get_pressure_range | ( | rsc_context | dev | ) |
This function reads the EEPROM to retrieve the pressure range for the particular RSC device.
| dev | The device context |

| float rsc_get_minimum_pressure | ( | rsc_context | dev | ) |
This function reads the EEPROM to retrieve the minimum pressure that the sensor can read.
| dev | The device context |

| PRESSURE_U rsc_get_pressure_unit | ( | rsc_context | dev | ) |
This function reads the EEPROM to retrieve the pressure units that the pressure is read in
| dev | The device context |

| PRESSURE_T rsc_get_pressure_type | ( | rsc_context | dev | ) |
This function reads the EEPROM to retrieve the sensor pressure type
| dev | The device context |

| upm_result_t rsc_get_initial_adc_values | ( | rsc_context | dev, |
| uint8_t * | adc_init_values | ||
| ) |
This function reads the EEPROM to extract the values with which the ADC has to be initialized. NOTE: The length of the array will always be 4
| dev | The device context |
| adc_init_values | uint8_t pointer to an array containing the initial values for the ADC |

| upm_result_t rsc_retrieve_coefficients | ( | rsc_context | dev | ) |
This function is used to retrieve the coefficients from the EEPROM. Once retrieved, the function updates a 2 dimensional array in the sensor context with the latest values. This function doesn't return the coefficient values.
| dev | The device context |

| upm_result_t rsc_setup_adc | ( | rsc_context | dev, |
| uint8_t * | adc_init_values | ||
| ) |
This function sets up the initial values in the ADC and also sets is to a default data rate - normal with 20 samples per second
| dev | The device context |

| float rsc_get_temperature | ( | rsc_context | dev | ) |
Function to get the compensated temperature as read by the sensor.
| dev | The device context |

| float rsc_get_pressure | ( | rsc_context | dev | ) |
Function to get the compensated pressure as read by the sensor.
| dev | The device context |

| upm_result_t rsc_set_mode | ( | rsc_context | dev, |
| RSC_MODE | mode | ||
| ) |
Function to set the mode of the sensor.
| dev | The device context |
| mode | mode of the sensor |

| upm_result_t rsc_set_data_rate | ( | rsc_context | dev, |
| RSC_DATA_RATE | dr | ||
| ) |
Function to set the data rate of the sensor.
| dev | The device context |
| dr | data rate of the sensor |


| typedef struct _rsc_context * rsc_context |
Device context
1.8.11