2011-07-27 13:41:18 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
|
|
|
|
#include "lcd/lcd.h"
|
|
|
|
#include "lcd/print.h"
|
|
|
|
|
|
|
|
#include "funk/nrf24l01p.h"
|
|
|
|
|
2011-07-27 16:22:53 +00:00
|
|
|
#include "usbcdc/usb.h"
|
|
|
|
#include "usbcdc/usbcore.h"
|
|
|
|
#include "usbcdc/usbhw.h"
|
|
|
|
#include "usbcdc/cdcuser.h"
|
|
|
|
#include "usbcdc/cdc_buf.h"
|
2011-07-27 13:41:18 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#if CFG_USBMSC
|
2011-07-27 16:22:53 +00:00
|
|
|
#error "MSC is defined"
|
2011-07-27 13:41:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !CFG_USBCDC
|
2011-07-27 16:22:53 +00:00
|
|
|
#error "CDC is not defined"
|
2011-07-27 13:41:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void f_ser(void) {
|
2011-07-27 16:22:53 +00:00
|
|
|
usbCDCInit();
|
2011-07-27 13:41:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void f_disconnect(void) {
|
2011-07-27 16:22:53 +00:00
|
|
|
usbCDCOff();
|
2011-07-27 13:41:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LEN 10
|
|
|
|
void f_sread(){
|
|
|
|
uint8_t buf[LEN+1];
|
|
|
|
int l=LEN;
|
|
|
|
|
|
|
|
lcdPrint("Bytes:");
|
|
|
|
CDC_OutBufAvailChar (&l);
|
|
|
|
lcdPrintInt(l);
|
|
|
|
lcdNl();
|
|
|
|
|
|
|
|
lcdPrint("read:");
|
|
|
|
CDC_RdOutBuf (buf, &l);
|
|
|
|
lcdPrintInt(l);
|
|
|
|
lcdNl();
|
|
|
|
|
|
|
|
buf[l]=0;
|
|
|
|
lcdPrintln(buf);
|
|
|
|
};
|
|
|
|
|
|
|
|
void f_echo(){
|
|
|
|
uint8_t buf[2] = {0,0};
|
|
|
|
int l;
|
|
|
|
while(1){
|
|
|
|
CDC_OutBufAvailChar(&l);
|
|
|
|
if( l ){
|
|
|
|
l = 1;
|
|
|
|
CDC_RdOutBuf (buf, &l);
|
|
|
|
puts(buf);
|
|
|
|
}
|
|
|
|
//puts("hello world\r\n");
|
|
|
|
//delayms(1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void f_say(){
|
|
|
|
puts("hello world\r\n");
|
|
|
|
};
|