Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
irobotSensorPoll.cpp
00001 #include "irobotOpcode.h" 00002 #include "irobotSensor.h" 00003 #include "irobotSensorPoll.h" 00004 #include "xqueue.h" 00005 00006 int32_t irobotSensorPollSensorGroup6( 00007 const irobotUARTPort_t port, 00008 irobotSensorGroup6_t * const sensorGroup6 00009 ){ 00010 int32_t status = ERROR_SUCCESS; 00011 00012 // initialize communications buffer 00013 uint8_t txBuffer[OP_SENSORS_SIZE]; 00014 uint8_t rxQueueBuffer[SENSOR_SIZE_UPPER_BOUND] = {0x00}; 00015 xqueue_t rxQueue; 00016 xqueue_init(&rxQueue, rxQueueBuffer, SENSOR_SIZE_UPPER_BOUND); 00017 00018 // check for NULL pointer 00019 if(!sensorGroup6){ 00020 return ERROR_INVALID_PARAMETER; 00021 } 00022 00023 // request packet 00024 txBuffer[0] = OP_SENSORS; 00025 txBuffer[1] = SENSOR_GROUP6; 00026 irobot_StatusMerge(&status, irobotUARTWriteRaw(port, txBuffer, OP_SENSORS_SIZE)); 00027 00028 // receive response 00029 if(!irobot_IsError(status)){ 00030 irobot_StatusMerge(&status, irobotUARTRead(port, &rxQueue, SENSOR_GROUP6_SIZE)); 00031 } 00032 00033 // read response 00034 if(!irobot_IsError(status)){ 00035 irobot_StatusMerge(&status, irobotReadSensorGroup6(&rxQueue, sensorGroup6)); 00036 } 00037 00038 return status; 00039 }
Generated on Wed Jul 13 2022 12:36:27 by
1.7.2