void gpio0_callback(void)
{
    NVIC_DisableIRQ(GPIO_Trriger_IRQn);    // Disable this interrupt
		#ifdef CFG_SLEEP
    app_ble_force_wakeup();
		app_ble_ext_wakeup_off();
		#endif
		uart2_write("wakeup",strlen("wakeup"),NULL);
		uart2_read(&Sample_LED_Blink,1,NULL);
    NVIC_ClearPendingIRQ(GPIO_Trriger_IRQn);
		NVIC_EnableIRQ(GPIO_Trriger_IRQn);     // Enable this interrupt
}
/**
****************************************************************************************
* @brief Handles timer timeout
* @return If the message was consumed or not.
****************************************************************************************
*/
int sample128_timer_handler(ke_msg_id_t const msgid,
																 struct gapm_cmp_evt const *param,
																 ke_task_id_t const dest_id,
																 ke_task_id_t const src_id)
{
	//uint8_t Tmpi;
	//my_newer2_addChar Tmp_Buff;
	//ke_timer_set(APP_SAMPLE128_TIMER,TASK_APP,Sample_LED_Blink);
	//sample128_placeholder++;
	/*
	struct sample128_upd_char2_req *req = KE_MSG_ALLOC(
																	SAMPLE128_UPD_CHAR2_REQ,
																	TASK_SAMPLE128,
																	TASK_APP,
																	sample128_upd_char2_req
																	 );
	*/
	sample128_LED++;
	if(sample128_LED%2==0)
	{
		GPIO_SetActive(GPIO_PORT_1,GPIO_PIN_0);
	}
	else
	{
		GPIO_SetInactive(GPIO_PORT_1,GPIO_PIN_0);
	}
	uart2_write("Hello",strlen("Hello"),NULL);
	
	//user_uart_write(&sample128_LED,1,NULL);
	/*
	for(Tmpi=0;Tmpi<characristic2_length;Tmpi++)
	{
		Tmp_Buff[Tmpi]=(uint8_t)(sample128_LED+Tmpi);
	}
	memcpy(&req->val,Tmp_Buff,sizeof(my_newer2_addChar));
	req->val = sample128_placeholder;
	req->conhdl = app_env.conhdl;
	ke_msg_send(req);
	*/
	return (KE_MSG_CONSUMED);
}
Esempio n. 3
0
void uart2_write_byte( unsigned char Byte)
{
	uart2_write(&Byte, 1);
}