Dereference a pointer

This is hopefully the last question on this topic. In C, arrays are zero based and in Julia they are 1 based. Is that going to make a difference when getting values back in a buffer (i.e. Vector) from these ccall function calls?

You need to use the correct syntax on both side to access a specific element but other than that the difference between the two language does not affect how you write the interface code.

OK. I just wanted to double check.

Can you post the code for this? Iā€™ve been meaning to do this to get the accelerometer working for SenseHat.jl.

1 Like

Hi Simon. Iā€™ll try to post what Iā€™m working on to my github. It probably wonā€™t be until Monday (sorry). I saw on your site that it looks like you tried to go down the same route I did with converting the i2c-dev.h to Julia. I got nowhere with that. I was told that Julia didnā€™t have an equivalent to the C union. So, I have just made a shared library out of i2c-dev.h (made it a C file and stripped the ā€œstatic inlineā€ from the front of each function). Then, I made a Julia wrapper module to go against that. I have to come up with a way to deploy it so it will compile the source into the shared library on the source machine. My ideas are kind of trying to think ā€œbig pictureā€ - for different linux based development boards - not just the Pi. Since, they all do GPIO the same through the file system and all do i2c basically the same. You can look at the idea at:

https://github.com/fapplin/Julia_On_Development_Boards

This is something I would like to present at the next Julia conference and maybe present at a Pi conference. Iā€™ll try to get you the code up on this site by the end of the day, but I think you get the gist of what I did.

The files are on my github site. I was trying to make the Julia_I2C module more self-contained, but I just couldnā€™t get it to work. So, what worked is up there.