Main Site Documentation

Arduino Libraries to NETMF Drivers Converter


#1

As my Topic title say… is that idea can see the light one day ?? … its a wish :grin:

As everyboday know, sensors & modules are the real keys for any Maker to turn his projects easily & quickly … & in Arduino world, there is a thousand of libraries that handles all kind of those beautiful electronic pieces without the need to have a headache to study them to be able to handlethem (no registers to handle manualy to run his fonctions) because the library take care about all that & give u just commands to handle things perfectly (+ a big thanks to his creator)

Unfortunately the NETMF dont support much sensors (i mean Drivers side) like arduino & to avoid that issue i always add a co-processor (Arduino MCU) to handle my sensors & send the feedback to the main microcontroller running with netmf bit if that kind of libraries compiler existe here will be another destiny for Gxx Modules.

I think that is possible but anyway its just an idea that i had in my head & i remember it evertime i see my components in my desk

i already like the powerful features of GHI modules but they can be super flexible if they can support more available modules in the market.

My dreams are not limited to ordinary projects like automated ON/OFF switches or relays Lol

& why there is no #Wishes category in the forum :stuck_out_tongue_closed_eyes:


#3

i cant understand ur reply & his relation with the quoted part !!
Im just a newbie in this things & i only take just my needs form it,… i know im missing lots of tricks & thats why im here :yum:
Maybe u can explan me more ur point of view if u wish :slight_smile:


#4

In that case, we write a device driver for the device. Most persons around here port their drivers (it’s not hard) but I prefer to write mine from scratch (which I don’t often do since apparently, I’m lazy).

That phrase “NETMF don’t support…” is going to cause you to catch flak around here. Instead say, “Does anyone have a NETMF driver for…”

There will never be an Arduino library to NETMF Library compiler; the language is different, the pins are different even the word lengths are different.


#5

NETMF support everything but you just need to find way how to


#6

Lol i just added a little correction to avoid any future misunderstanding! … i mean by “NETMF don’t support…” that there is no Drivers support like arduino that’s all :sweat_smile: maybe i chose the wrong expression but the idea was clear in his context .

Actually its hard for me to say those words because its a private code that belong to his owner only if he publish it here with love (or maybe for sale why not … monetizing the effort)

& the true behind why im not making my own drivers is just because i’m so lazy :stuck_out_tongue_closed_eyes: & don’t have enough time to spend in studying datasheets of the components & to develop my own drivers … that’s why i use an arduino as a co-processor to handle things.

i guess that a compiler is called compiler just to do those kind of conversion with automated process :relieved:

Even the auto-drive cars was just a dream in the past !! so why not an **Arduino C library to NETMF C# code Converter or Compiler ** can’t see the light … & its better to us the actual wheel than inventing it again


#7

Arduino compiles code. Netmf is interpreted not compiled. So you’d need to take Arduino code, either compiled or not, and convert to similar interpreted code. It’s not just a compile-and-join-together problem, it’s an orders of magnitude harder problem. So that’s why there’s a human in the middle :slight_smile:


#8

i dont really mean literally a compiler … maybe just a converter that will translate (interpret) the arduino C code to a compilable C# code as a driver :grin:

In the end its a language machine & not a human language that will need to check the meaning of his sentences to need a human in the middle :joy:

if even this idea dont pass !! so i will go back to earth then & face the reality :sleeping:


#9

Every time someone uses that term I remind them that actually no, someone did reinvent the wheel; and it’s awesome.

Why this is impossible is because the pins used on Arduino don’t fully match those used on NETMF. If you had an Arduino compatable NETMF then it might be possible, however that would be a gross insult to the capabilities of NETMF.

Let me give you an exact example. I had to write a driver for the L6470 dSpin ic. At first I took the Sparkfun Arduino driver and tried porting it to NETMF. This turned out to be a gross mistake. What I should have done was write a native driver from scratch; which I ended up doing anyways (twice now). T’was a bad experience and I would steer anyone away from such endeavors in the future.

Now if you say, “Some one should write a program that will generate a device driver for you given a list of registers and known parameters” then you may get a lot more traction on a project like that.

A code writer for NETMF drivers.


#10

@HAMUZAO

some info about ARDUINO since i played a lot with

Arduino have no pure C but some hybrid C (i’m used after knowed in this forum that Arduino could compile for Nucleo)
mbed used pure C (C++) how need to be (i’m used it with Nucleo and Discovery)

so libraries of arduino could not be just with an converter to translate since arduino used some reserved words (such are PROGMEM etc …) which ones are some registres …

but with samples and Arduino Libraries it will be simple to convert to your own library

but on the iNET there’s a lot of library for .NET Microframework

so there you can find a lot of drivers as you want it


#11

I see the full picture now :stuck_out_tongue_closed_eyes:

And about wheels, there is also this wheel invention


#12

Thank you for the informations & the links too :blush:


#13

I don’t mind writing my own drivers, either. I wrote my own driver for the MCP23017. I found many examples of the driver online for arduino, and even one for .NET, but every last one was written incorrectly. Either it was flawed outright, or not all features supported (IO interrupts, etc), or features not implemented correctly (interleaved mode changes op codes around, etc), or general lack of object oriented programming, etc.

Same thing for Linear ADC IC’s. I wrote my own driver for those as well. I found even Linear’s own published arduino code examples had some bugs in it. :slight_smile:


#14

Yea, that must be because its harder to debug :wink:


#15

Work done Lol … it looks messy but it works perfectly :grin:

i’m not really skilled to handle sensors manually with the hard way by making my own drivers! this is way i do some tricks like this to get some satisfied results.

In this project, the data of the 3 modules (RTC+Lipo gauge+SHT11) are handled with an arduino pro & their results are sent via the serial port to be handled by FezCerb40II & processed depending on the priority of the other tasks (Distance measurement & calculation ) then updating the GLCD with the processed results without having a noticeable stuck while refreshing the visual data.

some bugs are tolerable if they give the right results in the range that we need :wink: … if not then its just a bad library made from someone quickly.


#16

So in this case you can use rs485 serial communication for Master 1 Device (FEZ) - Slave 31 device (other Arduino device with other sensores) up to 2000 m even half duplex so you have centraled controlor.


#17

in most cases i use serial RF modules(BLE/xbee…) instead wires (RS485)

Sensors.DataReceived += new SerialDataReceivedEventHandler(mySensors);
myThreadhandler = new Thread(myThread);

Those two lines are the only reason that make me fall in love with NETMF + Debug feature ofc :joy:

yup i always use little brains to feed the big brain & things go faster :imp: