L432がUARTを受信する予定だったけど動かない

Dependencies:   mbed BufferedSerial

Files at this revision

API Documentation at this revision

Comitter:
falconsyunya
Date:
Mon May 16 10:51:00 2022 +0000
Parent:
0:c31f3c17df9c
Commit message:
2022_05_16; No MCU No Life

Changed in this revision

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 c31f3c17df9c -r 196422c79186 main.cpp
--- a/main.cpp	Tue May 03 06:32:58 2022 +0000
+++ b/main.cpp	Mon May 16 10:51:00 2022 +0000
@@ -4,12 +4,23 @@
  */
 
 #include "mbed.h"
+#include "PeripheralPins.h"
+#include "mbed_toolchain.h"
 //#include "BufferedSerial.h"
 
+extern const PinMap PinMap_UART_RX[] = {
+    {PA_3,       UART_2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
+//  {PA_3,       LPUART_1,STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, // No LPUART_1 TX
+    {PA_10,      UART_1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
+    {PA_15,      UART_2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART2)}, // Connected to STDIO_UART_RX
+    {PB_7,       UART_1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
+    {NC, NC, 0}
+};
+
 //BufferedSerial L432(PA_2,PA_3,9600);
 //BufferedSerial im920(PA_9,PA_10,38400);
 Serial L432(PA_2,PA_3,9600);
-Serial im920(PA_9,PA_10,38400);
+//Serial im920(PA_9,PA_10,38400);
 
 DigitalOut led(LED1);
 
@@ -17,17 +28,21 @@
 //char str[15];
 //int i=0;
 
+
 int main(){
     //f303.baud(9600);
     //pc.baud(9600);
-    //led=0;
+    printf("start\r\n");
+    led=0;
     char temp;
     while(1){
         if(L432.readable()) { //f303からのデータがある場合
             printf("readable\r\n");
+            //led=!led;
             led=!led;
             temp = L432.getc();//一文字読み込む
-            im920.printf("TXDA %c\r\n",temp);
+            //im920.printf("TXDA %c\r\n",temp);
+            wait(1);
             //str[i++] = temp;
         }
     }
diff -r c31f3c17df9c -r 196422c79186 mbed.bld
--- a/mbed.bld	Tue May 03 06:32:58 2022 +0000
+++ b/mbed.bld	Mon May 16 10:51:00 2022 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file