src/AduProtocol.c
/**
 * Writes the specified value into the response buffer (and updates the
 * response buffer length accordingly) by formatting the value as a binary
 * string. The string will contain exactly @p numDigits binary 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 binary 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 binary
string. The string will contain exactly @p numDigits binary 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 binary 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 binary string . The string will contain exactly @p numDigits binary 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 binary digits to write into the response
static void WriteResponseBinary(uint8_t value, uint8_t numDigits)
{
    for (unsigned i = 0; i < numDigits; i++)
    {
        ResponseBuf[i] = (value & (1 << (numDigits - i - 1))) ? '1' : '0';
    }
    ResponseBufLen = numDigits;
}
static void WriteResponseBinary ( uint8_t value , uint8_t numDigits ) { for ( unsigned i = 0 ; i < numDigits ; i ++ ) { ResponseBuf [ i ] = ( value & ( 1 << ( numDigits - i - 1 ) ) ) ? ' ' : ' ' ; } ResponseBufLen = numDigits ; }
Writes the specified value into the response buffer (and updates the
 response buffer length accordingly) by formatting the value as a binary
 string.
Writes the specified value into the response buffer ( and updates the response buffer length accordingly ) by formatting the value as a binary string .