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.
Dependencies: mbed mpu9250_i2c IM920 BMP180 GPS millis
Revision 6:97aaf594d810, committed 2021-12-16
- Comitter:
- katoshunsuke
- Date:
- Thu Dec 16 16:14:04 2021 +0000
- Parent:
- 5:b0bb11afabfd
- Commit message:
- change for use
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMP180.lib Thu Dec 16 16:14:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/kgills/code/BMP180/#b2219e6e444b
--- a/ExioBufferdController.lib Tue Nov 22 11:25:54 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/users/ryood/code/ExioBufferdController/#cc3b65d44e9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GPS.lib Thu Dec 16 16:14:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Tomo073/code/GPS/#b97034d6df35
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IM920.lib Thu Dec 16 16:14:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/okini3939/code/IM920/#2fd9b1725283
--- a/MCP23S17.lib Tue Nov 22 11:25:54 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/users/stjo2809/code/MCP23S17/#b2a44e1e54b8
--- a/SDFileSystem.lib Tue Nov 22 11:25:54 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/users/ryood/code/SDFileSystem/#0475419924d4
--- a/main.cpp Tue Nov 22 11:25:54 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * SDFileSystem Binary R/W Test
- *
- * Library
- * SDFileSystem: https://developer.mbed.org/users/neilt6/code/SDFileSystem/ Revision:26
- * mbed: Revision: 124
- * mbed-rtos: Revision: 117
- *
- * 2016.11.22 created
- *
- */
-
-#include "mbed.h"
-#include "rtos.h"
-#include "SDFileSystem.h"
-
-#include "ExioMcp23s17.h"
-#include "ExioInBuffer.h"
-#include "ExioBufferedIn.h"
-#include "ExioBufferedDebounceIn.h"
-
-typedef struct {
- uint8_t x;
- uint8_t y;
- uint8_t z;
-} DataT;
-
-//SPI Spi(PC_12, PC_11, PC_10); // SPI3: mosi, miso, sclk
-SDFileSystem sd(PC_12, PC_11, PC_10, PA_14, "sd"); // SPI3: mosi, miso, sclk, cs
-
-void writeSD(DataT* data)
-{
- //Mount the filesystem
- sd.mount();
-
- //Perform a write test
- printf("\r\nWriting binary data to SD card...");
- FileHandle* file = sd.open("Test File.bin", O_WRONLY | O_CREAT | O_TRUNC);
- if (file != NULL) {
- if (file->write(data, sizeof(*data)) != sizeof(*data)) {
- error("write error!\r\n");
- }
- if (file->close()) {
- printf("failed to close file!\r\n");
- } else {
- printf("done!\r\n");
- }
- } else {
- printf("failed to create file!\r\n");
- }
-
- //Unmount the filesystem
- sd.unmount();
-}
-
-void readSD(DataT* data)
-{
- //Mount the filesystem
- sd.mount();
-
- //Perform a read test
- printf("\r\nReading binary data from SD card...");
- FileHandle* file = sd.open("Test File.bin", O_RDONLY);
- if (file != NULL) {
- if (file->read(data, sizeof(*data)) != sizeof(*data)) {
- error("read error!\r\n");
- }
- if (file->close()) {
- printf("failed to close file!\r\n");
- } else {
- printf("done!\r\n");
- }
- } else {
- printf("failed to open file!\r\n");
- }
-
- //Unmount the filesystem
- sd.unmount();
-}
-
-int main()
-{
- DataT data, rdata;
-
- data.x = 0xff;
- data.y = 0x55;
- data.z = 0xaa;
-
- printf("*** Test SDFileSystem & ExioBufferedDebounceIn ***\r\n");
-
- // ExioMcp23s17(int hardwareaddress, SPI& spi, PinName nCs, PinName nReset);
- ExioMcp23s17 Exio(0x00, *sd.SpiPointer(), PD_2, PA_13);
-
- // Reset MCP23S17 (初期化時にreset()が必要)
- Exio.reset();
-
- ExioInBuffer inBufferB(&Exio, ExioPortB);
- ExioBufferedDebounceIn inB[] = {
- ExioBufferedDebounceIn(&inBufferB, 0),
- ExioBufferedDebounceIn(&inBufferB, 1),
- ExioBufferedDebounceIn(&inBufferB, 2),
- ExioBufferedDebounceIn(&inBufferB, 3),
- ExioBufferedDebounceIn(&inBufferB, 4),
- ExioBufferedDebounceIn(&inBufferB, 5),
- ExioBufferedDebounceIn(&inBufferB, 6),
- ExioBufferedDebounceIn(&inBufferB, 7)
- };
-
- // Start Timers
- inBufferB.run(10);
- for (int i = 0; i < 8; i++) {
- inB[i].set_debounce_us(10000);
- }
-
- // SDカードの読み書きの前にExioのSPIアクセスを停止
- inBufferB.stop();
-
- writeSD(&data);
- readSD(&rdata);
-
- // ExioのSPIアクセスを再開
- inBufferB.run(10);
-
- printf("data: x:%02x y:%02x z:%02x\r\n", rdata.x, rdata.y, rdata.z);
-
- while(1) {
- uint8_t x = 0;
- for (int i = 0; i < 8; i++) {
- int vb = inB[i].read();
- x |= (vb << i);
- }
- if (x != 0 && data.x != x) {
- data.x = x;
- printf("Write to SD: x:%02x y:%02x z:%02x\r\n", data.x, data.y, data.z);
- // SDカードの読み書きの前にExioのSPIアクセスを停止
- inBufferB.stop();
- writeSD(&data);
- readSD(&rdata);
- // ExioのSPIアクセスを再開
- inBufferB.run(10);
- printf("Read from SD: x:%02x y:%02x z:%02x\r\n", rdata.x, rdata.y, rdata.z);
- }
- }
-}
--- a/mbed-rtos.lib Tue Nov 22 11:25:54 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#4c105b8d7cae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.lib Thu Dec 16 16:14:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/hudakz/code/millis/#ac7586424119
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpu9250_i2c.lib Thu Dec 16 16:14:04 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Gaku0606/code/mpu9250_i2c/#fad6675651c1