Sha256: 24a0ff12d9fd023eb29f3e5308b7610335e7baaa4ba34ec428ad36747e8cd0da

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

/* =========================================================================
    CMock - Automatic Mock Generation for C
    ThrowTheSwitch.org
    Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
    SPDX-License-Identifier: MIT
========================================================================= */

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

uint8 UsartModel_CalculateBaudRateRegisterSetting(uint32 masterClock, uint32 baudRate)
{
  uint32 registerSetting = ((masterClock * 10) / (baudRate * 16));

  if ((registerSetting % 10) >= 5)
  {
    registerSetting = (registerSetting / 10) + 1;
  }
  else
  {
    registerSetting /= 10;
  }

  return (uint8)registerSetting;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c
ceedling-1.0.0 vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c