Rev 1662 | Rev 1668 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1662 | Rev 1665 | ||
---|---|---|---|
Line 326... | Line 326... | ||
326 | // -------------------------------------------------------------------------- |
326 | // -------------------------------------------------------------------------- |
327 | void BearbeiteRxDaten(void) |
327 | void BearbeiteRxDaten(void) |
328 | { |
328 | { |
329 | if(!NeuerDatensatzEmpfangen) return; |
329 | if(!NeuerDatensatzEmpfangen) return; |
Line 330... | Line 330... | ||
330 | 330 | ||
331 | unsigned char tempchar1; |
331 | unsigned char tempchar1, tempchar2; |
332 | Decode64(); // dekodiere datenblock im Empfangsbuffer |
332 | Decode64(); // dekodiere datenblock im Empfangsbuffer |
333 | switch(RxdBuffer[1]-'a') // check for Slave Address |
333 | switch(RxdBuffer[1]-'a') // check for Slave Address |
334 | { |
334 | { |
335 | case FC_ADDRESS: // FC special commands |
335 | case FC_ADDRESS: // FC special commands |
Line 428... | Line 428... | ||
428 | break; |
428 | break; |
Line 429... | Line 429... | ||
429 | 429 | ||
430 | case 'u': // request BL parameter |
430 | case 'u': // request BL parameter |
431 | Debug("Reading BL %d", pRxData[0]); |
431 | Debug("Reading BL %d", pRxData[0]); |
432 | // try to read BL configuration |
432 | // try to read BL configuration |
433 | tempchar1 = I2C_ReadBLConfig(pRxData[0]); |
433 | tempchar2 = I2C_ReadBLConfig(pRxData[0]); |
434 | if(tempchar1) |
434 | if(tempchar2 == BLCONFIG_SUCCESS) |
435 | { |
435 | { |
436 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
436 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
437 | SendOutData('U', FC_ADDRESS, 2, tempchar1, 1, &BLConfig, sizeof(BLConfig_t)); |
437 | SendOutData('U', FC_ADDRESS, 2, pRxData[0], 1, &BLConfig, sizeof(BLConfig_t)); |
438 | } |
438 | } |
Line 439... | Line 439... | ||
439 | break; |
439 | break; |
440 | 440 | ||
441 | case 'w': // write BL parameter |
441 | case 'w': // write BL parameter |
442 | Debug("Writing BL %d", pRxData[0]); |
442 | Debug("Writing BL %d", pRxData[0]); |
443 | if(RxDataLen >= 1+sizeof(BLConfig_t)) |
443 | if(RxDataLen >= 1+sizeof(BLConfig_t)) |
444 | { |
444 | { |
445 | memcpy(&BLConfig, (uint8_t*)(&pRxData[1]), sizeof(BLConfig_t)); |
445 | memcpy(&BLConfig, (uint8_t*)(&pRxData[1]), sizeof(BLConfig_t)); |
446 | // tbd. in MK-Tool |
446 | tempchar2 = I2C_WriteBLConfig(pRxData[0]); |
447 | BLConfig.crc = RAM_Checksum((uint8_t*)&BLConfig, sizeof(BLConfig_t) - 1); // update crc |
447 | if(tempchar2 == BLCONFIG_SUCCESS) tempchar1 = 1; |
448 | tempchar1 = I2C_WriteBLConfig(pRxData[0]); |
448 | else tempchar1 = 0; // indicate error |
449 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
449 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
450 | SendOutData('W', FC_ADDRESS,1, &tempchar1, sizeof(tempchar1)); |
450 | SendOutData('W', FC_ADDRESS,2, &tempchar1, sizeof(tempchar1), &tempchar2, sizeof(tempchar2)); |
Line 451... | Line 451... | ||
451 | } |
451 | } |