Remote TX using NUCLEO_L152RE + AUREL RTX-MID-3V (Sub1GHz module). This SW working in conjunction of the RX part that is: Remote RX using NUCLEO_L152RE + AUREL RTX-MID-3V (Sub1GHz module)
main.cpp@2:a03e59525e5b, 2017-01-08 (annotated)
- Committer:
- emcu
- Date:
- Sun Jan 08 11:29:54 2017 +0000
- Revision:
- 2:a03e59525e5b
- Parent:
- 1:c11167ef6bd1
- Child:
- 3:7dd127b075ed
Improve some we blinks
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emcu | 0:6877fadef7d5 | 1 | /* |
emcu | 0:6877fadef7d5 | 2 | |
emcu | 0:6877fadef7d5 | 3 | TX for remote Thermostat |
emcu | 2:a03e59525e5b | 4 | https://developer.mbed.org/users/emcu/code/0D_NUCLEOL152RE_RemoteIO_TX/file/c11167ef6bd1/main.cpp |
emcu | 0:6877fadef7d5 | 5 | |
emcu | 0:6877fadef7d5 | 6 | By: www.emcu.eu |
emcu | 0:6877fadef7d5 | 7 | Date: 04-January-2017 |
emcu | 0:6877fadef7d5 | 8 | |
emcu | 0:6877fadef7d5 | 9 | NUCLEO-L152RE and AUREL RTX-MID-3V (433.92 MHz - mod. ASK - 3Vcc) |
emcu | 0:6877fadef7d5 | 10 | |
emcu | 0:6877fadef7d5 | 11 | AUREL RTX-MID-3V |
emcu | 0:6877fadef7d5 | 12 | Italian AUREL manual is here: http://www.aurelwireless.com/wp-content/uploads/manuale-uso/650201033G_mu.pdf |
emcu | 0:6877fadef7d5 | 13 | English AUREL manual is here: http://www.aurelwireless.com/en/radiomodem-data-transceivers/ |
emcu | 0:6877fadef7d5 | 14 | https://www.futurashop.it/index.php?route=product/product&filter_name=RTX-MID-3V&product_id=2788 |
emcu | 0:6877fadef7d5 | 15 | |
emcu | 0:6877fadef7d5 | 16 | CONNECTIONS from AUREL RTX-MID-3V to NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 17 | PIN1 Antenna 17cm |
emcu | 0:6877fadef7d5 | 18 | PIN2 GND |
emcu | 0:6877fadef7d5 | 19 | PIN4 TX connected to TX on NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 20 | PIN5 Tx/Rx connected to PA_10 on NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 21 | PIN6 ENABLE connected to PB_3 on NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 22 | PIN7 GND |
emcu | 0:6877fadef7d5 | 23 | PIN8 Analog Out not connected |
emcu | 0:6877fadef7d5 | 24 | PIN9 RX connected to RX on NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 25 | PIN10 VCC connected to 3,3V on NUCLEO L152RE |
emcu | 0:6877fadef7d5 | 26 | |
emcu | 0:6877fadef7d5 | 27 | NOTE: between GND and VCC put a capacitor of 0,1uF and a second capacitor |
emcu | 0:6877fadef7d5 | 28 | of 10uF |
emcu | 0:6877fadef7d5 | 29 | |
emcu | 0:6877fadef7d5 | 30 | |
emcu | 0:6877fadef7d5 | 31 | ********** IMPORTANT IMPORTANT IMPORTANT IMPORTANT ********** |
emcu | 0:6877fadef7d5 | 32 | |
emcu | 0:6877fadef7d5 | 33 | This project use the USART for this reason you must do the below |
emcu | 0:6877fadef7d5 | 34 | modifications on NUCLEO-L152RE, more info are here: |
emcu | 0:6877fadef7d5 | 35 | http://www.emcu.it/NUCLEOevaBoards/U2andL152/U2andL152.html#USART2_for_communication_with_shield_or |
emcu | 0:6877fadef7d5 | 36 | |
emcu | 0:6877fadef7d5 | 37 | Put a jumper on SB62 and on SB63 |
emcu | 0:6877fadef7d5 | 38 | Remove a 0 ohm resistor from SB13 and SB14 |
emcu | 0:6877fadef7d5 | 39 | |
emcu | 0:6877fadef7d5 | 40 | ATTENTION: |
emcu | 0:6877fadef7d5 | 41 | After this modifications, you lost the possibility to use the virtual comm |
emcu | 0:6877fadef7d5 | 42 | to connect the NUCLEO to the PC . |
emcu | 0:6877fadef7d5 | 43 | |
emcu | 0:6877fadef7d5 | 44 | ************************************************************* |
emcu | 0:6877fadef7d5 | 45 | |
emcu | 0:6877fadef7d5 | 46 | |
emcu | 0:6877fadef7d5 | 47 | ********** EXPLANATIONS: |
emcu | 0:6877fadef7d5 | 48 | |
emcu | 0:6877fadef7d5 | 49 | Build two boards one with RX software and another with TX software. |
emcu | 0:6877fadef7d5 | 50 | When you press Blue button (and hold it) |
emcu | 0:6877fadef7d5 | 51 | on the board_TX, the green LED must turn ON, the same |
emcu | 0:6877fadef7d5 | 52 | on the board_RX the green LED must turn ON. |
emcu | 0:6877fadef7d5 | 53 | If you release the Blue button (on the board_TX) the green LED must go OFF |
emcu | 0:6877fadef7d5 | 54 | on both on the boards. |
emcu | 0:6877fadef7d5 | 55 | |
emcu | 0:6877fadef7d5 | 56 | * |
emcu | 0:6877fadef7d5 | 57 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
emcu | 0:6877fadef7d5 | 58 | * of this software and associated documentation files (the "Software"), to deal |
emcu | 0:6877fadef7d5 | 59 | * in the Software without restriction, including without limitation the rights |
emcu | 0:6877fadef7d5 | 60 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
emcu | 0:6877fadef7d5 | 61 | * copies of the Software, and to permit persons to whom the Software is |
emcu | 0:6877fadef7d5 | 62 | * furnished to do so, subject to the following conditions: |
emcu | 0:6877fadef7d5 | 63 | * |
emcu | 0:6877fadef7d5 | 64 | * The above copyright notice and this permission notice shall be included in |
emcu | 0:6877fadef7d5 | 65 | * all copies or substantial portions of the Software. |
emcu | 0:6877fadef7d5 | 66 | * |
emcu | 0:6877fadef7d5 | 67 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
emcu | 0:6877fadef7d5 | 68 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
emcu | 0:6877fadef7d5 | 69 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
emcu | 0:6877fadef7d5 | 70 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
emcu | 0:6877fadef7d5 | 71 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
emcu | 0:6877fadef7d5 | 72 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
emcu | 0:6877fadef7d5 | 73 | * THE SOFTWARE. |
emcu | 0:6877fadef7d5 | 74 | |
emcu | 0:6877fadef7d5 | 75 | |
emcu | 0:6877fadef7d5 | 76 | */ |
emcu | 0:6877fadef7d5 | 77 | |
emcu | 0:6877fadef7d5 | 78 | |
emcu | 0:6877fadef7d5 | 79 | #include "mbed.h" |
emcu | 0:6877fadef7d5 | 80 | |
emcu | 0:6877fadef7d5 | 81 | Serial pc(SERIAL_TX, SERIAL_RX); // tx, rx |
emcu | 0:6877fadef7d5 | 82 | DigitalOut RTX_DIR(PA_10); // 1 == TX 0 == RX |
emcu | 0:6877fadef7d5 | 83 | DigitalOut RTX_Enable(PB_3); // 1 == RTX enable 0 == RTX disable |
emcu | 0:6877fadef7d5 | 84 | |
emcu | 0:6877fadef7d5 | 85 | DigitalOut myled(LED1); // This LED is on NUCLEO-L152RE |
emcu | 0:6877fadef7d5 | 86 | DigitalIn BlueButton(USER_BUTTON); // This is Blue-Button and is on NUCLEO-L153RE |
emcu | 0:6877fadef7d5 | 87 | |
emcu | 0:6877fadef7d5 | 88 | #define Pressed 0 |
emcu | 0:6877fadef7d5 | 89 | #define NotPressed 1 |
emcu | 0:6877fadef7d5 | 90 | #define Enable 1 |
emcu | 0:6877fadef7d5 | 91 | #define Disable 0 |
emcu | 0:6877fadef7d5 | 92 | #define ACK 2 |
emcu | 0:6877fadef7d5 | 93 | #define OK 1 |
emcu | 0:6877fadef7d5 | 94 | #define FAIL 0 |
emcu | 0:6877fadef7d5 | 95 | #define Received 0 |
emcu | 0:6877fadef7d5 | 96 | #define NotReceived 1 |
emcu | 0:6877fadef7d5 | 97 | |
emcu | 0:6877fadef7d5 | 98 | #define ON 1 |
emcu | 0:6877fadef7d5 | 99 | #define OFF 0 |
emcu | 0:6877fadef7d5 | 100 | #define TX 1 |
emcu | 0:6877fadef7d5 | 101 | #define RX 0 |
emcu | 0:6877fadef7d5 | 102 | |
emcu | 0:6877fadef7d5 | 103 | #define Baud 1200 // 9600 |
emcu | 0:6877fadef7d5 | 104 | #define DlyForEndTX 220 // 220 |
emcu | 0:6877fadef7d5 | 105 | #define MaxReTX 40 // 40 |
emcu | 0:6877fadef7d5 | 106 | #define DebTime 200 // Debounce time |
emcu | 0:6877fadef7d5 | 107 | #define WaitBeforeToDoRX 200 // 100 |
emcu | 0:6877fadef7d5 | 108 | |
emcu | 0:6877fadef7d5 | 109 | int Car='\0'; |
emcu | 0:6877fadef7d5 | 110 | int RisultatoRX=FAIL; |
emcu | 0:6877fadef7d5 | 111 | int MemBlueButton=10; |
emcu | 0:6877fadef7d5 | 112 | int MemOkFail=FAIL; |
emcu | 0:6877fadef7d5 | 113 | int MemOK=FAIL; |
emcu | 0:6877fadef7d5 | 114 | int MemOFF=NotReceived; |
emcu | 0:6877fadef7d5 | 115 | int MemON=NotReceived; |
emcu | 0:6877fadef7d5 | 116 | |
emcu | 0:6877fadef7d5 | 117 | int MemBB = NotPressed; |
emcu | 0:6877fadef7d5 | 118 | |
emcu | 0:6877fadef7d5 | 119 | |
emcu | 0:6877fadef7d5 | 120 | int TestRX_Data(void); |
emcu | 0:6877fadef7d5 | 121 | void RTX_StartUp(void); |
emcu | 0:6877fadef7d5 | 122 | void RTX_PowerDown(void); |
emcu | 0:6877fadef7d5 | 123 | void RTX_PowerON(void); |
emcu | 0:6877fadef7d5 | 124 | void RTX_TX(void); |
emcu | 0:6877fadef7d5 | 125 | void RTX_RX(void); |
emcu | 0:6877fadef7d5 | 126 | |
emcu | 0:6877fadef7d5 | 127 | int CarStr[3]; |
emcu | 0:6877fadef7d5 | 128 | int PuntCar = 0; |
emcu | 0:6877fadef7d5 | 129 | |
emcu | 0:6877fadef7d5 | 130 | void callback() { |
emcu | 0:6877fadef7d5 | 131 | // Note: you need to actually read from the serial to clear the RX interrupt |
emcu | 0:6877fadef7d5 | 132 | Car = pc.getc(); |
emcu | 0:6877fadef7d5 | 133 | if (Car == '#' & PuntCar == 0) |
emcu | 0:6877fadef7d5 | 134 | { |
emcu | 0:6877fadef7d5 | 135 | PuntCar = 0; |
emcu | 0:6877fadef7d5 | 136 | CarStr[PuntCar] = Car; |
emcu | 0:6877fadef7d5 | 137 | PuntCar++; |
emcu | 0:6877fadef7d5 | 138 | } |
emcu | 0:6877fadef7d5 | 139 | else if (PuntCar > 0 & PuntCar < 3) |
emcu | 0:6877fadef7d5 | 140 | { |
emcu | 0:6877fadef7d5 | 141 | CarStr[PuntCar] = Car; |
emcu | 0:6877fadef7d5 | 142 | PuntCar++; |
emcu | 0:6877fadef7d5 | 143 | } |
emcu | 0:6877fadef7d5 | 144 | } |
emcu | 0:6877fadef7d5 | 145 | |
emcu | 0:6877fadef7d5 | 146 | |
emcu | 0:6877fadef7d5 | 147 | // |
emcu | 0:6877fadef7d5 | 148 | // MAIN ***************************************************************** |
emcu | 0:6877fadef7d5 | 149 | // |
emcu | 0:6877fadef7d5 | 150 | int main() |
emcu | 0:6877fadef7d5 | 151 | { |
emcu | 0:6877fadef7d5 | 152 | int n=0; |
emcu | 0:6877fadef7d5 | 153 | int Rip=3; |
emcu | 0:6877fadef7d5 | 154 | |
emcu | 0:6877fadef7d5 | 155 | pc.baud(Baud); |
emcu | 0:6877fadef7d5 | 156 | pc.attach(&callback, pc.RxIrq); // It is for reading under Interrupt the |
emcu | 0:6877fadef7d5 | 157 | // RX from USART |
emcu | 0:6877fadef7d5 | 158 | |
emcu | 0:6877fadef7d5 | 159 | // Start Up of the RTX-MID and put it in RX mode |
emcu | 0:6877fadef7d5 | 160 | RTX_StartUp(); |
emcu | 0:6877fadef7d5 | 161 | |
emcu | 0:6877fadef7d5 | 162 | MemBB = Pressed; |
emcu | 0:6877fadef7d5 | 163 | MemOFF = NotReceived; |
emcu | 0:6877fadef7d5 | 164 | MemON = NotReceived; |
emcu | 0:6877fadef7d5 | 165 | |
emcu | 0:6877fadef7d5 | 166 | while (1) |
emcu | 0:6877fadef7d5 | 167 | { |
emcu | 0:6877fadef7d5 | 168 | // Test the status of the Blue button (TX) ************************ |
emcu | 0:6877fadef7d5 | 169 | if ((BlueButton == Pressed) && (MemBB == NotPressed)) |
emcu | 0:6877fadef7d5 | 170 | { |
emcu | 0:6877fadef7d5 | 171 | wait_ms(DebTime); // Debounce |
emcu | 0:6877fadef7d5 | 172 | if (BlueButton == Pressed) |
emcu | 0:6877fadef7d5 | 173 | { |
emcu | 0:6877fadef7d5 | 174 | MemBB = Pressed; |
emcu | 0:6877fadef7d5 | 175 | n=0; |
emcu | 0:6877fadef7d5 | 176 | while (TestRX_Data() != OK) |
emcu | 0:6877fadef7d5 | 177 | { |
emcu | 0:6877fadef7d5 | 178 | RTX_TX(); // RTX-MID on TX mode |
emcu | 0:6877fadef7d5 | 179 | // Send Message |
emcu | 0:6877fadef7d5 | 180 | pc.printf("#1@"); // Send Command ON |
emcu | 0:6877fadef7d5 | 181 | wait_ms(DlyForEndTX); |
emcu | 0:6877fadef7d5 | 182 | RTX_RX(); // RTX-MID on RX mode |
emcu | 0:6877fadef7d5 | 183 | wait_ms(WaitBeforeToDoRX); // 100 |
emcu | 0:6877fadef7d5 | 184 | for (Rip=0; Rip<40; Rip++) // 40 |
emcu | 0:6877fadef7d5 | 185 | { |
emcu | 0:6877fadef7d5 | 186 | if (TestRX_Data() == OK) |
emcu | 0:6877fadef7d5 | 187 | { |
emcu | 0:6877fadef7d5 | 188 | myled = ON; |
emcu | 0:6877fadef7d5 | 189 | goto EndBBpressed; |
emcu | 0:6877fadef7d5 | 190 | // break; |
emcu | 0:6877fadef7d5 | 191 | } |
emcu | 0:6877fadef7d5 | 192 | } |
emcu | 0:6877fadef7d5 | 193 | n++; |
emcu | 0:6877fadef7d5 | 194 | if (n > MaxReTX) |
emcu | 0:6877fadef7d5 | 195 | break; |
emcu | 0:6877fadef7d5 | 196 | } |
emcu | 0:6877fadef7d5 | 197 | } |
emcu | 0:6877fadef7d5 | 198 | // myled = ON; |
emcu | 0:6877fadef7d5 | 199 | wait(2); |
emcu | 1:c11167ef6bd1 | 200 | RTX_StartUp(); |
emcu | 1:c11167ef6bd1 | 201 | wait(1); |
emcu | 0:6877fadef7d5 | 202 | MemBB = NotPressed; |
emcu | 0:6877fadef7d5 | 203 | EndBBpressed: |
emcu | 0:6877fadef7d5 | 204 | RTX_RX(); // RTX-MID on RX mode |
emcu | 0:6877fadef7d5 | 205 | } |
emcu | 0:6877fadef7d5 | 206 | |
emcu | 0:6877fadef7d5 | 207 | |
emcu | 0:6877fadef7d5 | 208 | if ((BlueButton == NotPressed) && (MemBB == Pressed)) |
emcu | 0:6877fadef7d5 | 209 | { |
emcu | 0:6877fadef7d5 | 210 | wait_ms(DebTime); // Debounce |
emcu | 0:6877fadef7d5 | 211 | if (BlueButton == NotPressed) |
emcu | 0:6877fadef7d5 | 212 | { |
emcu | 0:6877fadef7d5 | 213 | MemBB = NotPressed; |
emcu | 0:6877fadef7d5 | 214 | n=0; |
emcu | 0:6877fadef7d5 | 215 | while (TestRX_Data() != ACK) |
emcu | 0:6877fadef7d5 | 216 | { |
emcu | 0:6877fadef7d5 | 217 | RTX_TX(); // RTX-MID on TX mode |
emcu | 0:6877fadef7d5 | 218 | // Send Message |
emcu | 0:6877fadef7d5 | 219 | pc.printf("#2@"); // Send Command OFF |
emcu | 0:6877fadef7d5 | 220 | wait_ms(DlyForEndTX); |
emcu | 0:6877fadef7d5 | 221 | RTX_RX(); // RTX-MID on RX mode |
emcu | 0:6877fadef7d5 | 222 | wait_ms(WaitBeforeToDoRX); // 100 |
emcu | 0:6877fadef7d5 | 223 | for (Rip=0; Rip<40; Rip++) // 40 |
emcu | 0:6877fadef7d5 | 224 | { |
emcu | 0:6877fadef7d5 | 225 | if (TestRX_Data() == ACK) |
emcu | 0:6877fadef7d5 | 226 | { |
emcu | 0:6877fadef7d5 | 227 | myled = OFF; |
emcu | 0:6877fadef7d5 | 228 | goto EndBBnotpressed; |
emcu | 0:6877fadef7d5 | 229 | // break; |
emcu | 0:6877fadef7d5 | 230 | } |
emcu | 0:6877fadef7d5 | 231 | } |
emcu | 0:6877fadef7d5 | 232 | n++; |
emcu | 0:6877fadef7d5 | 233 | if (n > MaxReTX) |
emcu | 0:6877fadef7d5 | 234 | break; |
emcu | 0:6877fadef7d5 | 235 | } |
emcu | 0:6877fadef7d5 | 236 | } |
emcu | 0:6877fadef7d5 | 237 | // myled = OFF; |
emcu | 0:6877fadef7d5 | 238 | wait(2); |
emcu | 1:c11167ef6bd1 | 239 | RTX_StartUp(); |
emcu | 1:c11167ef6bd1 | 240 | wait(1); |
emcu | 0:6877fadef7d5 | 241 | MemBB = Pressed; |
emcu | 0:6877fadef7d5 | 242 | EndBBnotpressed: |
emcu | 0:6877fadef7d5 | 243 | RTX_RX(); // RTX-MID on RX mode |
emcu | 0:6877fadef7d5 | 244 | } |
emcu | 0:6877fadef7d5 | 245 | |
emcu | 0:6877fadef7d5 | 246 | // END Test the status of the Blue button (TX) ************************ |
emcu | 0:6877fadef7d5 | 247 | |
emcu | 0:6877fadef7d5 | 248 | |
emcu | 0:6877fadef7d5 | 249 | |
emcu | 0:6877fadef7d5 | 250 | } |
emcu | 0:6877fadef7d5 | 251 | } |
emcu | 0:6877fadef7d5 | 252 | |
emcu | 0:6877fadef7d5 | 253 | // |
emcu | 0:6877fadef7d5 | 254 | // END MAIN ************************************************************* |
emcu | 0:6877fadef7d5 | 255 | // |
emcu | 0:6877fadef7d5 | 256 | |
emcu | 0:6877fadef7d5 | 257 | |
emcu | 0:6877fadef7d5 | 258 | // |
emcu | 0:6877fadef7d5 | 259 | // Decode Message |
emcu | 0:6877fadef7d5 | 260 | // |
emcu | 0:6877fadef7d5 | 261 | // REMEMBER: |
emcu | 0:6877fadef7d5 | 262 | // before to use this function must put in RX mode the RTX |
emcu | 0:6877fadef7d5 | 263 | // |
emcu | 0:6877fadef7d5 | 264 | int TestRX_Data(void) |
emcu | 0:6877fadef7d5 | 265 | { |
emcu | 0:6877fadef7d5 | 266 | int OkFail=0; // 1==OK==ON 2==ACK==OFF |
emcu | 0:6877fadef7d5 | 267 | |
emcu | 0:6877fadef7d5 | 268 | if (CarStr[0]=='#' & CarStr[1]=='1' & CarStr[2]=='@') |
emcu | 0:6877fadef7d5 | 269 | OkFail=1; // OK==ON |
emcu | 0:6877fadef7d5 | 270 | else if (CarStr[0]=='#' & CarStr[1]=='2' & CarStr[2]=='@') |
emcu | 0:6877fadef7d5 | 271 | OkFail=2; // ACK==OFF |
emcu | 0:6877fadef7d5 | 272 | else; |
emcu | 0:6877fadef7d5 | 273 | |
emcu | 0:6877fadef7d5 | 274 | if (PuntCar >= 3) // Reset the CarStr & PuntCar |
emcu | 0:6877fadef7d5 | 275 | { |
emcu | 0:6877fadef7d5 | 276 | CarStr[0] = '0'; |
emcu | 0:6877fadef7d5 | 277 | CarStr[1] = '1'; |
emcu | 0:6877fadef7d5 | 278 | CarStr[2] = '2'; |
emcu | 0:6877fadef7d5 | 279 | PuntCar = 0; |
emcu | 0:6877fadef7d5 | 280 | } |
emcu | 0:6877fadef7d5 | 281 | |
emcu | 0:6877fadef7d5 | 282 | return OkFail; |
emcu | 0:6877fadef7d5 | 283 | } |
emcu | 0:6877fadef7d5 | 284 | |
emcu | 0:6877fadef7d5 | 285 | void RTX_StartUp(void) |
emcu | 0:6877fadef7d5 | 286 | { |
emcu | 0:6877fadef7d5 | 287 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 288 | wait_ms(10); |
emcu | 0:6877fadef7d5 | 289 | RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 290 | wait_ms(1); |
emcu | 0:6877fadef7d5 | 291 | RTX_DIR = TX; // RTX-MID in TX mode |
emcu | 0:6877fadef7d5 | 292 | wait_ms(1); // Wait the stabilizzation of the transceiver |
emcu | 0:6877fadef7d5 | 293 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 294 | wait_ms(10); |
emcu | 0:6877fadef7d5 | 295 | RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 296 | wait_ms(1); |
emcu | 0:6877fadef7d5 | 297 | RTX_DIR = RX; // RTX-MID in RX mode |
emcu | 0:6877fadef7d5 | 298 | wait_ms(1); // Wait the stabilizzation of the transceiver |
emcu | 0:6877fadef7d5 | 299 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 300 | wait_ms(1); |
emcu | 0:6877fadef7d5 | 301 | RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 302 | wait_ms(1); |
emcu | 0:6877fadef7d5 | 303 | } |
emcu | 0:6877fadef7d5 | 304 | |
emcu | 0:6877fadef7d5 | 305 | void RTX_PowerDown(void) |
emcu | 0:6877fadef7d5 | 306 | { |
emcu | 0:6877fadef7d5 | 307 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 308 | wait_ms(10); |
emcu | 0:6877fadef7d5 | 309 | } |
emcu | 0:6877fadef7d5 | 310 | |
emcu | 0:6877fadef7d5 | 311 | void RTX_PowerON(void) |
emcu | 0:6877fadef7d5 | 312 | { |
emcu | 0:6877fadef7d5 | 313 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 314 | wait_ms(1); |
emcu | 0:6877fadef7d5 | 315 | } |
emcu | 0:6877fadef7d5 | 316 | |
emcu | 0:6877fadef7d5 | 317 | void RTX_TX(void) |
emcu | 0:6877fadef7d5 | 318 | { |
emcu | 0:6877fadef7d5 | 319 | // RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 320 | // wait_ms(10); |
emcu | 0:6877fadef7d5 | 321 | // RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 322 | // wait_ms(1); |
emcu | 0:6877fadef7d5 | 323 | RTX_DIR = TX; // RTX-MID in TX mode |
emcu | 0:6877fadef7d5 | 324 | wait_us(400); // Wait the stabilizzation of the transceiver |
emcu | 0:6877fadef7d5 | 325 | } |
emcu | 0:6877fadef7d5 | 326 | |
emcu | 0:6877fadef7d5 | 327 | void RTX_RX(void) |
emcu | 0:6877fadef7d5 | 328 | { |
emcu | 0:6877fadef7d5 | 329 | // RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 330 | // wait_ms(10); |
emcu | 0:6877fadef7d5 | 331 | // RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 332 | // wait_ms(1); |
emcu | 0:6877fadef7d5 | 333 | // RTX_DIR = TX; // RTX-MID in TX mode |
emcu | 0:6877fadef7d5 | 334 | // wait_ms(1); // Wait the stabilizzation of the transceiver |
emcu | 0:6877fadef7d5 | 335 | RTX_DIR = RX; // RTX-MID in RX mode |
emcu | 0:6877fadef7d5 | 336 | wait_us(40); |
emcu | 0:6877fadef7d5 | 337 | RTX_Enable = Disable; |
emcu | 0:6877fadef7d5 | 338 | wait_us(20); |
emcu | 0:6877fadef7d5 | 339 | RTX_Enable = Enable; |
emcu | 0:6877fadef7d5 | 340 | wait_us(200); |
emcu | 0:6877fadef7d5 | 341 | } |
emcu | 0:6877fadef7d5 | 342 | |
emcu | 0:6877fadef7d5 | 343 |