System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
outMacros.h
00001 #ifndef OUT_MACROS_H 00002 #define OUT_MACROS_H 00003 00004 /******************************* FOR WORKING WITH THE STRING BUFFER ***************************/ 00005 00006 00007 // Macros for working with the strings 00008 #define ADD_SPRINTF_LINE temp[max_charsPerLine-1]=0; padCenter(max_charsPerLine, temp, ' '); // Cetner the string, then add newlines, and add to chunk 00009 #define DIVIDER_LINE padCenter(max_charsPerLine, "", 196); // Generate a line full of divider char 196, add to chunk 00010 #define TITLE(string) padCenter(max_charsPerLine, string, 196); // Generate a title line (centered, surrounded by char 196), add to chunk 00011 #define BLANK_LINE padCenter(max_charsPerLine, "", ' '); // Generate a line full of spaces (blank), add to chunk 00012 00013 00014 /********************************** FOR WORKING WITH CAN MESSAGES ******************************/ 00015 00016 #define SEND_CAN(LEN, ID) \ 00017 msg.len = LEN; \ 00018 msg.id = ID; \ 00019 msg.type = CANData; \ 00020 msg.format = CANStandard; \ 00021 if (!can.txWrite(msg)) op->faultCode |= CAN_FAULT; 00022 00023 template <class Type> 00024 void SEND_CAN_SINGLE(Type Data, int ID) 00025 { 00026 CANMessage msg; 00027 *((Type*)((void*)&msg.data[0])) = Data; 00028 SEND_CAN(sizeof(Type), ID) 00029 } 00030 template <class Type> 00031 void SEND_CAN_PAIR(Type Data1, Type Data2, int ID) 00032 { 00033 CANMessage msg; 00034 *((Type*)((void*)&msg.data[0])) = Data1; 00035 *((Type*)((void*)&msg.data[sizeof(Type)])) = Data2; 00036 SEND_CAN(2*sizeof(Type), ID) 00037 } 00038 00039 #define CAN_SINGLE(DATA, ID) SEND_CAN_SINGLE(op->DATA, ID); 00040 #define CAN_PAIR(DATA1, DATA2, ID) SEND_CAN_PAIR(op->DATA1, op->DATA2, ID); 00041 00042 #endif
Generated on Fri Jul 15 2022 06:07:18 by
1.7.2
