[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] RFC: avr/bits.h
From: |
Nicolas Schodet |
Subject: |
Re: [avr-libc-dev] RFC: avr/bits.h |
Date: |
Tue, 1 Mar 2005 21:58:17 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
Hello,
About bit manipulations, I had a bad experience last week. On some
registers, bit manipulation can be tricky:
TWCR &= ~(_BV (TWSTA) | _BV (TWSTO));
The interrupt flag bit is read as 1, and writen at 1, this clear the
interrupt bit! A warning could be added to the manual.
Another question about bit manipulation: what is the best way to read 4
bytes into a double word? This could also be included in the bit
manipulation header. This code seems to compile quite bad and generate
useless operations:
uint32_t a;
uint8_t b[4];
a = (uint32_t) b[0] << 24 | (uint32_t) b[1] << 16
| (uint32_t) b[2] << 8 | (uint32_t) b[3] << 0;
Thanks!
Nicolas.
- Re: [avr-libc-dev] RFC: avr/bits.h, (continued)
Re: [avr-libc-dev] RFC: avr/bits.h, Dave Hylands, 2005/03/01
Re: [avr-libc-dev] RFC: avr/bits.h, Joerg Wunsch, 2005/03/01
Re: [avr-libc-dev] RFC: avr/bits.h,
Nicolas Schodet <=
[avr-libc-dev] Addition of a vprintf macro in stdio.h ..? or rather a function ..?, Björn Haase, 2005/03/06
Re: [avr-libc-dev] Addition of a vprintf macro in stdio.h ..? or rather a function ..?, Joerg Wunsch, 2005/03/09
Re: [avr-libc-dev] RFC: avr/bits.h, E. Weddington, 2005/03/01