It's good, but seems to accomplish the same thing as the current constant does, or am I missing something? The named constant seems more clear. Both ways take up 1 line of code.
Just so you know, I would have suggested to remove the input variables to the init proc and just have "procedure init() is". This would save us an additional 2 bytes ram, and it seems that it is not needed since we have separate set mode procedures. Of course this would affect API. I would not expect this change without you William. SPI and sd card have not been around for a long time, and so I do welcome API changes. SD card has had fairly recent API changes. Then additionally, I would add a constant SPI_MODE_VARIABLE. This constant would go along with the other constants like SPI_MODE_00 in spi_common.jal, so we would have: const SPI_MASTER_HW_MODE = SPI_MODE_VARIABLE -- set spi mode include spi_master_hw alias SPI_MASTER_MODE is SPI_MASTER_HW_MODE -- for sd card lib -- include sd card Then of course, the sd card library could detect the constant: "IF SPI_MASTER_MODE == SPI_MODE_VARIABLE then". The spi hardware library may benefit as well thanks to the constant, in your case, you only use one mode and so mode should be constant. Matt. On May 8, 8:56 pm, William <[email protected]> wrote: > Hi Matt, > > On May 8, 4:32 pm, mattschinkel <[email protected]> wrote: > > > > > -- now include the sd card lib > > const bit SD_ALWAYS_SET_SPI_MODE = TRUE > > include sd_card > > I was suggesting that instead of the libraries looking for > SD_ALWAYS_SET_SPI_MODE, instead, have them look for a function. like > so: > > alias SD_FORCE_SPI_MODE_FUNCTION is spi_master_set_mode_00 > include sd_card > > and inside of sd_card, would be: > > if defined(SD_FORCE_SPI_MODE_FUNCTION) == true then > SD_FORCE_SPI_MODE_FUNCTION() > endif > > Just a thought. > > William -- 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.
