class Mrm_lid_can_b : public SensorBoard
{
...
/** If sensor not started, start it and wait for 1. message
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
@return - started or not
*/
bool started(uint8_t deviceNumber);
public:
...
/** Add a mrm-ref-can sensor
@param deviceName - device's name
*/
void add(char * deviceName = (char*)"");
/** Calibration, only once after production
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
*/
void calibration(uint8_t deviceNumber = 0);
/** Distance in mm. Warning - the function will take considerable amount of time to execute if sampleCount > 0!
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
@param sampleCount - Number or readings. 40% of the c, with extreme values, will be discarded and the
rest will be averaged. Keeps returning 0 till all the sample is read.
If sampleCount is 0, it will not wait but will just return the last value.
@param sigmaCount - Values outiside sigmaCount sigmas will be filtered out. 1 sigma will leave 68% of the values, 2 sigma 95%, 3 sigma 99.7%.
Therefore, lower sigma number will remove more errornous readings.
@return - distance in mm
*/
uint16_t distance(uint8_t deviceNumber = 0, uint8_t sampleCount = 0, uint8_t sigmaCount = 1);
/** Read CAN Bus message into local variables
@param canId - CAN Bus id
@param data - 8 bytes from CAN Bus message.
@param length - number of data bytes
*/
bool messageDecode(uint32_t canId, uint8_t data[8], uint8_t length);
/** Enable plug and play
@param enable - enable or disable
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
*/
void pnpSet(bool enable = true, uint8_t deviceNumber = 0);
/** Ranging type
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
@param value - long range 0, high speed 1, high accuracy 2
*/
void rangingType(uint8_t deviceNumber, uint8_t value = 0);
/** Analog readings
@param receiverNumberInSensor - always 0
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0.
@return - analog value
*/
uint16_t reading(uint8_t receiverNumberInSensor, uint8_t deviceNumber = 0);
/** Print all readings in a line
*/
void readingsPrint();
/**Test
@param deviceNumber - Device's ordinal number. Each call of function add() assigns a increasing number to the device, starting with 0. 0xFF - all devices.
@param betweenTestsMs - time in ms between 2 tests. 0 - default.
*/
void test(uint8_t deviceNumber = 0xFF, uint16_t betweenTestsMs = 0);
};
Ovdje je popis funkcija iz izvedene klase.
Korisnik može mijenjati i dodavati funkcije iz postojeće bazne klase "SensorBoard", ali mora paziti da je iz te klase izvedeno niz klasa za senzore pa nisu moguće proizvoljne promjene.
Mijenjanje izvedene klase je znatno lakše.
Također može napraviti i potpuno novu izvedenu klasu. Najlakši je način kopirati postojeći kod za "Mrm_lid_can_b", promijeniti ime klase i sve drugo što je potrebno.