59 int ms_to_wait,
int *next_call)
117 int32_t time_until = sensor->
next_time - now;
119 if (time_until > ms_to_wait) {
123 if (time_until > 0) {
129 PIOS_Thread_FakeClock_Tick();
140 ms_to_wait -= time_until;
uint32_t PIOS_Thread_Systime(void)
void PIOS_SENSORS_SetMaxGyro(int32_t rate)
Set the maximum gyro rate in deg/s.
int32_t PIOS_SENSORS_GetMaxGyro()
Get the maximum gyro rate in deg/s.
The list of queue handles / callbacks.
bool PIOS_Queue_Receive(struct pios_queue *queuep, void *itemp, uint32_t timeout_ms)
uint32_t PIOS_SENSORS_GetSampleRate(enum pios_sensor_type type)
Get the sample rate of a sensor (Hz)
pios_sensor_type
The types of sensors this module supports.
bool PIOS_SENSORS_IsRegistered(enum pios_sensor_type type)
Checks if a sensor type is registered with the PIOS_SENSORS interface.
static struct PIOS_Sensor sensors[PIOS_SENSOR_NUM]
int32_t PIOS_SENSORS_Register(enum pios_sensor_type type, struct pios_queue *queue)
Register a queue-based sensor with the PIOS_SENSORS interface.
int32_t PIOS_SENSORS_Init()
Initialize the PIOS_SENSORS interface.
static bool PIOS_SENSORS_QueueCallback(void *ctx, void *buf, int ms_to_wait, int *next_call)
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.
PIOS_SENSOR_Callback_t getdata_cb
bool PIOS_Thread_Period_Elapsed(const uint32_t prev_systime, const uint32_t increment_ms)
Determine if a period has elapsed since a datum.
void PIOS_Thread_Sleep(uint32_t time_ms)
void PIOS_SENSORS_SetSampleRate(enum pios_sensor_type type, uint32_t sample_rate)
Set the sample rate of a sensor (Hz)
bool PIOS_SENSORS_GetMissing(enum pios_sensor_type type)
Determine if an optional but expected sensor is missing.
bool PIOS_SENSORS_GetData(enum pios_sensor_type type, void *buf, int ms_to_wait)
Get the data for a sensor type.
static int32_t max_gyro_rate
static struct pios_queue * queue
Generic interface for sensors.
bool(* PIOS_SENSOR_Callback_t)(void *ctx, void *output, int ms_to_wait, int *next_call)
Function that calls into sensor to get data.
#define PIOS_Assert(test)
bool PIOS_Thread_FakeClock_IsActive(void)
void PIOS_SENSORS_SetMissing(enum pios_sensor_type type)
Assert that an optional (non-accel/gyro), but expected sensor is missing.