forked from ccsens_hardware/stc_ttss_weight
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
2.5 KiB
130 lines
2.5 KiB
/*****************************************************************************
|
|
* uart.c: UART API file for NXP LPC17xx Family Microprocessors
|
|
*
|
|
* Copyright(C) 2013, cc
|
|
* All rights reserved.
|
|
*
|
|
* History
|
|
* 2013.05.24 ver 1.00 Prelimnary version, first Release
|
|
|
|
*
|
|
******************************************************************************/
|
|
|
|
#include "target_cfg.h"
|
|
#include "type.h"
|
|
#include "time.h"
|
|
#include "uart.h"
|
|
//#include "..\Sensor.h"
|
|
|
|
#include "debug_app.h"
|
|
struct _s_task_debug_led_ s_task_debug_led;
|
|
|
|
void L2_task_debug_led_init(void)
|
|
{
|
|
D_P1_OUT(15);
|
|
D_P1_OFF(15); //ָʾµÆ
|
|
D_P1_OUT(16);
|
|
D_P1_OFF(16); //ָʾµÆ
|
|
|
|
while(0)
|
|
{
|
|
D_P1_OFF(15) ;
|
|
L0_delay_ms(600);
|
|
D_P1_ON(15) ;
|
|
L0_delay_ms(600);
|
|
L0_debugS_uc('a'); L0_USART_print(UART_debug,"\r\n");
|
|
// L2_oled_main();
|
|
}
|
|
L3_task_s_go(s_task_debug_led,D_task_debug_led_init);
|
|
|
|
|
|
}
|
|
|
|
void L2_task_debug_led_handdle(struct _s_task_debug_led_ *s)
|
|
{
|
|
switch(s->task.sh)
|
|
{
|
|
|
|
case D_task_debug_led_init://
|
|
L0_USART_print(UART_debug,"\r\n s_task_debug_led ");
|
|
L2_task_go(D_task_debug_led_key);
|
|
break;
|
|
case D_task_debug_led_key :
|
|
D_P1_ON(15);
|
|
L0_debugS_uc('^');
|
|
L2_task_go(D_task_debug_led_key2);
|
|
L1_task_idelay(D_idelay_1s);
|
|
// L0_oled_point(60,50,0x00);
|
|
//L2_debug_Au4B48347975);
|
|
break;
|
|
case D_task_debug_led_key2 :
|
|
D_P1_OFF(15);
|
|
//L0_debugS_uc('~');
|
|
#if 0
|
|
if((s->x ++)> 64)s->x =0;
|
|
if((s->y ++)> 48)s->y =0;
|
|
|
|
L0_oled_point(s->x,s->y,0xff);
|
|
#else
|
|
|
|
|
|
// L0_oled_point(60,50,0xff);
|
|
|
|
#endif
|
|
L2_task_go(D_task_debug_led_key);
|
|
L1_task_idelay(D_idelay_1s);
|
|
//L2_debug_Au4B1234567);
|
|
|
|
break;
|
|
|
|
L2_task_switch_default_idelay();
|
|
|
|
}
|
|
}
|
|
void L1_debug_rx_handle(struct _s_protocol_ *p)
|
|
{
|
|
// unsigned int i;
|
|
p->cashe[0] = p->rbr;//
|
|
if(p->num > D_s_protocol_len)
|
|
{
|
|
p->num = 0;
|
|
p->buf[p->num] = p->cashe[0];
|
|
}else
|
|
{
|
|
p->buf[p->num] = p->cashe[0];
|
|
p->num ++;
|
|
}
|
|
}
|
|
|
|
|
|
struct _s_uart_config_ s_debug_config;
|
|
|
|
|
|
#define D_debug_buf s_debug_config.puart_config->st->buf
|
|
#define D_debug_buf_d(x) s_debug_config.puart_config->st->buf[(x)]
|
|
#define D_debug_num (s_debug_config.puart_config->st->num)
|
|
|
|
void L1_debug_init(void)
|
|
{
|
|
ts_uart1.L1_uart_rx_handle = L1_debug_rx_handle;
|
|
ts_uart1.st = (struct _s_protocol_ *)&s_at1;
|
|
|
|
s_debug_config.usart = 1;
|
|
s_debug_config.puart_config = &ts_uart1;
|
|
|
|
|
|
s_debug_config.type = 0;
|
|
#if 0
|
|
while(9)
|
|
{
|
|
if(D_debug_num >= 1)
|
|
{
|
|
L0_Usend_uc(s_debug_config.usart,D_debug_buf_d(0));
|
|
D_debug_num = 0;
|
|
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
|
|
//>>>>>>>>>>>>>>>>>>>>> debug led task
|
|
|