|
From: | Dave Hansen |
Subject: | Re: [avr-gcc-list] sbi and cbi |
Date: | Fri, 18 Feb 2005 09:28:19 -0500 |
From: "Royce & Sharal Pereira" <address@hidden>:
Hi Andi,On Fri, 18 Feb 2005 13:01:28 +0700, andi <address@hidden> wrote:Hi, Looks like cbi and sbi (using 'C' not asm) command doesn't exist too :( Andi-----------------------Where have you been? All this has been discussed ad nauseam on this list a month ago ;)
Indeed. Synopsis: It's a good thing! The sbi and cbi macros are non-standard, confusing, and just an all-around bad idea. They were necessary once, but have been redundant and deprecated for years.
To fix old code, change things like "sbi(PORTA,7);" to "PORTA |= (1<<7);". As a temporary measure to fix large volumes of code, create a "legacy.h" header, and define the macros in there:
#define sbi(p,n) (p) |= (1<<(n)) #define cbi(p,n) (p) &= ~(1<<(n))And #include "legacy.h" in the source file. But _only_ in old code: use the more standard syntax in new code.
HTH, -=Dave
[Prev in Thread] | Current Thread | [Next in Thread] |