currently:

port0.dir.pin0 = DIR_INPUT;
port6.dir.pin3 = DIR_OUTPUT;


~d


On Tuesday 10 December 2002 04:40, Tim Wade wrote:
> excellent idea! it would still be nice if you could write:
>
> pin_blah = Z; // make pin an input!
>
> i suspect this would over challenge the language ;-)
>
> > -----Original Message-----
> > From: Dmitry [mailto:di...@eis.ru]
> > Sent: Monday, 9 December 2002 9:58 PM
> > To: mspgcc-users@lists.sourceforge.net
> > Subject: [Mspgcc-users] ports declaration.
> >
> >
> > Folks,
> > I am thinking of changind some io API (not really changing,
> > but extensions).
> > So, will it worth if we declare ports as  structures:
> > --------------------------------------------------------------
> > -------------------------
> > typedef union port {
> >   volatile unsigned char reg_p;
> >   volatile struct {
> >     unsigned __p0:1, __p1:1, __p2:1, __p3:1, __p4:1, __p5:1,
> > __p6:1, __p7:1;
> >   } __pin;
> > } ioport_t;
> >
> > #define pin0    __pin.__p0
> > #define pin1    __pin.__p1
> > #define pin2    __pin.__p2
> > #define pin3    __pin.__p3
> > #define pin4    __pin.__p4
> > #define pin5    __pin.__p5
> > #define pin6    __pin.__p6
> > #define pin7    __pin.__p7
> >
> > typedef struct {
> >   ioport_t in, out,dir,ifg,ies,ie,sel;
> > } xport_t;
> >
> > xport_t port0 asm("0x10");
> > /// and so on...
> > ----------------------------------------------------------------------
> > So, user can write:
> >     port0.out.pin1 = 1;
> >     xxx = port0.in.pin2;
> >     port0.reg_p      = 0x7e;
> > or something.
> >
> > Of course this will not discard existing declarations.
> >
> > If we're going to add this declaration to header files, we
> > need to choose a
> > name for portX. Will 'port0 .. port6' be suitable for it?
> >
> > Or just forget about it?
> >
> > ~d
> >
> >
> > /********************************************************************
> >      ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
> >       `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys
> >       (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
> >     _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
> >    (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
> >  ********************************************************************/
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Mspgcc-users mailing list
> > Mspgcc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
> ____
> 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.
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

-- 
/********************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys 
      (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
   (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
 ********************************************************************/


Reply via email to