SPI Problem

eric010101

Member
Licensed User
Longtime User
Hi,

I am not sure what's wrong with my code, but the compilier keep giving me error
here is my code:
B4X:
   Dim slaveselect() As DigitalOutput
   Dim mosi As DigitalOutput
   Dim miso As DigitalInput
   Dim clk As DigitalOutput
   mosi= YOYO.OpenDigitalOutput(3,mosi.OP_NORMAL ,True)
   miso= YOYO.OpenDigitalInput(4,miso.IP_FLOATING)
   clk=yoyo.OpenDigitalOutput(5,clk.OP_NORMAL,True)
   'slaveselect(0)=yoyo.OpenDigitalOutput(6,slaveselect(0).OP_NORMAL,True)

    spi=yoyo.OpenSpiMaster(miso,mosi,clk,slaveselect,spi.RATE_125K,False,False)
the error message:
Compiling code. 0.08
Generating R file. 0.00
Compiling generated Java code. Error
B4A line: 117
spi=yoypenSpiMaster(miso,mosi,clk,slaveselect,spi.RATE_125K,False,False)
javac 1.6.0_26
src\sweetek\ioio\experiment\main.java:344: inconvertible types
found : anywheresoftware.b4a.agraham.ioio.B4AIOIO.B4ADigitalOutputWrapper[]
required: ioio.lib.api.DigitalOutput.Spec[][]
mostCurrent._spi.setObject((ioio.lib.api.SpiMaster)(mostCurrent._yoypenSpiMaster((ioio.lib.api.DigitalInput.Spec)(_miso.getObject()),(ioio.lib.api.DigitalOutput.Spec)(_mosi.getObject()),(ioio.lib.api.DigitalOutput.Spec)(_clk.getObject()),(ioio.lib.api.DigitalOutput.Spec[][])(_slaveselect),mostCurrent._spi.RATE_125K,anywheresoftware.b4a.keywords.Common.False,anywheresoftware.b4a.keywords.Common.False)));

^
1 error

I have no clue how to dim a SlaveSelect array.

and the last line, I just can't figure out what is the right statement.
can you help? THNAKS!

Eric
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…