![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CMSIS-DAP debug adapter
Dependencies: BaseDAP SWD USBDAP USBDevice mbed
Fork of Simple-CMSIS-DAP by
SWD | TG-LPC11U35-501 |
---|---|
SWDIO | p6(P0_8) |
SWCLK | p8(P0_7) |
nRESET | p30(P0_1) |
main.cpp@2:f9c48f0a3efe, 2015-07-05 (annotated)
- Committer:
- va009039
- Date:
- Sun Jul 05 00:18:37 2015 +0000
- Revision:
- 2:f9c48f0a3efe
- Parent:
- 1:2957e24bb52f
add TG-LPC11U35-501
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:dbe821206b04 | 1 | #include "mbed.h" |
va009039 | 0:dbe821206b04 | 2 | #include "USBDAP.h" |
va009039 | 0:dbe821206b04 | 3 | #include "BaseDAP.h" |
va009039 | 0:dbe821206b04 | 4 | |
va009039 | 2:f9c48f0a3efe | 5 | #if defined(TARGET_MCU_LPC11U35_501) |
va009039 | 2:f9c48f0a3efe | 6 | SWD swd(p6, p8, p30); // SWDIO,SWCLK,nRESET |
va009039 | 2:f9c48f0a3efe | 7 | DigitalOut connected(LED1); |
va009039 | 2:f9c48f0a3efe | 8 | DigitalOut running(LED2); |
va009039 | 2:f9c48f0a3efe | 9 | #else |
va009039 | 0:dbe821206b04 | 10 | SWD swd(D12, D10, D6); // SWDIO,SWCLK,nRESET |
va009039 | 0:dbe821206b04 | 11 | DigitalOut connected(LED_GREEN); |
va009039 | 0:dbe821206b04 | 12 | DigitalOut running(LED_RED); |
va009039 | 2:f9c48f0a3efe | 13 | #endif |
va009039 | 0:dbe821206b04 | 14 | |
va009039 | 0:dbe821206b04 | 15 | class myDAP : public BaseDAP { |
va009039 | 0:dbe821206b04 | 16 | public: |
va009039 | 0:dbe821206b04 | 17 | myDAP(SWD* swd):BaseDAP(swd){}; |
va009039 | 0:dbe821206b04 | 18 | virtual void infoLED(int select, int value) { |
va009039 | 0:dbe821206b04 | 19 | switch(select) { |
va009039 | 0:dbe821206b04 | 20 | case 0: |
va009039 | 0:dbe821206b04 | 21 | connected = value^1; |
va009039 | 0:dbe821206b04 | 22 | running = 1; |
va009039 | 0:dbe821206b04 | 23 | break; |
va009039 | 0:dbe821206b04 | 24 | case 1: |
va009039 | 0:dbe821206b04 | 25 | running = value^1; |
va009039 | 0:dbe821206b04 | 26 | connected = 1; |
va009039 | 0:dbe821206b04 | 27 | break; |
va009039 | 0:dbe821206b04 | 28 | } |
va009039 | 0:dbe821206b04 | 29 | } |
va009039 | 0:dbe821206b04 | 30 | }; |
va009039 | 0:dbe821206b04 | 31 | |
va009039 | 0:dbe821206b04 | 32 | int main() { |
va009039 | 1:2957e24bb52f | 33 | USBDAP* hid = new USBDAP("CMSIS-DAP"); |
va009039 | 0:dbe821206b04 | 34 | myDAP* dap = new myDAP(&swd); |
va009039 | 0:dbe821206b04 | 35 | while(1) { |
va009039 | 0:dbe821206b04 | 36 | HID_REPORT recv_report; |
va009039 | 0:dbe821206b04 | 37 | if(hid->readNB(&recv_report)) { |
va009039 | 0:dbe821206b04 | 38 | HID_REPORT send_report; |
va009039 | 0:dbe821206b04 | 39 | dap->Command(recv_report.data, send_report.data); |
va009039 | 0:dbe821206b04 | 40 | send_report.length = 64; |
va009039 | 0:dbe821206b04 | 41 | hid->send(&send_report); |
va009039 | 0:dbe821206b04 | 42 | } |
va009039 | 0:dbe821206b04 | 43 | } |
va009039 | 0:dbe821206b04 | 44 | } |
va009039 | 0:dbe821206b04 | 45 |