Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BaseDAP SWD USBDAP USBDevice mbed
main.cpp
00001 #include "mbed.h" 00002 #include "USBDAP.h" 00003 #include "BaseDAP.h" 00004 00005 SWD swd(D12, D10, D6); // SWDIO,SWCLK,nRESET 00006 DigitalOut connected(LED_GREEN); 00007 DigitalOut running(LED_RED); 00008 00009 class myDAP : public BaseDAP { 00010 public: 00011 myDAP(SWD* swd):BaseDAP(swd){}; 00012 virtual void infoLED(int select, int value) { 00013 switch(select) { 00014 case 0: 00015 connected = value^1; 00016 running = 1; 00017 break; 00018 case 1: 00019 running = value^1; 00020 connected = 1; 00021 break; 00022 } 00023 } 00024 }; 00025 00026 int main() { 00027 USBDAP* hid = new USBDAP("CMSIS-DAP"); 00028 myDAP* dap = new myDAP(&swd); 00029 while(1) { 00030 HID_REPORT recv_report; 00031 if(hid->readNB(&recv_report)) { 00032 HID_REPORT send_report; 00033 dap->Command(recv_report.data, send_report.data); 00034 send_report.length = 64; 00035 hid->send(&send_report); 00036 } 00037 } 00038 } 00039
Generated on Fri Jul 15 2022 20:31:20 by
1.7.2