> Question: in this revision, spi_master_hw_set_mode() is inlined, so it
> produces the HEX file as before. But, let's forget the goal of having the
> same HEX, and in this context, should it really be inlined ? I mean, if this
> procedure is called several times, it will consumes a lot of resources (as
> its inlined). My question is, in SPI world, does setting *different* modes
> is something usual within a same lib? If so, should we consider making this
> procedure *not* inlined ? Or, does setting mode is done always the same, as
> sd_card.jal, where mode 11 is always used. In other words, is it possible
> that a lib using SPI and driving one device may set mode 11 and then mode 01
> (for instance) ? If so, what do you think about inlined vs. not inlined ?
> Well, I hope you know what I mean...

SPI bus was created so multiple devices can be used on the same bus.
There happen to be 4 different SPI modes and different devices require
different modes. So, in order to use more then one device mode will
need to be set every time you change devices OR you could use
additional hardware (inverter gates) to make all device modes the
same. I prefer to use software over hardware to reduce cost & board
space.

One case for example: if you wish to store web pages on a sd card +
use enc28j60 for networking. sd card is spi mode 11, enc28j60 is spi
mode 00

Any single device will only need one SPI mode. The above need for
changing SPI modes is real for me, and therefore I cannot use Williams
MAC eeprom ee_25aa02e48.jal library with sd card + enc28j60 unless I
manually set mode in my sample every time I wish to read or write to
25aa02e48. This should be taken care of in the library, not the
sample.

So, for me, spi_master_hw_set_mode() should not be inline unless the
compiler can take care of the if statements through the constant
input.

Personally, I think all devices libraries that use SPI should contain
the following:

   -- put spi into mode 11 for device
   if SD_ALWAYS_SET_SPI_MODE == TRUE then
      spi_master_set_mode(SPI_MODE_11)
   end if

OR

   -- put spi into mode 11 for device
   if SD_ALWAYS_SET_SPI_MODE == TRUE then
      spi_master_set_mode_11()
   end if

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