summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2014-04-05 19:25:41 +0200
committerFlorian Jung <flo@windfisch.org>2014-04-05 19:25:41 +0200
commit61369296fb7907360f9113555cd05f3f572119bf (patch)
tree29a2cf14e9b43819141facd61d2672f3eff52484
parent71215f90c0f159b5aec2775347ccf65dcedd974d (diff)
make it rumble, using ltrig/rtrig
-rw-r--r--main.c22
-rw-r--r--usbdrv/usbconfig.h2
2 files changed, 19 insertions, 5 deletions
diff --git a/main.c b/main.c
index 78916da..db2654d 100644
--- a/main.c
+++ b/main.c
@@ -290,6 +290,7 @@ int main (void)
{
char rand=123;
char gc_x=3, gc_y=3;
+ unsigned char ltrig=0, rtrig=0;
DDRC=0x00;
PORTC=0x00;
@@ -317,10 +318,21 @@ debug(4);
int n_received;
int toggle=0;
+ int count=0;
+ int count2=0;
+ int count3=0;
while(1)
{
toggle=~toggle;
debug(toggle);
+
+ count++;
+ if (count>=1500) count=0;
+ count2++;
+ if (count2>=512-ltrig) count2=0;
+ count3++;
+ if (count3>=25) count3=0;
+
wdt_reset();
usbPoll();
@@ -365,12 +377,14 @@ debug(4);
//debug(temp % 64);
// _delay_ms(0.3);
_delay_us(10);
- char foo[] = { 0x40, 0x03, 0x02 };
-
- if (!(PIND & 0x10))
- foo[2]=0x03;
+ char foo[] = { 0x40, 0x03, 0x00 };
+ //char foo[] = { 0x40, 0x03, 0x02 };
+ if (count2<256 && count3<rtrig/10)
+ foo[2]|=0x01;
+ char foo2=0x00;
+ send_recv_gc(&foo2, 1);
n_received=send_recv_gc(foo, 3);
if (n_received == 64)
{
diff --git a/usbdrv/usbconfig.h b/usbdrv/usbconfig.h
index c409ce8..7bb2a17 100644
--- a/usbdrv/usbconfig.h
+++ b/usbdrv/usbconfig.h
@@ -118,7 +118,7 @@ section at the end of this file).
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
* device is powered from the USB bus.
*/
-#define USB_CFG_MAX_BUS_POWER 50
+#define USB_CFG_MAX_BUS_POWER 500
/* Set this variable to the maximum USB bus power consumption of your device.
* The value is in milliamperes. [It will be divided by two since USB
* communicates power requirements in units of 2 mA.]