遠隔でのリセットが可能

Dependencies:   mbed arrc_mbed

Files at this revision

API Documentation at this revision

Comitter:
kazumayamanaka
Date:
Mon Apr 04 02:47:32 2022 +0000
Commit message:
Reset

Changed in this revision

arrc_mbed.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 310f7f58a9e9 arrc_mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arrc_mbed.lib	Mon Apr 04 02:47:32 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/TanakaRobo/code/arrc_mbed/#77c13e86ad12
diff -r 000000000000 -r 310f7f58a9e9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 04 02:47:32 2022 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "scrp_slave.hpp"
+
+int number=0;
+ScrpSlave slave(PC_12,PD_2,PH_1,SERIAL_TX,SERIAL_RX,5);
+bool mode = 0;
+
+bool play1(int rx_data,int &tx_data){
+    if(rx_data==1)number++;
+    return true;
+}
+bool play2(int rx_data,int &tx_data){
+    if(rx_data==2)mode=1;
+    else mode=0;
+    return true;
+}
+void reset(void){
+    printf("reset\n");
+    NVIC_SystemReset();
+}
+int main(void){
+    slave.addCMD(1,play1);
+    slave.addCMD(2,play2);
+    while(1){
+        printf("%d\n",number);
+        if(mode==1)reset();
+        wait(0.05);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 310f7f58a9e9 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 04 02:47:32 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file