The Professional Perfectionists
/
Test_Mouse
Just mouse test for x,y position
Diff: main.cpp
- Revision:
- 1:afd3fc7c27a2
- Parent:
- 0:48805553d80e
- Child:
- 2:ed0782fc9b00
diff -r 48805553d80e -r afd3fc7c27a2 main.cpp --- a/main.cpp Tue Mar 03 22:16:29 2015 +0000 +++ b/main.cpp Fri Mar 06 20:45:05 2015 +0000 @@ -7,10 +7,10 @@ Serial pc(USBTX, USBRX); -DigitalInOut pinC(PTD0); -DigitalInOut pinD(PTC4); +DigitalInOut pinC(PTD0); // clock +DigitalInOut pinD(PTC4); // data -signed long mx, my; +signed long mx, my; float dx, dy; void reSync(){ pinC = 1; // ReSync (startup) mouse @@ -18,7 +18,7 @@ pinC = 0; wait_us(1); pinC = 1; - wait_ms(1000); // wait for OptiMouse serial transaction timer to time out: + wait_us(1000); // wait for OptiMouse serial transaction timer to time out: } uint8_t readRegister(uint8_t address){ // Bitbang SPI read operation @@ -84,11 +84,13 @@ while(1){ mx = getDx(); my = getDy(); + dx = mx; + dy = my; pc.printf("x = "); - pc.printf("%x\t", mx); - pc.printf("x = "); - pc.printf("%x\n", my); + pc.printf("%f\t", dx); + pc.printf("y = "); + pc.printf("%f\n", dy); } }