[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes
From: |
Branislav Katreniak |
Subject: |
Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes |
Date: |
Fri, 9 Sep 2005 15:06:43 +0200 |
User-agent: |
Mutt/1.5.9i |
> >That would also be fine. Any macros would be better than explaining
> >the '&=~'-nightmare.
>
> I support it,
> in fact i already have something like this (for personal usage, since
> it's not in RC1 stage yet)
> If anyone interested in an alpha stage header :
> http://szm.no-ip.com/~szir/gcc/mydata.h
> Maybe we should wait for Eric's version of bit.h.
I found very handy macros that abstract from PORTx, DDRx and PINx
registers and encapsulete them with macros like
#define IOM_INIT_HI( port, mask )
do {DDR##port&=0xff^(mask);PORT##port&=0xff^(mask);} while (0)
#define IOM_INIT_PULL( port, mask )
do {DDR##port&=0xff^(mask); PORT##port|=(mask);} while (0)
//open collector 0
#define IOM_SET_OK_0( port, mask ) DDR##port|=(mask)
//open collector 1
#define IOM_SET_OK_1( port, mask ) DDR##port&=0xff^(mask)
for initializing the port into either of
- hi impedance
- pullup
- zero
- one
for setting logical value in these modes
- zero/one (TTL)
- zero/hi impedance (open collector)
- zero/pullup (open collector with pullup)
and for reading the port value.
I have variants with bit mask, bit number and for the whole port. My
code is not release ready, but I can clean it up. The biggest issue is
with names of macros.
Brano
--
Branislav Katreniak
- [avr-libc-dev] RFD: more avr-libc API changes, Joerg Wunsch, 2005/09/07
- Re: [avr-libc-dev] RFD: more avr-libc API changes, E. Weddington, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Wojtek Kaniewski, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, E. Weddington, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Joerg Wunsch, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Wojtek Kaniewski, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Joerg Wunsch, 2005/09/08
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Wojtek Kaniewski, 2005/09/08
- Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes, Szikra Istvan, 2005/09/09
- Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes,
Branislav Katreniak <=
- Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes, Joerg Wunsch, 2005/09/09
- Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes, E. Weddington, 2005/09/09
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Rolf Ebert, 2005/09/10
- RE: [avr-libc-dev] RFD: more avr-libc API changes, Darcy Watkins, 2005/09/12
- RE: [avr-libc-dev] RFD: more avr-libc API changes, Darcy Watkins, 2005/09/09
- Re: [avr-libc-dev] RFD: more avr-libc API changes, Wojtek Kaniewski, 2005/09/08
Re: [avr-gcc-list] Re: [avr-libc-dev] RFD: more avr-libc API changes, Matthew MacClary, 2005/09/08