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.
irobotCommand.cpp
00001 #include "irobotCommand.h" 00002 #include "irobotTime.h" 00003 00004 int32_t irobotBaudChange( 00005 const irobotUARTPort_t port, 00006 const irobotBaud_t baud 00007 ){ 00008 int32_t status = ERROR_SUCCESS; 00009 uint8_t packet[OP_BAUD_SIZE]; 00010 00011 packet[0] = OP_BAUD; 00012 packet[1] = (uint8_t)baud; 00013 00014 if(!irobot_IsError(status)){ 00015 irobot_StatusMerge(&status, irobotUARTWriteRaw(port, packet, OP_BAUD_SIZE)); 00016 } 00017 if(!irobot_IsError(status)){ 00018 irobot_StatusMerge(&status, irobotUARTClose(port)); 00019 } 00020 if(!irobot_IsError(status)){ 00021 irobot_StatusMerge(&status, irobotUARTOpen(port, baud)); 00022 irobotDelayMs(50); // delay 50ms 00023 } 00024 00025 return status; 00026 } 00027 00028 int32_t irobotDemoStop( 00029 const irobotUARTPort_t port 00030 ){ 00031 uint8_t packet[OP_DEMO_SIZE]; 00032 00033 packet[0] = OP_DEMO; 00034 packet[1] = 0xFF; /* special case; stop all demos */ 00035 00036 return irobotUARTWriteRaw(port, packet, OP_DEMO_SIZE); 00037 } 00038 00039 int32_t irobotDemo( 00040 const irobotUARTPort_t port, 00041 const irobotDemo_t demo 00042 ){ 00043 uint8_t packet[OP_DEMO_SIZE]; 00044 00045 packet[0] = OP_DEMO; 00046 packet[1] = (uint8_t)demo; 00047 00048 return irobotUARTWriteRaw(port, packet, OP_DEMO_SIZE); 00049 } 00050 00051 int32_t irobotFull( 00052 const irobotUARTPort_t port 00053 ){ 00054 uint8_t packet[OP_FULL_SIZE]; 00055 00056 packet[0] = OP_FULL; 00057 00058 return irobotUARTWriteRaw(port, packet, OP_FULL_SIZE); 00059 } 00060 00061 int32_t irobotSafe( 00062 const irobotUARTPort_t port 00063 ){ 00064 uint8_t packet[OP_SAFE_SIZE]; 00065 00066 packet[0] = OP_SAFE; 00067 00068 return irobotUARTWriteRaw(port, packet, OP_SAFE_SIZE); 00069 } 00070 00071 int32_t irobotStart( 00072 const irobotUARTPort_t port 00073 ){ 00074 uint8_t packet[OP_START_SIZE]; 00075 00076 packet[0] = OP_START; 00077 00078 return irobotUARTWriteRaw(port, packet, OP_START_SIZE); 00079 } 00080
Generated on Wed Jul 13 2022 12:36:27 by
1.7.2