Hi ho

Just a quick query...

I am writing a lot of code to do pin bashing and am getting a lot of:

#define FPGA_POWER_PORT_SELECT          P6SEL
#define FPGA_POWER_PORT_IN              P6IN
#define FPGA_POWER_PORT_OUT             P6OUT
#define FPGA_POWER_PORT_DIRECTION       P6DIR
#define FPGA_POWER_PIN                  (1 << 4)

void
powerOn(void)
{
    FPGA_POWER_PORT_OUT       |=  FPGA_POWER_PIN;
    FPGA_POWER_PORT_DIRECTION |=  FPGA_POWER_PIN;
}

What i would like to do is something like this:

const Msp430Pin l_fpga_power_pin(6, 4);

then:

l_fpga_power_pin = 1;  // set pin high

or:

state = l_fpga_power_pin; // check pin level

or what would be really nice:

l_fpga_power_pin = Z;           // make pin an input!

when i have a lot of pins it gets pretty messy doing it the current way
and from time to time i get the |= and the &=~ the wrong way around etc. etc.

The PIC compiler we also use has all the standard pins already defined so you 
can do:

RB0 = 1;        // set bit 0 of PORTB high

or what ever... it uses bit fields but i am not sure if we could do something 
similar on the MSP430 with GCC and still get efficient code?

as you have probably guessed i am a hardware type who mostly write VHDL!! maybe 
a perl/python/ruby script?

any ideas?

cheers
Tim

____
This communication contains information which is confidential and the copyright 
of Nautronix. 

If you are not the intended recipient of this communication please delete and 
destroy all copies and advise Nautronix immediately. If you are the intended 
recipient of this communication you should not copy, disclose or distribute 
this communication without the prior authority of Nautronix. Any views 
expressed in this Communication are those of the individual sender, except 
where the sender specifically states them to be the views of Nautronix.

Except as required at law, Nautronix does not represent, warrant and/or 
guarantee that the integrity of this communication has been maintained nor that 
the communication is free of errors, virus, interception or interference.


Reply via email to