[Top][All Lists]

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

Re: [avr-libc-dev] [RFC] Suggestion on how to rapidly implement supportf

From: Rolf Ebert
Subject: Re: [avr-libc-dev] [RFC] Suggestion on how to rapidly implement supportfor atmega2560-2561
Date: Tue, 20 Sep 2005 21:11:28 +0200
User-agent: Opera M2/8.50 (Win32, build 7700)

Am Tue, 20 Sep 2005 18:59:35 +0200 schrieb Darcy Watkins <address@hidden>:


OK I guess I'll need some feedback on the file.

This is just a minor remark from the Ada case.

We had good experience defining the bit numbers and corresponding masks.

#define ACD        7    // Analog Comparator Disable
#define ACD_MSK   (1<<ACD)
#define ACBG       6    // Analog Comparator Bandgap Select
#define ACBG_MSK  (1<<ACBG)
#define ACO        5    // Analog Compare Output
#define ACO_MSK   (1<<ACO)


This allows code like


After some time we even switched (in AVR-Ada) to define the mask with the bit's name and the bit number is still available with the name extended by _Bit. I.e.

   --  Analog Compare Output
   ACO_Bit                  : constant Bit_Number := 5;
   ACO                      : constant Byte       := 16#20#;
   --  Analog Comparator Bandgap Select
   ACBG_Bit                 : constant Bit_Number := 6;
   ACBG                     : constant Byte       := 16#40#;
   --  Analog Comparator Disable
   ACD_Bit                  : constant Bit_Number := 7;
   ACD                      : constant Byte       := 16#80#;

Just my 0.02 Euro


reply via email to

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