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: E. Weddington
Subject: Re: [avr-gcc-list] efficiency of assigning bits
Date: Fri, 18 Mar 2005 10:37:58 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

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.

Eric








reply via email to

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