|
|
View previous topic :: View next topic |
Author |
Message |
pkipyy
Joined: 21 Nov 2013 Posts: 25
|
Help me source analysis. |
Posted: Sat Apr 19, 2014 11:21 am |
|
|
What are 1 and 2 and USB_DTS_TOGGLE in usb_put_packet(1,out,2,USB_DTS_TOGGLE);
What are 1 and 2 in usb_get_packet(1,in,2);
Code: |
#include "CCSUSB.h"
#include <pic18_usb.h>
#include <usb_desc_hid.h>
#include <usb.c>
void main(void){
unsigned int8 delay = 0;
unsigned int8 out[2];
unsigned int8 in[2];
LED_OFF(GREEN_LED);
LED_OFF(YELLOW_LED);
LED_OFF(RED_LED);
setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_2);
setup_adc_ports(MY_ANALOG_PORTS);
set_adc_channel(AN_POT);
usb_init_cs();
while(TRUE) {
usb_task();
if(usb_enumerated()) {
LED_ON(GREEN_LED);
delay++;
if(delay>=250) {
delay = 0;
out[0] = read_adc();
out[1] = BUTTON_PRESSED();
usb_put_packet(1,out,2,USB_DTS_TOGGLE);
}
if(usb_kbhit(1)) {
usb_get_packet(1,in,2);
if(in[0]){LED_ON(YELLOW_LED);} else {LED_OFF(YELLOW_LED);}
if(in[1]){LED_ON(RED_LED);} else {LED_OFF(RED_LED);}
}
delay_ms(1);
}
else {
LED_OFF(GREEN_LED);
}
}
}
|
|
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 19, 2014 11:54 am |
|
|
where can the source for
"CCSUSB.h"
be located ??
doc:
for the usb_put
usb_get
is in the manual |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Apr 19, 2014 5:17 pm |
|
|
Quote: | What are 1 and 2 and USB_DTS_TOGGLE in usb_put_packet(1,out,2,USB_DTS_TOGGLE);
What are 1 and 2 in usb_get_packet(1,in,2);
|
The description of the parameters for the usb_put_packet() function
is given in the usb_hw_layer.h file. It comes with the CCS compiler
and it's in the following directory on your computer:
Quote: | c:\program files\picc\drivers\usb_hw_layer.h |
The function description will tell you exactly what you need. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|