7
Figure 6. Reference Design Mouse Software Architecture
CPU Main Processing Loop
(1) Process MOTION data
(2) Process BINDING packet
(3) Process BUTTON data
(4) Update SCROLL WHEEL
QEP state machine
(5) Send out WHEEL position
(if changed since last check)
(6) If 10 mins inactivity, go into
DEEP SLEEP mode, else
repeat loop
Sensor
MOTION
Port 2
Interrupt
Transmitter Module
(1) Build raw data packet
(2) Submit packet to Tx queue
(3) Turn RF transmitter ON
(3) Shift data out serially according to Miller
encoding scheme
(4) Turn RF transmitter OFF
LEFT Button
Port 1 Interrupt
PORT 1 Interrupt
Service Routine
WHEEL Button
Port 1 Interrupt
RIGHT Button
Port 1 Interrupt
Scroll Wheel Module
(1) Turn Wheel LED ON
(2) Read scroll wheel position
(3) Turn Wheel LED OFF
(4) Update QEP state machine
CONNECT Button
Port 2 Interrupt
PORT 2 Interrupt
Service Routine
Periodic
TIMER_A1
Interrupt
(every 2 msec)
TIMER_A0 Interval Interrupt
WatchDog Interval Interrupt
(every 250 milliseconds)
WDT Interrupt Service Routine
(1) Trigger WHEEL position check
(2) Decrement Timeout counter
Firmware Implementation
The firmware for this reference design is written in the C language.
The following files are required to compile the mouse firmware.
•
MSP430_AVAGO_ADNS-3040.c
– main mouse firmware
•
CRC-8.c
– Routines for CRC-8 generation
•
wm430_buttons.c
– used to store button state data for tx message
•
wm430_system.c
•
wm430_transmitter.c
– mplements the RF transmitter protocol
•
wm430_wheel.c
– Implements the logic to detect scroll wheel movement
•
_FSKDATAPLUSENCODING
– used to enable MSP430 to shift data out via FSK scheme by toggling the
RF_DATA line at specific bit periods
The user should insert the receiver dongle into an available USB port at the computer. Install two AA alkaline batteries
into the battery compartment. Pay special attention to the polarities of the two batteries. The reference design mouse
is designed to work with two AA batteries in parallel or just one AA battery. Press the connect button on the receiver
dongle and while the LEDs are flashing press the connect button at the underside of the mouse. When the mouse is
properly “connected” to the dongle every time it receives a transmission from the mouse the green LED lights up.