Trackball based on the NXP LPC11U24 and the ADNS-9500
Dependencies: ADNS9500 USBDevice mbed 25LCxxx_SPI
Diff: main.h
- Revision:
- 6:4cb2c9a3abcd
- Parent:
- 5:c7056267daa7
- Child:
- 7:d6ee49a89009
diff -r c7056267daa7 -r 4cb2c9a3abcd main.h --- a/main.h Sun Dec 16 18:38:20 2012 +0000 +++ b/main.h Sun Jan 06 19:48:26 2013 +0000 @@ -1,9 +1,36 @@ +/* Copyright (c) 2012-2013 Chris Majoros(chris@majoros.us), MIT License +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software +* and associated documentation files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or +* substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + #include "mbed.h" #include "USBHID.h" #include "USBMouse.h" + #include <math.h> #include <stdint.h> + +#define PINDETECT_PIN_ASSTERED 0 //setAssertValue +#define PINDETECT_SAMPLE_PERIOD 100 //setSampleFrequency +#define PINDETECT_ASSERT_COUNT 10 //setSamplesTillAssert +#define PINDETECT_HOLD_COUNT 500 + +#include "PinDetect.h" + #define ADNS9500_SROM_91 #define DEBUG @@ -28,6 +55,9 @@ #define CHAT_LED_BEHAVIOR 0x0a +#define CHAT_BTN_TICKER_FREQ 0x0b +#define CHAT_BTN_ASSERT_COUNT 0x0c + //This report will contain data to be sent @@ -39,11 +69,17 @@ DigitalOut led3(LED3); DigitalOut led4(LED4); -InterruptIn btn_hr(p16); -InterruptIn btn_z(p17); -InterruptIn btn_l(p18); -InterruptIn btn_m(p19); -InterruptIn btn_r(p20); +PinDetect btn_hr(p16); +PinDetect btn_z(p17); +DigitalIn btn_l(p18); +PinDetect btn_m(p19); +PinDetect btn_r(p20); + + +DigitalIn btn_program(p22); + +adns9500::ADNS9500 *sensor; +USBMouse *mouse; bool motion_triggered = false; bool z_axis_active = false; @@ -53,9 +89,25 @@ int default_z_cpi = 90; int default_hirez_cpi = 180; +void track(); +void program(); +void motionCallback( void ); + +void btn_hr_press( void ); +void btn_hr_release( void ); +void btn_z_press( void ); +void btn_z_release( void ); +void btn_l_press(void); +void btn_l_release( void ); + +void btn_m_press( void ); +void btn_m_release( void ); + +void btn_r_press( void ); +void btn_r_release( void ); void set( uint8_t attrib, uint8_t *val ); void get( uint8_t attrib); \ No newline at end of file