COSA
An Object-Oriented Platform for Arduino Programming
BCD.h File Reference
#include "Cosa/Types.h"
Include dependency graph for BCD.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint8_t to_binary (uint8_t value)
 
uint8_t to_bcd (uint8_t value)
 
void to_binary (uint8_t *buf, size_t size)
 
void to_bcd (uint8_t *buf, size_t size)
 

Detailed Description

Version
1.0

License

Copyright (C) 2012-2015, Mikael Patel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Description

Simple two digit BCD convertion functions.

Limitations

Handles only two digit BCD numbers (0..99).

References

[1] AVR204: BCD Arithmetics, Atmel Corporation, 0938B–AVR–01/03.

This file is part of the Arduino Che Cosa project.

Definition in file BCD.h.

Function Documentation

uint8_t to_bcd ( uint8_t  value)
inline

Convert given binary value (0..99) to two digit BCD (0x00..0x99).

Parameters
[in]valueto convert.
Returns
BCD value.

Definition at line 56 of file BCD.h.

void to_bcd ( uint8_t *  buf,
size_t  size 
)
inline

Convert to BCD representation (from binary) per byte (00..99).

Parameters
[in]bufbuffer to convert to BCD.
[in]sizenumber of bytes to convert.

Definition at line 84 of file BCD.h.

uint8_t to_binary ( uint8_t  value)
inline

Convert given two digit BCD (0x00..0x99) to binary value (0..99).

Parameters
[in]valueto convert.
Returns
binary value.

Definition at line 42 of file BCD.h.

void to_binary ( uint8_t *  buf,
size_t  size 
)
inline

Convert to binary representation (from BCD) per byte (00..99).

Parameters
[in]bufbuffer to convert to binary.
[in]sizenumber of bytes to convert.

Definition at line 72 of file BCD.h.