Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of WaG by
Diff: display.cpp
- Revision:
- 9:06c0d5737e5c
- Parent:
- 8:d8bc78bda829
- Child:
- 10:ae0a262ba48d
--- a/display.cpp Thu Feb 22 03:10:01 2018 +0000 +++ b/display.cpp Thu Feb 22 04:20:28 2018 +0000 @@ -20,7 +20,6 @@ int bcd[4]; - /* * void initial_setup(DigitalOut SS, int data_length, int frequency); * Description: setup spi data length (in bit), spi frequency, set LED @@ -134,6 +133,31 @@ } /* + * void bin2bcd_array(int num); + * Description: converts a number from binary format to binary coded + * decimal array using sprintf() method + * + * Inputs: + * Parameters: + * int num: number in binary format + * int &bcd: pointer to bcd (binary coded decimal) array + * + * Outputs: + * Returns: void +*/ +void bin2bcd_array(int num, int &bcd) { + char tmp_array[4]; + sprintf(tmp_array, "%d", num); + + int i = 0; + while (tmp_array[i] != '\0') { + bcd[3 - i] = tmp_array[i]; + i++; + } +} + + +/* * char to_command(char input, int place); * Description: *