apps/depreciated/twr_tag_imu/src/main.c
static void sensor_timer_ev_cb(struct os_event *ev) {
    int rc;
    struct sensor *s;
    sensor_type_t sensor_types[] = {SENSOR_TYPE_ACCELEROMETER,
                                    SENSOR_TYPE_GYROSCOPE,
                                    SENSOR_TYPE_MAGNETIC_FIELD,
                                    SENSOR_TYPE_PRESSURE,
                                    SENSOR_TYPE_NONE};
        
    assert(ev != NULL);
    int i=0;
    while (sensor_types[i] != SENSOR_TYPE_NONE)
    {
        s = sensor_mgr_find_next_bytype(sensor_types[i], NULL);
        if (s)
        {
            rc = sensor_read(s,
                             sensor_types[i],
                             &sensor_data_cb,
                             0,
                             OS_TICKS_PER_SEC/10);
            if (rc) console_printf("Error: failed to read sensor\r\n");
        }

        i++;
    }
    
    os_callout_reset(&sensor_callout, IMU_READ_RATE);
}
/*
 * Event callback function for timer events. 
*/
Event callback function for timer events.
Event callback function for timer events .
static void sensor_timer_ev_cb(struct os_event *ev) {
    int rc;
    struct sensor *s;
    sensor_type_t sensor_types[] = {SENSOR_TYPE_ACCELEROMETER,
                                    SENSOR_TYPE_GYROSCOPE,
                                    SENSOR_TYPE_MAGNETIC_FIELD,
                                    SENSOR_TYPE_PRESSURE,
                                    SENSOR_TYPE_NONE};
    assert(ev != NULL);
    int i=0;
    while (sensor_types[i] != SENSOR_TYPE_NONE)
    {
        s = sensor_mgr_find_next_bytype(sensor_types[i], NULL);
        if (s)
        {
            rc = sensor_read(s,
                             sensor_types[i],
                             &sensor_data_cb,
                             0,
                             OS_TICKS_PER_SEC/10);
            if (rc) console_printf("Error: failed to read sensor\r\n");
        }
        i++;
    }
    os_callout_reset(&sensor_callout, IMU_READ_RATE);
}
static void sensor_timer_ev_cb ( struct os_event * ev ) { int rc ; struct sensor * s ; sensor_type_t sensor_types [ ] = { SENSOR_TYPE_ACCELEROMETER , SENSOR_TYPE_GYROSCOPE , SENSOR_TYPE_MAGNETIC_FIELD , SENSOR_TYPE_PRESSURE , SENSOR_TYPE_NONE } ; assert ( ev != NULL ) ; int i = 0 ; while ( sensor_types [ i ] != SENSOR_TYPE_NONE ) { s = sensor_mgr_find_next_bytype ( sensor_types [ i ] , NULL ) ; if ( s ) { rc = sensor_read ( s , sensor_types [ i ] , & sensor_data_cb , 0 , OS_TICKS_PER_SEC / 10 ) ; if ( rc ) console_printf ( " \r \n " ) ; } i ++ ; } os_callout_reset ( & sensor_callout , IMU_READ_RATE ) ; }
Event callback function for timer events.
Event callback function for timer events .