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.
Diff: main.cpp
- Revision:
- 4:6d6ea85642ed
- Parent:
- 3:4d7be22641c1
- Child:
- 5:bbd17b77d405
diff -r 4d7be22641c1 -r 6d6ea85642ed main.cpp
--- a/main.cpp Sat Aug 17 03:29:11 2019 +0000
+++ b/main.cpp Tue Dec 24 10:30:40 2019 +0000
@@ -6,12 +6,16 @@
* http://www.page.sannet.ne.jp/kenjia/index.html
* https://os.mbed.com/users/kenjiArai/
* Created: April 4th, 2018
- * Revised: August 17th, 2019
+ * Revised: December 24th, 2019
*/
/*
- Tested board on OS5 & OS2:
+ Tested board on OS2:
Nucleo-F401RE, -F411RE, -F446RE, -L073RZ, -L152RE, -L476RG
+ Tested board on OS5.15.0
+ Nucleo-F401RE, -F411RE, -F446RE, -L152RE, -L073RZ, -L476RG
+ nRF52840-DK, nRF52-DK
+ FRDM-F64K
*/
// Include --------------------------------------------------------------------
@@ -43,10 +47,18 @@
// Constructor ----------------------------------------------------------------
Serial pc(USBTX, USBRX, 115200);
+#if defined(TARGET_NRF52840_DK) || defined(TARGET_NRF52_DK) ||\
+ defined(TARGET_K64F)
+DigitalIn user_sw(BUTTON1, PullUp);
+#else
DigitalIn user_sw(USER_BUTTON);
+#endif
#if (MBED_MAJOR_VERSION == 5)
+#if defined(TARGET_NRF52840_DK) || defined(TARGET_NRF52_DK)
+SDBlockDevice sd(D11, D12, D13, D10, 8000000);
+#else
SDBlockDevice sd(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, 12000000);
-//SDBlockDevice sd(D11, D12, D13, D10, 8000000);
+#endif
FATFileSystem fs("fs");
#endif
Timer tmr;
@@ -104,8 +116,9 @@
DBG("line:%d\r\n", __LINE__);
tmr.reset();
tmr.start();
- uint32_t size = get_disk_freespace();
- pc.printf("free %u ", size);
+ uint32_t size_disk = get_disk_freespace();
+ uint32_t size_file = get_data_file_size("mydata.txt");
+ pc.printf("free disk:%u, file:%u ", size_disk, size_file);
fp = fopen("/fs/mydata.txt", "a");
if(fp != 0) {
char tmp[64];
@@ -123,7 +136,7 @@
}
fclose(fp);
uint32_t time_sd = tmr.read_ms();
- pc.printf("time:%d ", time_sd);
+ pc.printf("time:%3d ", time_sd);
#if (MBED_MAJOR_VERSION == 2)
if (time_sd < LOOP_TIME -2){
wait_ms(LOOP_TIME - time_sd);