dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_sensors.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef PIOS_SENSOR_H
31 #define PIOS_SENSOR_H
32 
33 #include "pios.h"
34 #include "stdint.h"
35 #include "pios_queue.h"
36 
39  float x;
40  float y;
41  float z;
42  float temperature;
43 };
44 
47  float x;
48  float y;
49  float z;
50  float temperature;
51 };
52 
55  float x;
56  float y;
57  float z;
58 };
59 
62  float x_dot;
63  float y_dot;
64  float z_dot;
65 
66  uint8_t quality;
67 };
68 
71  float range;
72  float velocity;
75 };
76 
79  float temperature;
80  float pressure;
81  float altitude;
82 };
83 
86 {
94 };
95 
97 typedef bool (*PIOS_SENSOR_Callback_t)(void *ctx, void *output,
98  int ms_to_wait, int *next_call);
99 
101 int32_t PIOS_SENSORS_Init();
102 
105 
108  PIOS_SENSOR_Callback_t callback, void *ctx);
109 
112 
114 bool PIOS_SENSORS_GetData(enum pios_sensor_type type, void *buf, int ms_to_wait);
115 
117 void PIOS_SENSORS_SetMaxGyro(int32_t rate);
118 
120 int32_t PIOS_SENSORS_GetMaxGyro();
121 
123 void PIOS_SENSORS_SetSampleRate(enum pios_sensor_type type, uint32_t sample_rate);
124 
127 
130 
133 
134 #endif /* PIOS_SENSOR_H */
void PIOS_SENSORS_SetMaxGyro(int32_t rate)
Set the maximum gyro rate in deg/s.
Definition: pios_sensors.c:162
Main PiOS header to include all the compiled in PiOS options.
int32_t PIOS_SENSORS_GetMaxGyro()
Get the maximum gyro rate in deg/s.
Definition: pios_sensors.c:167
Pios sensor structure for generic mag data.
Definition: pios_sensors.h:61
uint32_t PIOS_SENSORS_GetSampleRate(enum pios_sensor_type type)
Get the sample rate of a sensor (Hz)
Definition: pios_sensors.c:181
pios_sensor_type
The types of sensors this module supports.
Definition: pios_sensors.h:85
bool PIOS_SENSORS_IsRegistered(enum pios_sensor_type type)
Checks if a sensor type is registered with the PIOS_SENSORS interface.
Definition: pios_sensors.c:88
Pios sensor structure for generic rangefinder data.
Definition: pios_sensors.h:70
Pios sensor structure for generic accel data.
Definition: pios_sensors.h:46
int32_t PIOS_SENSORS_Register(enum pios_sensor_type type, struct pios_queue *queue)
Register a queue-based sensor with the PIOS_SENSORS interface.
Definition: pios_sensors.c:82
Pios sensor structure for generic baro data.
Definition: pios_sensors.h:78
int32_t PIOS_SENSORS_Init()
Initialize the PIOS_SENSORS interface.
Definition: pios_sensors.c:51
int32_t PIOS_SENSORS_RegisterCallback(enum pios_sensor_type type, PIOS_SENSOR_Callback_t callback, void *ctx)
Register a callback-based sensor with the PIOS_SENSORS interface.
Definition: pios_sensors.c:68
Pios sensor structure for generic gyro data.
Definition: pios_sensors.h:38
Pios sensor structure for generic mag data.
Definition: pios_sensors.h:54
uint8_t rate
Definition: msp_messages.h:99
uint8_t type
void PIOS_SENSORS_SetSampleRate(enum pios_sensor_type type, uint32_t sample_rate)
Set the sample rate of a sensor (Hz)
Definition: pios_sensors.c:172
bool PIOS_SENSORS_GetMissing(enum pios_sensor_type type)
Determine if an optional but expected sensor is missing.
Definition: pios_sensors.c:200
bool PIOS_SENSORS_GetData(enum pios_sensor_type type, void *buf, int ms_to_wait)
Get the data for a sensor type.
Definition: pios_sensors.c:103
static struct pios_queue * queue
Definition: actuator.c:82
bool(* PIOS_SENSOR_Callback_t)(void *ctx, void *output, int ms_to_wait, int *next_call)
Function that calls into sensor to get data.
Definition: pios_sensors.h:97
void PIOS_SENSORS_SetMissing(enum pios_sensor_type type)
Assert that an optional (non-accel/gyro), but expected sensor is missing.
Definition: pios_sensors.c:191