I wanna connect 3 IR sensors to the CF and for this, we have to create a deck driver which contains the pins at which the sensors are connected. I started by setting up the first sensor as following :
I will solder it at the RX1 pin (the fist analog input) and i have create a function which reads the value of this sensor. However, i don't know what .vid , .pid and .name mean ! Could anyone explain me what that means ?
and if i don't want to test my sensor, Can i remove this line : .test= ......... ?
thank you in advance
Code: Select all
#include "deck.h"
#include "deck_core.h"
void mySensorInit(DeckInfo *info)
{
pinMode(DECK_GPIO_RX1,INPUT); // Set my sensor as an input
}
int SensorValue ()
{
int value=0,
value=digitalRead(DECK_GPIO_RX1); // Reading the value of the sensor
}
static const DeckDriver mySensor_driver = {
.vid = 0,
.pid = 0,
.name = "meMyled",
.usedGpio = DECK_USING_RX1,
.init = mySensorInit,
.test = mySensorTest,
};
DECK_DRIVER(mySensor_driver);