added example usage

This commit is contained in:
Robin Müller 2021-06-04 14:39:21 +02:00
parent ad820fbe99
commit 070c3f3bbf
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -7,6 +7,8 @@
//! https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format //! https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format
//! Can be used to print out binary numbers in human-readable format. //! Can be used to print out binary numbers in human-readable format.
//! Example usage:
//! sif::printInfo("Status register: " BYTE_TO_BINARY_PATTERN "\n",BYTE_TO_BINARY(0x1f));
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \ #define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \ (byte & 0x80 ? '1' : '0'), \