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.
Board.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut ind1(LED1); 00004 DigitalOut ind2(LED2); 00005 DigitalOut ind3(LED3); 00006 DigitalOut ind4(LED4); 00007 00008 00009 00010 00011 //***************************************************************************** 00012 // 00013 //! turnLedOn 00014 //! 00015 //! @param ledNum is the LED Number 00016 //! 00017 //! @return none 00018 //! 00019 //! @brief Turns a specific LED on 00020 // 00021 //***************************************************************************** 00022 void turnLedOn(char ledNum) 00023 { 00024 switch(ledNum) 00025 { 00026 case 1: 00027 ind1 = 1; 00028 break; 00029 case 2: 00030 ind2 = 1; 00031 break; 00032 case 3: 00033 ind3 = 1; 00034 break; 00035 case 4: 00036 ind4 = 1; 00037 break; 00038 case 5: 00039 //ind1 = 1; 00040 break; 00041 case 6: 00042 //ind4 = 1; 00043 break; 00044 case 7: 00045 00046 break; 00047 case 8: 00048 00049 break; 00050 } 00051 00052 } 00053 00054 //***************************************************************************** 00055 // 00056 //! turnLedOff 00057 //! 00058 //! @param ledNum is the LED Number 00059 //! 00060 //! @return none 00061 //! 00062 //! @brief Turns a specific LED Off 00063 // 00064 //***************************************************************************** 00065 void turnLedOff(char ledNum) 00066 { 00067 switch(ledNum) 00068 { 00069 case 1: 00070 ind1 = 0; 00071 break; 00072 case 2: 00073 ind2 = 0; 00074 break; 00075 case 3: 00076 ind3 = 0; 00077 break; 00078 case 4: 00079 ind4 = 0; 00080 break; 00081 case 5: 00082 //ind1 = 0; 00083 break; 00084 case 6: 00085 //ind4 = 0; 00086 break; 00087 case 7: 00088 00089 break; 00090 case 8: 00091 00092 break; 00093 } 00094 } 00095 00096 //***************************************************************************** 00097 // 00098 //! toggleLed 00099 //! 00100 //! @param ledNum is the LED Number 00101 //! 00102 //! @return none 00103 //! 00104 //! @brief Toggles a board LED 00105 // 00106 //***************************************************************************** 00107 00108 void toggleLed(char ledNum) 00109 { 00110 //printf("ToggleLed...%i\r\n",ledNum); 00111 switch(ledNum) 00112 { 00113 case 1: 00114 ind1 = !ind1; 00115 break; 00116 case 2: 00117 ind2 = !ind2; 00118 break; 00119 case 3: 00120 ind3 = !ind3; 00121 break; 00122 case 4: 00123 ind4 = !ind4; 00124 break; 00125 case 5: 00126 //ind1 = !ind1; 00127 break; 00128 case 6: 00129 //ind4 = !ind4; 00130 break; 00131 case 7: 00132 00133 break; 00134 case 8: 00135 00136 break; 00137 } 00138 00139 } 00140 00141 /***************************************************************************//** 00142 * @brief GetLEDStatus 00143 * @param none 00144 * @return A 1 byte containing the status of LEDS 00145 ******************************************************************************/ 00146 00147 uint8_t GetLEDStatus() 00148 { 00149 00150 uint8_t status = 0; 00151 00152 if(ind1 == 1) 00153 status |= (1 << 0); 00154 if(ind2 == 1) 00155 status |= (1 << 1); 00156 if(ind3 == 1) 00157 status |= (1 << 2); 00158 if(ind4 == 1) 00159 status |= (1 << 3); 00160 //if(LED145678_PORT_OUT & BIT2) 00161 // status |= (1 << 4); 00162 //if(LED145678_PORT_OUT & BIT3) 00163 // status |= (1 << 5); 00164 //if(LED145678_PORT_OUT & BIT4) 00165 // status |= (1 << 6); 00166 //if(LED145678_PORT_OUT & BIT5) 00167 // status |= (1 << 7); 00168 //printf("Get Status....%i\r\n",status); 00169 return status; 00170 }
Generated on Wed Jul 13 2022 13:30:51 by
1.7.2