出力ポートを,オープンドレインまたはプッシュプルに設定するグローバル関数の使用例. Example of global functions for setting the output port bits as open-drain or push-pull.

Dependencies:   mbed UIT_SetOutputPortType

Revision:
1:5bf39be14d61
Parent:
0:09d27b602681
Child:
2:966a8ad956d3
--- a/main.cpp	Sat Aug 22 03:05:33 2015 +0000
+++ b/main.cpp	Sun Aug 30 08:55:01 2015 +0000
@@ -3,7 +3,7 @@
 // (Example of global functions for setting the output port bit
 //  as open-drain or push-pull)
 //
-// 2015/08/22, Copyright (c) 2015 MIKAMI, Naoki
+// 2015/08/30, Copyright (c) 2015 MIKAMI, Naoki
 //---------------------------------------------------------------------------------
 
 #include "SetOutputPortType.hpp"
@@ -31,16 +31,24 @@
     
     bus_ = 0x7F;
     SetOpenDrain(D2, D3, D4, D5, D6, D7, D8);
-    WaitButton("\r\n\nD2 - D8: open drain");
-    printf("\r\nGPIOB pull-up/pull-down Reg.: 0x%04x", GPIOB->OTYPER);
+    printf("\r\n\nGPIOB output type Reg.: 0x%04x", GPIOB->OTYPER);
+    printf("\r\nGPIOA output type Reg.: 0x%04x", GPIOA->OTYPER);
+    WaitButton("\r\nD2 - D8: open drain\r\n");
     
     SetPushPull(D2, D3, D4, D5, D6, D7, D8);
-    WaitButton("\r\nD2 - D8: push-pull");
+    printf("\r\nGPIOB output type Reg.: 0x%04x", GPIOB->OTYPER);
+    printf("\r\nGPIOA output type Reg.: 0x%04x", GPIOA->OTYPER);
+    WaitButton("\r\nD2 - D8: push-pull\r\n");
+
     SetOpenDrain(D2);
-    WaitButton("\r\nD2: open drain");
+    printf("\r\nGPIOB output type Reg.: 0x%04x", GPIOB->OTYPER);
+    printf("\r\nGPIOA output type Reg.: 0x%04x", GPIOA->OTYPER);
+    WaitButton("\r\nD2: open drain\r\n");
     
     SetOpenDrain(D3, D4);
-    printf("\r\nD2 - D4: open drain");
+    printf("\r\nGPIOB output type Reg.: 0x%04x", GPIOB->OTYPER);
+    printf("\r\nGPIOA output type Reg.: 0x%04x", GPIOA->OTYPER);
+    printf("\r\nD2 - D4: open drain\r\n");
     
     while (true);
 }
\ No newline at end of file