C/C++ Question Array as method argument in B4R wrapper

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello,

I'd like to create a wrapper around the Adafruit NeoMatrix library that also includes some of the GFX functions that are not yet wrapped in the default rAdafruitGFX wrapper.

One of the functions I want to wrap is drawRGBBitmap which accepts an array of uint16_t as one of its arguments. (See https://github.com/adafruit/Adafrui...3af364f97d15d9d7c5c/Adafruit_SPITFT.h#L87-L88)

I don't know what type to use when creating the wrapper to specify an array of UInt's. I've tried the following versions:
B4X:
void drawRGBBitmap(UInt x, UInt y, UInt* bmp, UInt width, UInt height);
void drawRGBBitmap(UInt x, UInt y, UInt bmp[], UInt width, UInt height);
void drawRGBBitmap(UInt x, UInt y, Array bmp, UInt width, UInt height);

B4X:
Sub Process_Globals
    Public matrix As AdafruitNeoMatrix
    Dim bmp() As UInt = Array As UInt(0x268c, 0x268c, 0xffff, 0xffff, 0xffff)
End Sub

Private Sub AppStart
    matrix.Initialize(32,8,4,matrix.NEO_MATRIX_TOP+matrix.NEO_MATRIX_LEFT+matrix.NEO_MATRIX_COLUMNS+matrix.NEO_MATRIX_ZIGZAG,matrix.NEO_RBG+matrix.NEO_KHZ800)
    matrix.drawRGBBitmap(0,0,bmp,8,8)
    matrix.show()
End Sub

When using this B4R code with any of the above wrapper methods I get an error when calling the drawRGBBitmap function: Cannot cast type: {Type=UInt,Rank=1, RemoteObject=True} to: {Type=UInt,Rank=0, RemoteObject=True}.

Which type do I need to specify in my wrapper to get B4R to accept it as a one-dimensional UInt array?
 
Top