189 | | The function processControlStruct updates the node with the parameters in the warpnodeControl struct. |
| 189 | The function processControlStruct updates the node with the parameters in the warpnodeControl struct: |
| 190 | {{{ |
| 191 | void processControlStruct(warpnodeControl* ctrlStruct) |
| 192 | { |
| 193 | //xil_printf("Processing Control Struct\r\n"); |
| 194 | //Interpret the control struct's modulation rate value |
| 195 | switch(ctrlStruct->modOrder) |
| 196 | { |
| 197 | /*** Non-autorate version ***/ |
| 198 | case 0x1: //BPSK |
| 199 | pktFullRate = HDR_FULLRATE_BPSK; |
| 200 | warp_userio_lcd_printline("Mod order: BPSK ", 16, 8, 1); |
| 201 | break; |
| 202 | case 0x2: //QPSK |
| 203 | pktFullRate = HDR_FULLRATE_QPSK; |
| 204 | warp_userio_lcd_printline("Mod order: QPSK ", 16, 8, 1); |
| 205 | break; |
| 206 | case 0x4: //16-QAM |
| 207 | pktFullRate = HDR_FULLRATE_QAM_16; |
| 208 | warp_userio_lcd_printline("Mod order: 16QAM", 16, 8, 1); |
| 209 | break; |
| 210 | case 0x6: //64-QAM |
| 211 | pktFullRate = HDR_FULLRATE_QAM_64; |
| 212 | warp_userio_lcd_printline("Mod order: 64QAM", 16, 8, 1); |
| 213 | break; |
| 214 | /*******************/ |
| 215 | default: |
| 216 | //xil_printf("Invalid Mod order - Recieved: %x\r\n", ctrlStruct->modOrder); |
| 217 | //Invalid value, so ignore it and leave txFulrate as-is |
| 218 | break; |
| 219 | } |
| 220 | |
| 221 | //Set the transmit power for both radios |
| 222 | warpphy_setTxPower(ctrlStruct->txPower); |
| 223 | //xil_printf("Power changed to %d\r\n", ctrlStruct->txPower); |
| 224 | |
| 225 | //Use the circle of LEDs as a Tx power indicator |
| 226 | warp_userioboard_set_leds((1<<((8+(ctrlStruct->txPower))/8))-1); |
| 227 | unsigned char charsToPrint[16]; |
| 228 | snprintf(charsToPrint, 16, "Tx Pwr: 0x%2x ", (ctrlStruct->txPower)); |
| 229 | |
| 230 | //xil_printf("Tx Power changed to: %x\r\n", ctrlStruct->txPower); |
| 231 | |
| 232 | warp_userio_lcd_printline(charsToPrint, 16, 6, 1); |
| 233 | |
| 234 | //Set the center frequency of both radios |
| 235 | // Values 1-14 are 2.4GHz channels |
| 236 | // Values 15-37 are 5GHz channels |
| 237 | // Any other value is invalid and ignored |
| 238 | if( ((ctrlStruct->channel) > 0) && ((ctrlStruct->channel) <= 37) ) |
| 239 | { |
| 240 | if((ctrlStruct->channel) <= 14) |
| 241 | warpphy_setChannel(GHZ_2, ctrlStruct->channel); |
| 242 | else |
| 243 | warpphy_setChannel(GHZ_5, (ctrlStruct->channel) - 14); |
| 244 | } |
| 245 | |
| 246 | snprintf(charsToPrint, 16, "Channel: %2d ", (ctrlStruct->channel)); |
| 247 | warp_userio_lcd_printline(charsToPrint, 16, 7, 1); |
| 248 | |
| 249 | return; |
| 250 | } |
| 251 | }}} |