Bluetooth: Host: Remove printk dependency from settings

Some modules use snprintk to format the settings keys. Unfortunately
snprintk is tied with printk which is very large for some embedded
systems.
To be able to have settings enabled without also enabling printk
support, change creation of settings key strings to use bin2hex, strlen
and strcpy instead.
A utility function to make decimal presentation of a byte value is
added as u8_to_dec in lib/os/dec.c
Add new Kconfig setting BT_SETTINGS_USE_PRINTK

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
This commit is contained in:
Kim Sekkelund 2019-09-13 14:06:22 +02:00 committed by Carles Cufí
commit 0450263393
11 changed files with 215 additions and 29 deletions

View file

@ -170,6 +170,21 @@ size_t bin2hex(const u8_t *buf, size_t buflen, char *hex, size_t hexlen);
*/
size_t hex2bin(const char *hex, size_t hexlen, u8_t *buf, size_t buflen);
/**
* @brief Convert a u8_t into decimal string representation.
*
* Convert a u8_t value into ASCII decimal string representation.
* The string is terminated if there is enough space in buf.
*
* @param[out] buf Address of where to store the string representation.
* @param[in] buflen Size of the storage area for string representation.
* @param[in] value The value to convert to decimal string
*
* @return The length of the converted string (excluding terminator if
* any), or 0 if an error occurred.
*/
u8_t u8_to_dec(char *buf, u8_t buflen, u8_t value);
#endif /* !_ASMLANGUAGE */
/* KB, MB, GB */