Trackball based on the NXP LPC11U24 and the ADNS-9500

Dependencies:   ADNS9500 USBDevice mbed 25LCxxx_SPI

main.h

Committer:
xxann5
Date:
2012-12-16
Revision:
5:c7056267daa7
Parent:
4:ba169f98e9be
Child:
6:4cb2c9a3abcd

File content as of revision 5:c7056267daa7:

#include "mbed.h"
#include "USBHID.h"
#include "USBMouse.h"
#include <math.h>
#include <stdint.h>

#define ADNS9500_SROM_91

#define DEBUG

#include "adns9500.hpp"
#include "Ser25lcxxx.h"

#define CHAT_SET 0x01
#define CHAT_GET 0x02
    
#define CHAT_MOTION_DEFAULT_CPI 0x01
#define CHAT_MOTION_MAX_CPI     0x02
#define CHAT_MOTION_MIN_CPI     0x03
#define CHAT_MOTION_STEP_CPI    0x04
#define CHAT_Z_DEFAULT_CPI      0x05
#define CHAT_HR_DEFAULT_CPI     0x06
    
#define CHAT_VID                0x07
#define CHAT_PID                0x08
    
#define CHAT_ADNS_SROM          0x09

#define CHAT_LED_BEHAVIOR       0x0a


  
//This report will contain data to be sent
HID_REPORT send_rep;
HID_REPORT recv_rep;

DigitalOut led1(LED1);
DigitalOut led2(LED2);
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);

bool motion_triggered = false;
bool z_axis_active    = false;
bool high_rez_active  = false;

int default_motion_cpi = 1080;
int default_z_cpi      = 90;
int default_hirez_cpi  = 180;





void set( uint8_t attrib, uint8_t *val );
void get( uint8_t attrib);