# tmr_utils.c File Reference

Mercury API - utility functions. More...

`#include <stddef.h>`
`#include "osdep.h"`
`#include "tmr_types.h"`
`#include "tmr_utils.h"`

## Functions

int | tm_u8s_per_bits (int bitCount)
void | TMR_bytesToWords (uint16_t count, const uint8_t data[], uint16_t data16[])
void | TMR_wordsToBytes (uint16_t count, const uint16_t data[], uint8_t buf[])

## Detailed Description

Mercury API - utility functions.

Author:
  Nathan Williams

Date:
  12/10/2009

## Function Documentation

int tm_u8s_per_bits | ( | int | bitCount | ) |

Minimum number of bytes required to hold a given number of bits.

Parameters:

  | bitCount | number of bits to hold

Returns:
  Minimum length of bytes that can contain that many bits

void TMR_bytesToWords | ( | uint16_t | count,
|  | const uint8_t | data[],
|  | uint16_t | data16[] |
| ) |  |  |

This function will convert bytes into words format.

Parameters:

  | count,: | the number of bytes to convert
  | data,: | the data to convert into words
  | data16,: | buffer to store the converted data

void TMR_wordsToBytes | ( | uint16_t | count,
|  | const uint16_t | data[],
|  | uint8_t | buf[] |
| ) |  |  |

This function will convert words into bytes format.

Parameters:

  | count,: | the number of words to convert
  | data,: | the data to convert into bytes
  | buf,: | buffer to store the converted data