As Weddington, Eric wrote:

> > They are already well supported by _crc_xmodem_update(), they just
> > need to be told. ;-)

> That's unacceptable as that's an internal function name. We need to
> have a first-class function name that can be used by xmega users.

There are no "first-class" and "second-class" names. ;-)

All the functions of this header file (_crc16_update which once
started the file but uses the "IBM-CRC-16" polynomial,
_crc_xmodem_update, _crc_ccitt_update, and finally
_crc_ibutton_update) have been deliberately chosen to lie in the
implementation namespace so they don't collide with the application
namespace.

Thus, an application could do something like this:

#if defined(__AVR__) && defined(__GNUC__)
#  define crc_ccitt_update(c, v) _crc_ccitt_update(c, v)
#else
inline uint16_t crc_ccitt_update(uint16_t crc, uint8_t data)
{
    data ^= crc & 0xff;
    data ^= data << 4;

    return ((((uint16_t)data << 8) | ((crc & 0xff00) >> 8))
            ^ (uint8_t)(data >> 4)
            ^ ((uint16_t)data << 3));
}
#endif

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to