avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] efficiency of assigning bits


From: Royce & Sharal Pereira
Subject: Re: [avr-gcc-list] efficiency of assigning bits
Date: Fri, 18 Mar 2005 23:28:35 +0530
User-agent: Opera M2(BETA3)/8.0 (Win32, build 7522)

On Fri, 18 Mar 2005 23:07:58 +0530, E. Weddington <address@hidden> wrote:

Ned Konz wrote:


Even better, use higher-level constructs like inline functions (better than macros, because they're type-safe and can do more). In this case, of course, it would be easy to do with a macro.

/* in a header file */

const uint8_t STATUS_LED = 3;

static inline
void turnLedOn(void)
{
PORTA |= _BV(STATUS_LED);
}

/* in your main C source */

#include "myIODefinitions.h"

...
turnLedOn();
...

You're absolutely correct, that's the next step in the progression in putting a layer of abstraction away from the underlying hardware.

Huh? Sorry? English, please!
--Royce.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]