One solution would be to always set the spi mode, in every procedure that spi is used, for every spi device lib. This would have a small effect on speed, and doesn't seem pleasant for the lib writer.
Matt. On Wednesday, August 27, 2014 10:18:50 AM UTC-4, Matthew Schinkel wrote: > > I've looked at sample 18f67j50_mp3_decoder_vs1053b_sd_card.jal > > Setting the mode in the libs would break this sample unless there is > another solution. > > sram_23k256 uses mode 0,0 > sd_card uses mode 1,1 > mp3_decoder_vs1053b uses mode 0,0 > > It is likely to have two devices using different modes. > > Using 2x SPI libs is not so likely, but may be needed by some. Do we still > need to change the procedure names anyways? We can use alias, as I > suggested. > > Matt. > > On Wednesday, August 27, 2014 3:19:22 AM UTC-4, RobH wrote: >> >> >> Hi Matt, >> >> On 27.08.14 03:56, Matthew Schinkel wrote: >> > > For example in the case of the max7219 libraries: it 'knows' which >> SPI >> > > mode is the one and only right mode for the max7219, so why bother >> the >> > > user of the max7219 with having to find out which SPI mode is the >> right >> > > one? >> > >> > I do agree that we should not bother the user with much of these >> things, >> > and I'd like to see your solution. >> > >> > If I use max7219, as well as another chip that uses a different mode, >> > whatever is included 2nd would override the mode of the first, >> therefore >> > the first included device would not work. How should we work around >> > this? Are there a series of checks we can do to avoid this? >> >> True! Many solutions are a compromise.... ;-) >> When a JAL program uses 2 (or more) similar interfaces it must use 2 (or >> more) separate libraries. In case of SPI we have software, hardware-1 >> and hardware-2, and we have a similar solution for RS232. But we do not >> have alternatives (yet) for 2 LCD screens and other multiple devices. >> But who cares if there is no requirement? >> My max7219 library uses either software SPI or hardware-1 SPI, and I >> think these could be used simultaneously. I did not try. Since max7219 >> modules can be chained (cascaded) it seems to me not very likely that >> one would need two or more chains. >> I think we have no conflict-checks in any of the 'similar' libraries and >> that might also be somewhat overdone. Probably most people with >> 'complicated' projects are clever enough to solve or circumvent >> conflicts between libraries. >> >> Regards, Rob. >> >> >> >> -- >> R. Hamerling, Netherlands --- http://www.robh.nl >> > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/jallib. For more options, visit https://groups.google.com/d/optout.
