If you wish, you can add your spi_exchange_sw proc to my spi_software lib, then add your name as a author. However, you must add support for other SPI modes. If you don't have time, I will create a new proc.
Here is a sample of how I would include SPI hardware within my main program. See the alias line: include spi_master_hw -- includes the spi library -- define spi inputs/outputs pin_sdi_direction = input -- spi input pin_sdo_direction = output -- spi output pin_sck_direction = output -- spi clock -- spi_init(SPI_MODE_11,SPI_RATE_FOSC_4) -- init spi, choose mode and speed alias spi_master is spi_master_hw And for SPI software, again, see the alias line: alias spi_master_sw_sdi is pin_sdi alias spi_master_sw_sdi_direction is pin_sdi_direction alias spi_master_sw_sdo is pin_sdo alias spi_master_sw_sdo_direction is pin_sdo_direction alias spi_master_sw_sck is pin_sck alias spi_master_sw_sck_direction is pin_sck_direction -- define spi inputs/outputs spi_master_sw_sdi_direction = input -- spi input spi_master_sw_sdo_direction = output -- spi output spi_master_sw_sck_direction = output -- spi clock -- include spi_master_sw spi_init(SPI_MODE_11) -- init spi, choose mode alias spi_master is spi_master_sw On Mar 17, 6:24 am, Henk van Broekhuyzen <[email protected]> wrote: > OK, I will tune-up and submit the diver for the RAM-chip when SPI > drivers are stable and my current project is done. > > Henk > > On 17 mrt, 03:00, mattschinkel <[email protected]> wrote: > > > > Hello Matt, > > > Let us talk here about SPI, and not in the RF12 discussion. > > > Thanks, I didn't want to change the subject in the other discussion. > > > > I saw your code, and you are right about the mode. > > > The mode is not only about speed, but also about clock polarity. > > > I'll add "speed" to my software SPI lib, and also an spi exchange > > procedure. > > > I'll read yours over, maybe I don't understand what you required. > > > > About my other remark: > > > It would be nice if in the labels of the procedures and functions > > > no “_sw” or “_hw” appears for the ones who are compatible. > > > I know that changing labels in the lib for the hardware driver > > > can cause confusion. But still ... > > > "alias" can solve this problem. When including SPI in your main > > program, you can just do: > > alias spi_master is spi_master_sw > > > This way, your other files/libs can call "spi_master" instead of > > "spi_master_sw" or "spi_master_hw". This makes it easy to change > > between the two. > > > It is important to know that someone may decide to use both > > spi_master_hw and spi_master_sw on the same PIC, although there seems > > to be no reason to do so from our point of view. > > > > By the way: are you interested in a driver for the 24lc256 SPI-RAM? > > > I think we're interested in any new libraries :) > > > > If so: mail [email protected] and you get it. I have no time to check > > > for JALLIB style > > > as I am very busy with a radio-link using a RFM70. The RF12B did not > > > pass for > > > the project with Joep. > > > Knowing style guide will help you write good software in the future as > > well. > > > 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.
