THE PARTICLE COMPUTER DOCU
                    (program particle + breakout board)                   

 

 

The break out board was designed to give developers an easy interface and option to connect their own sensors or actuators to the particle RF board. This section should give an insight how to write a driver for your own hardware. Using customized hardware is a critical process as you can severely damage the core board.

The example file mysensor.c shows how to write a driver. You can use this file as template for your sensors. Mysensor.c implements an analogue sensor connected to conn11 with the analogue line. The power line in conn2. The driver is included in the example program breakoutex.c .

 

Your driver normally has 5 functions:

MySensorOn()     

MySensorOff()    

int MySensorInit()

int MySensorGet(int* value)

int MySensorPrepare()

 

Those functions should exist and be implemented. The Init functions takes care of the correct settings of the pins. Only set those pins that are interesting to your sensor or device. Never change other pins in your software !! Donít set ports in one step. Always control each pin individually. Further, define a MY_SENSOR xxx for versioning of the file and comment any changes.

The breakout board normally sets the conn pin to:

11-14 analogue

all the remaining to input.

 

So, if you want to use one or more pins as output, do the assignment in your driver file. In this case here, for the mysensor.c driver, the pin conn2 was reset to output by the mysensor.c driver. The sensor uses the conn_11 line for analogue. This has to be set in the MySensorPrepare() function.