2018.07.26
Dependencies: QEI mbed-rtos mbed
Diff: 4_main.cpp
- Revision:
- 2:c62dc496b79a
- Parent:
- 1:86705c6e0ab7
- Child:
- 3:85eb7e954bfa
--- a/4_main.cpp Mon Mar 28 00:09:56 2016 +0000 +++ b/4_main.cpp Thu Apr 14 10:27:21 2016 +0000 @@ -110,7 +110,7 @@ // ======================================================================== void MainCtrl_Interface_task(void const *) { - char buf[10]; // command buffer + char buf[14]; // command buffer char msg[] = "C000000"; char res_msg[] = "Slave!"; char res_msg2[] = "Bravo!"; @@ -169,17 +169,19 @@ /* ******************************************* */ /* Add setting data set operation in this area */ /* ******************************************* */ - - - if( buf[1] == 'Z'){ + if( buf[I2C_CP_COMMAND_R] == 'Z'){ wheel.reset(); } else{ - dram_diameter = ( buf[2] << 8 ); - dram_diameter |= buf[3]; - ccable_diameter = ( buf[4] << 8 ); - ccable_diameter |= buf[5]; - rresolution = buf[6]; + for( int j = 0; j < NumberOfI2CCommand; j++) + pc,printf("%02x ", buf[j]); + pc.printf( "\r\n" ); + + dram_diameter = ( buf[I2C_CP_WDRAM_DIA_UPPER] << 8 ); + dram_diameter |= buf[I2C_CP_WDRAM_DIA_LOWER]; + ccable_diameter = ( buf[I2C_CP_CCABLE_DIA_UPPER] << 8 ); + ccable_diameter |= buf[I2C_CP_CCABLE_DIA_LOWER]; + rresolution = buf[I2C_CP_RESOLVER_RESO]; DEBUG_PRINT_L1("Bd4> ===========================================\n"); DEBUG_PRINT_L1("Bd4> Dram Diameter : %d\t(mm)\n", dram_diameter/100);