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; }
void leds_error_blink() { for(int i=0;i<16;i++) { leds_error_toggle(); Delay(); } }
void flash_read_ID() { for(uint8_t i = 0; i<ID_LENGTH;i++) { addressToWrite[i] = *(uint8_t*)(ID_ADDRESS + i); leds_error_toggle(); } }
void leds_circular_shift() { leds_error_toggle(); Delay(); leds_sync_toggle(); Delay(); leds_radio_toggle(); Delay(); }
/** \brief Called when a CoAP message is received for this resource. \param[in] msg The received message. CoAP header and options already parsed. \param[in] coap_header The CoAP header contained in the message. \param[in] coap_options The CoAP options contained in the message. \return Whether the response is prepared successfully. */ owerror_t cleds_receive( OpenQueueEntry_t* msg, coap_header_iht* coap_header, coap_option_iht* coap_options ) { owerror_t outcome; switch (coap_header->Code) { case COAP_CODE_REQ_GET: // reset packet payload msg->payload = &(msg->packet[127]); msg->length = 0; // add CoAP payload packetfunctions_reserveHeaderSize(msg,2); msg->payload[0] = COAP_PAYLOAD_MARKER; if (leds_error_isOn()==1) { msg->payload[1] = '1'; } else { msg->payload[1] = '0'; } // set the CoAP header coap_header->Code = COAP_CODE_RESP_CONTENT; outcome = E_SUCCESS; break; case COAP_CODE_REQ_PUT: // change the LED's state if (msg->payload[0]=='1') { leds_error_on(); } else if (msg->payload[0]=='2') { leds_error_toggle(); } else { leds_error_off(); } // reset packet payload msg->payload = &(msg->packet[127]); msg->length = 0; // set the CoAP header coap_header->Code = COAP_CODE_RESP_CHANGED; outcome = E_SUCCESS; break; default: outcome = E_FAIL; break; } return outcome; }
void cb_uartRxCb() { uint8_t byte; // toggle LED leds_error_toggle(); // read received byte byte = uart_readByte(); // echo that byte over serial uart_writeByte(byte); }
void cb_compare() { // toggle pin debugpins_fsm_toggle(); // toggle error led leds_error_toggle(); // increment counter app_vars.num_compare++; // schedule again bsp_timer_scheduleIn(BSP_TIMER_PERIOD); }
owerror_t openserial_printError(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2) { // blink error LED, this is serious leds_error_toggle(); return openserial_printInfoErrorCritical( SERFRAME_MOTE2PC_ERROR, calling_component, error_code, arg1, arg2 ); }
void cb_overflow(void) { // toggle pin debugpins_frame_toggle(); // switch radio LED on leds_error_toggle(); // reset the counter for number of remaining compares app_vars.num_compares_left = RADIOTIMER_NUM_COMPARES; app_vars.last_compare_val = RADIOTIMER_COMPARE_PERIOD; radiotimer_schedule(app_vars.last_compare_val); // increment debug counter app_dbg.num_overflow++; }
void bsp_timer_cb_compare(void) { // toggle pin debugpins_frame_toggle(); // toggle error led leds_error_toggle(); // increment counter app_dbg.bsp_timer_num_compare++; // schedule again bsp_timer_scheduleIn(BSP_TIMER_PERIOD); // wait a bit small_delay(); }
void bsp_timer_cb_compare() { uint16_t delay; // toggle pin debugpins_fsm_toggle(); // toggle error led leds_error_toggle(); // increment counter app_dbg.bsp_timer_num_compare++; // schedule again bsp_timer_scheduleIn(BSP_TIMER_PERIOD); // wait a bit for (delay=0;delay<ISR_DELAY;delay++); }
owerror_t openserial_printError( uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2 ) { // toggle error LED leds_error_toggle(); return openserial_printInfoErrorCritical( SERFRAME_MOTE2PC_ERROR, calling_component, error_code, arg1, arg2 ); // openserial_flush called by openserial_printInfoErrorCritical() }
void radiotimer_cb_overflow(void) { volatile uint16_t delay; // toggle pin debugpins_slot_toggle(); // switch radio LED on leds_error_toggle(); // reset the counter for number of remaining compares app_vars.radiotimer_num_compares_left = RADIOTIMER_NUM_COMPARES; app_vars.radiotimer_last_compare_val = RADIOTIMER_COMPARE_PERIOD; radiotimer_schedule(app_vars.radiotimer_last_compare_val); // increment debug counter app_dbg.radiotimer_num_overflow++; // wait a bit for (delay=0;delay<ISR_DELAY;delay++); }
void leds_all_toggle() { leds_error_toggle(); leds_sync_toggle(); leds_radio_toggle(); }