P2IES ^= BUTTON1 // Interupt called on High-to-Low and Low-to-High P2IFG &= ~BUTTON1 // Clear BUTTON1 Interrupt flag P2IES ^= BUTTON2 // Interrupt called on High-to-Low and Low-to-High P2IFG &= ~BUTTON2 // Clear BUTTON2 interrupt flag Uart_putc('r') // Send "right" command via UART Uart_putc('l') // Send "left" command via UART P2IFG &= ~(BUTTON1 + BUTTON2) // Clear interrupt flags for the buttons P2IE |= (BUTTON1 + BUTTON2) // Enabling Button interrupts P2REN |= (BUTTON1 + BUTTON2) // Select pull-up resitors por P2.3 and P2.5
P1DIR |= (LED1 + LED2) // Set BIT0 and BIT6 as output WDTCTL = WDTPW + WDTHOLD // Stop watchdog timerīCSCTL1 = CALBC1_1MHZ // Initialize clock This is the source code for the MSP430 (find it also attached to this post) A LED is also connected on P1.6 in order to toggle it when receiving " toggle" command from the Android app.
When the buttons on P2.5 and P2.3 are pressed they flippers are activated. This modified Vector Pinball has the flippers linked to MSP430 Launchpad buttons.
In order to make a demo, I modified the code of Open Source Vector Pinball ( ), adding support for serial port access (using ). I found MSP430-softuart by Stefan Wendler ( ) and used it for the bidirectional communication Android-TabletMSP430-Launchpad. Then, in the MSP430 Launchpad side, I needed a lib for using the serial port. So, I compiled the CDC_ACM module for the (Allwinner A10 based) tablet in order to emulate serial port over USB. I did a little research, and first thought on the audio port for the communication ( ) but then I remembered that the tablet supported USB OTG.
In fact, my idea was to use the MSP430 launchpad as a low-cost GPIO board for an Android tablet. I wanted to connect a MSP430 to an Android device.