Sha256: d1cfc97e71bdded98690506c8d9adf29299bac8ea911911d82ef60354d6192ca

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

/* =========================================================================
    Ceedling - Test-Centered Build System for C
    ThrowTheSwitch.org
    Copyright (c) 2010-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
    SPDX-License-Identifier: MIT
========================================================================= */

#include "unity.h"
#include "Types.h"
#include "UsartBaudRateRegisterCalculator.h"

void setUp(void)
{
}

void tearDown(void)
{
}

void testCalculateBaudRateRegisterSettingShouldCalculateRegisterSettingAppropriately(void)
{
  // BaudRate = MCK / (CD x 16) - per datasheet section 30.6.1.2 "Baud Rate Calculation Example"
  TEST_ASSERT_EQUAL_INT(26, UsartModel_CalculateBaudRateRegisterSetting(48000000, 115200));
  TEST_ASSERT_EQUAL_INT(6,  UsartModel_CalculateBaudRateRegisterSetting(3686400,  38400));
  TEST_ASSERT_EQUAL_INT(23, UsartModel_CalculateBaudRateRegisterSetting(14318180, 38400));
  TEST_ASSERT_EQUAL_INT(20, UsartModel_CalculateBaudRateRegisterSetting(12000000, 38400));
  TEST_ASSERT_EQUAL_INT(13, UsartModel_CalculateBaudRateRegisterSetting(12000000, 56800));
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c
ceedling-1.0.0 examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c