src/AduProtocol.c
/**
 * Writes the specified value into the response buffer (and updates the
 * response buffer length accordingly) by formatting the value as a decimal
 * string. The string will contain exactly @p numDigits decimal digits, even if
 * the value could be represented with fewer digits or requires more digits.
 *
 * @pre The response buffer has been zeroed out prior to calling
 * @post The response buffer will be populated with the string value and the
 *       response buffer length updated accordingly
 *
 * @param[in] value The numeric value to write to the response buffer
 * @param[in] numDigits The number of decimal digits to write into the response
 */
Writes the specified value into the response buffer (and updates the
response buffer length accordingly) by formatting the value as a decimal
string. The string will contain exactly @p numDigits decimal digits, even if
the value could be represented with fewer digits or requires more digits.

@pre The response buffer has been zeroed out prior to calling
@post The response buffer will be populated with the string value and the
response buffer length updated accordingly

@param[in] value The numeric value to write to the response buffer
@param[in] numDigits The number of decimal digits to write into the response
Writes the specified value into the response buffer ( and updates the response buffer length accordingly ) by formatting the value as a decimal string . The string will contain exactly @p numDigits decimal digits even if the value could be represented with fewer digits or requires more digits . @pre The response buffer has been zeroed out prior to calling @post The response buffer will be populated with the string value and the response buffer length updated accordingly @param [ in ] value The numeric value to write to the response buffer @param [ in ] numDigits The number of decimal digits to write into the response
static void WriteResponseDecimal(uint16_t value, uint8_t numDigits)
{
    for (int i = numDigits - 1; i >= 0; i--)
    {
        unsigned digit = value % 10;
        value /= 10;
        ResponseBuf[i] = '0' + digit;
    }
    ResponseBufLen = numDigits;
}
static void WriteResponseDecimal ( uint16_t value , uint8_t numDigits ) { for ( int i = numDigits - 1 ; i >= 0 ; i -- ) { unsigned digit = value % 10 ; value /= 10 ; ResponseBuf [ i ] = ' ' + digit ; } ResponseBufLen = numDigits ; }
Writes the specified value into the response buffer (and updates the
 response buffer length accordingly) by formatting the value as a decimal
 string.
Writes the specified value into the response buffer ( and updates the response buffer length accordingly ) by formatting the value as a decimal string .