Hi Matt, guys,

I've just committed a (tested) sample for 18f27j53 directly derived from
jaluino bee sample. It remaps EUSART2 pins (and thus use
serial_hardware2.jal I committed yesterday).

API isn't stable, and I'm not completely satisfied with the way output
functions are mapped:

   RPOR9_RPOR = 6

With constant for function (maybe declared in device files, that's the
subject of this issue), it's more readable:

   RPOR9_RPOR = PPS_TX2_FUNCTION

But PPS isn't symmetric in the way you map pins/function:

  - input function (like RX2): assign RP pin to a function register
  - output function (like TX2): assign a function number to a RP pin

For input function, I wrote procedures to hide function registers this:

   pps_map_rx2dt2(10)   -- remap RX2 on RP10

Usefulness is arguable though, as it just assign a value to a register.
Still I don't like to deal with all register names while coding... :)

But that comes with a price I'm not happy with. Both lines are equivalent
behind the scene:

   - pps_map_rx2dt2(10)
   - RPINR16_RX2DT2 = 10

But procedure usage eats 18 bytes more...

Edit: using "pragma opt const_detect yes", footprint is the same, compiler
resolves both lines the same :)


Ideally I'd like to be able to say:

pps_map_tx2(9)         -- output function
pps_map_rx2dt2(10)   -- input function

This way API is symmetric, I mean you assign pin to function in both cases
("as if").

Or, probably less greedy, alias PPS registers for input function in
something more meaningful:

-- device files
alias PPS_RX2DT2 is RPINR16_RX2DT2
alias PPS_RP9 is RPOR9_RPOR

-- user code
PPS_RX2DT2 = 9 -- RX2 on RP9
PPS_RP9 = PPS_TX2_FUNCTION  --

Still assymetric, but maybe more meaningful. At least you don't have to know
what's the number of the RX2DT2 register (RPINR16...).


Cheers,
Seb


2011/4/16 mattschinkel <[email protected]>

> Can someone please make a sample?
>
> Matt.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to