uwick. W
/
MameController
Mamecontroller/joystick device wrapper library
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "USBKeyboard.h" 00003 #include "joystick.h" 00004 00005 DebounceIn Up(p19); 00006 DebounceIn Down(D2); 00007 DebounceIn Left(D3); 00008 DebounceIn Right(D4); 00009 DebounceIn Jump(p16); 00010 DebounceIn Fire1(p17); 00011 DebounceIn Fire2(D7); 00012 00013 BusOut leds(LED1, LED2, LED3); 00014 00015 //USBKeyboard 00016 USBKeyboard keyboard; 00017 00018 //Serial uart(USBTX, USBRX); 00019 Serial uart(p28, p27); 00020 GPIOJoystick joy; 00021 00022 int main(void) { 00023 uart.baud(57600); 00024 uart.putc('A'); 00025 int k = 0 ; 00026 while(k<3) { 00027 00028 //Printf is also completely supported 00029 int i = 100; 00030 float f = 0.5; 00031 char h = 0x05; 00032 uart.printf("i = %d, f = %f, h = %02X \r\n", i, f, h); 00033 wait(3); 00034 k++; 00035 } 00036 wait(2); 00037 joy.init(); 00038 }
Generated on Wed Jul 13 2022 17:27:58 by 1.7.2