error_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint16_t length) { uint8_t counter; __disable_interrupt(); openserial_somethingInOutputBuffer=TRUE; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'S'; //this is an status update // openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); // openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)statusElement; //type of element for (counter=0;counter<length;counter++){ openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)buffer[counter]; } openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; __enable_interrupt(); return E_SUCCESS; }
error_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint16_t length) { uint8_t counter; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.somethingInOutputBuffer=TRUE; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'S'; //this is an status update openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)statusElement; //type of element for (counter=0; counter<length; counter++) { openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)buffer[counter]; } openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; ENABLE_INTERRUPTS(); return E_SUCCESS; }
error_t openserial_printData(uint8_t* buffer, uint8_t length) { uint8_t counter; uint8_t asn[5]; INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.somethingInOutputBuffer=TRUE; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'D'; //this is data openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); //asn to serial .. asnWriteToSerial(asn);// byte01,byte23,byte4 openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[0]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[1]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[2]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[3]; openserial_vars.output_buffer[output_buffer_index_write_increment()]=asn[4]; for (counter=0; counter<length; counter++) { openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)buffer[counter]; } openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; ENABLE_INTERRUPTS(); return E_SUCCESS; }
error_t openserial_printError(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2) { leds_error_toggle(); INTERRUPT_DECLARATION(); DISABLE_INTERRUPTS(); openserial_vars.somethingInOutputBuffer=TRUE; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'E'; //this is an error openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)calling_component; //component generating error openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)error_code; //error_code openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg1 & 0xff00)>>8); //arg1 openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg1 & 0x00ff); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg2 & 0xff00)>>8); //arg2 openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg2 & 0x00ff); openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_vars.output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; ENABLE_INTERRUPTS(); return E_SUCCESS; }
error_t openserial_printError(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2) { __disable_interrupt(); openserial_somethingInOutputBuffer=TRUE; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; //preamble openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'^'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'E'; //this is an error // openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[1]); // openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((idmanager_getMyID(ADDR_16B))->addr_16b[0]); openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)calling_component; //component generating error openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)error_code; //error_code openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg1 & 0xff00)>>8); //arg1 openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg1 & 0x00ff); openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)((arg2 & 0xff00)>>8); //arg2 openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t) (arg2 & 0x00ff); openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; //postamble openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; openserial_output_buffer[output_buffer_index_write_increment()]=(uint8_t)'$'; __enable_interrupt(); return E_SUCCESS; }