Atmel Software Framework

services/sensors/unit_tests/unit_tests.c File Reference

Sensor platform unit test.

Copyright (C) 2014-2015 Atmel Corporation. All rights reserved.

#include <asf.h>
#include "conf_test.h"

Functions

static void configure_sensor_platform (void)
 Initializes the sensor platform - as this calls the board and sysclock init functions internally, it will also wait for any pending serial transfer(s) to complete before calling sensor_platform_init() and will re-initialize the USART afterwards to ensure no corrupt or lost data. More...
 
int main (void)
 
static void run_sensor_accel_test (const struct test_case *test)
 Unit test to check that the accelerometer works correctly on the Inertial One board using the Sensor Platform library. More...
 
static void run_sensor_compass_test (const struct test_case *test)
 Unit test to check that the compass works correctly on the Inertial One board using the Sensor Platform library. More...
 
static void run_sensor_gyro_test (const struct test_case *test)
 Unit test to check that the gyroscope works correctly on the Inertial One board using the Sensor Platform library. More...
 
static void run_sensor_init_test (const struct test_case *test)
 Unit test to check that the Sensor Platform is initialized correctly with the Intertial One board. More...
 
static void run_sensor_temp_test (const struct test_case *test)
 Unit test to check that the gyroscope internal temperature sensor works correctly on the Inertial One board using the Sensor Platform library. More...
 

Variables

static const usart_serial_options_t usart_serial_options
 

static void configure_sensor_platform ( void  )
static

Initializes the sensor platform - as this calls the board and sysclock init functions internally, it will also wait for any pending serial transfer(s) to complete before calling sensor_platform_init() and will re-initialize the USART afterwards to ensure no corrupt or lost data.

References sensor_platform_init(), stdio_serial_init(), and usart_tx_empty().

Referenced by run_sensor_accel_test(), run_sensor_compass_test(), run_sensor_gyro_test(), run_sensor_init_test(), and run_sensor_temp_test().

static void run_sensor_accel_test ( const struct test_case test)
static

Unit test to check that the accelerometer works correctly on the Inertial One board using the Sensor Platform library.

Parameters
testPointer to the unit test case instance

References sensor_data_t::axis, configure_sensor_platform(), delay_ms, sensor_desc::err, sensor_data_t::scaled, sensor_attach(), sensor_get_acceleration(), SENSOR_TYPE_ACCELEROMETER, test_assert_false, test_assert_true, vector3_magnitude(), vector3_t::x, vector3_t::y, and vector3_t::z.

Referenced by main().

static void run_sensor_compass_test ( const struct test_case test)
static

Unit test to check that the compass works correctly on the Inertial One board using the Sensor Platform library.

Parameters
testPointer to the unit test case instance

References configure_sensor_platform(), delay_ms, sensor_desc::err, sensor_data_t::heading, sensor_data_t::scaled, sensor_attach(), sensor_get_heading(), SENSOR_TYPE_COMPASS, test_assert_false, test_assert_true, vector3_magnitude(), vector3_t::x, vector3_t::y, and vector3_t::z.

Referenced by main().

static void run_sensor_gyro_test ( const struct test_case test)
static

Unit test to check that the gyroscope works correctly on the Inertial One board using the Sensor Platform library.

Parameters
testPointer to the unit test case instance

References configure_sensor_platform(), delay_ms, sensor_desc::err, sensor_data_t::scaled, sensor_attach(), sensor_get_rotation(), SENSOR_TYPE_GYROSCOPE, test_assert_false, and test_assert_true.

Referenced by main().

static void run_sensor_init_test ( const struct test_case test)
static

Unit test to check that the Sensor Platform is initialized correctly with the Intertial One board.

Parameters
testPointer to the unit test case instance

References configure_sensor_platform(), sensor_desc::err, sensor_attach(), SENSOR_TYPE_ACCELEROMETER, SENSOR_TYPE_COMPASS, SENSOR_TYPE_GYROSCOPE, and test_assert_false.

Referenced by main().

static void run_sensor_temp_test ( const struct test_case test)
static

Unit test to check that the gyroscope internal temperature sensor works correctly on the Inertial One board using the Sensor Platform library.

Parameters
testPointer to the unit test case instance

References configure_sensor_platform(), delay_ms, sensor_desc::err, sensor_data_t::scaled, sensor_attach(), sensor_get_temperature(), SENSOR_TYPE_GYROSCOPE, sensor_data_t::temperature, test_assert_false, and test_assert_true.

Referenced by main().

const usart_serial_options_t usart_serial_options
static
Initial value:
= {
.baudrate = CONF_TEST_BAUDRATE,
.charlength = CONF_TEST_CHARLENGTH,
.paritytype = CONF_TEST_PARITY,
.stopbits = CONF_TEST_STOPBITS,
}

Referenced by main().