Atmel Software Framework

xmega/drivers/spi/unit_tests/unit_tests.c File Reference

Unit tests for SPI driver.

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

#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <spi.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>

Functions

static uint8_t get_spi_divisor (void)
 Get SPI module baudrate divisor value. More...
 
int main (void)
 Run SPI driver unit tests. More...
 
static void run_baudrate_set_test (const struct test_case *test)
 Test baudrate setting. More...
 

static uint8_t get_spi_divisor ( void  )
static

Get SPI module baudrate divisor value.

Returns
The divisor value the SPI module is configured to

Referenced by run_baudrate_set_test().

static void run_baudrate_set_test ( const struct test_case test)
static

Test baudrate setting.

This test sets different baudrates and test if the divisor is set as expected.

Parameters
testCurrent test case.

References get_spi_divisor(), spi_enable(), spi_xmega_set_baud_div(), sysclk_enable_peripheral_clock(), and test_assert_true.

Referenced by main().