#include "app_config.h" ///#include "../bsp/cs1232.h" #include "../bsp/chipid.h" // #include "../msp/eeprom.h" #include "../msp/msp_eeprom.h" #include "../clib/clib.h" GlobalParam G; GlobalRegister R; //WR_Buf wr_buf; void L3_param_init(void) { //U8 i; G.debug = 1; //station模式状态 G.st_status = 0; //0:none 1:wifi_ok 2:tcp_connect_ok //station模式sid Lc_strcpy(G.st_sid,"ccsens"); //station模式pwd Lc_strcpy(G.st_pwd,"ccsens123"); //ap模式状态 G.ap_status = 0;//0: none 1: ap_ok 2:tcp_server_ok //ap模式sid Lc_strcpy(G.ap_sid,"cc_pen_ap"); //ap模式pwd Lc_strcpy(G.ap_pwd,"ccsens123"); #if 0 wr_buf.wIndex = wr_buf.rIndex = 0; wr_buf.maxsize = sizeof(wr_buf.buf)/sizeof(PenPoint); for(i=0;irIndex+1)%(p->maxsize) == p->wIndex) { p->full = 1; } } U16 Lc_write_cyc_buf(PenPoint *wbuf ,WR_Buf *wp ,U16 wlen) { U8 nulllen = (wp->maxsize - wp->wIndex + wp->rIndex - 1) % wp->maxsize; if(nulllen >= wlen) { wp->readdr = (wp->wIndex + wlen) % wp->maxsize; if(wp->readdr > wp->wIndex || wp->readdr == 0) { Lc_buf_copy_uc((U8 *)&wp->buf[wp->wIndex], (U8 *)wbuf, wlen*sizeof(PenPoint)); } else { wp->relen = wlen - wp->readdr; Lc_buf_copy_uc((U8 *)&wp->buf[wp->wIndex], (U8 *)wbuf, wp->relen*sizeof(PenPoint)); Lc_buf_copy_uc((U8 *)&wp->buf[0], (U8 *)(wbuf+wp->relen), wp->readdr*sizeof(PenPoint)); } wp->wIndex = wp->readdr; return wlen; } else { //L0_uart0_sendstr("X"); wp->full = 1; return 0; } } U16 Lc_read_cyc_buf(PenPoint *rbuf ,WR_Buf *rp ,U16 rlen) { U8 validlen = (rp->maxsize - rp->rIndex + rp->wIndex) % rp->maxsize; if(validlen >= rlen) { rp->readdr = (rp->rIndex + rlen) % rp->maxsize; if(rp->readdr < rp->wIndex || rp->readdr == 0) { Lc_buf_copy_uc((U8 *)rbuf, (U8 *)&rp->buf[rp->rIndex],rlen*sizeof(PenPoint)); } else { rp->relen = rlen - rp->readdr; Lc_buf_copy_uc((U8 *)rbuf,(U8 *) &rp->buf[rp->rIndex], rp->relen*sizeof(PenPoint)); Lc_buf_copy_uc((U8 *)(rbuf+rp->relen), (U8 *)&rp->buf[0], rp->readdr*sizeof(PenPoint)); } rp->rIndex = rp->readdr; return rlen; } else { rp->null = 1; return 0; } } #endif