Demo example on FRDM-64F https://ide.mbed.com/compiler/#nav:/rzr-example-mbed;

Dependencies:   FXOS8700Q

Files at this revision

API Documentation at this revision

Comitter:
rzrfreefr
Date:
Wed Sep 16 14:58:57 2020 +0000
Child:
1:b2103e99708c
Commit message:
Initial import ; ; Source: https://ide.mbed.com/compiler/#nav:/rzr-example-mbed;

Changed in this revision

FXOS8700Q.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-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 16519bf92477 FXOS8700Q.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.lib	Wed Sep 16 14:58:57 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/NXP/code/FXOS8700Q/#aee7dea904e2
diff -r 000000000000 -r 16519bf92477 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 16 14:58:57 2020 +0000
@@ -0,0 +1,54 @@
+/// SPDX-License-Indentifier: MPL-2.0
+/// Copyright: 2020+ Philippe Coval <https://purl.org/rzr>
+
+#include "mbed.h"
+
+#include "EthernetInterface.h"
+#include "USBKeyboard.h"
+#include "FXOS8700Q.h"
+
+#define USB_ENABLED 1
+#define NET_ENABLED 1
+
+int main()
+{
+  printf("%s\n", __FILE__);
+  I2C i2c(PTE25, PTE24);
+  motion_data_units_t acc_data;
+  motion_data_counts_t acc_raw;
+
+  FXOS8700QAccelerometer acc(i2c, FXOS8700CQ_SLAVE_ADDR1); // Proper Ports and I2C Address for K64F Freedom board
+#ifdef USB_ENABLED
+  printf("usb:\n");
+  USBKeyboard usb; ///< https://os.mbed.com/docs/mbed-os/v6.2/apis/usbkeyboard.html
+#endif
+
+#ifdef NET_ENABLED
+  EthernetInterface eth; ///< https://os.mbed.com/docs/mbed-os/v6.2/apis/ethernet.html
+  eth.set_dhcp(true);
+  eth.connect();
+#endif
+    
+  DigitalOut led(LED1);
+
+  int16_t rmX, rmY, rmZ;
+  acc.enable();
+  printf("\r\n\nFXOS8700Q Who Am I= %X\r\n", acc.whoAmI());
+  while (true) {
+    acc.getAxis(acc_data);
+    printf("FXOS8700Q ACC: X=%1.4f Y=%1.4f Z=%1.4f  ", acc_data.x, acc_data.y, acc_data.z);
+    printf("%s\n", __FILE__);
+    led = !led;
+#ifdef NET_ENABLED
+    printf("\nClient IP Address is %s\n", eth.get_mac_address());        
+    SocketAddress a;
+    eth.get_ip_address(&a);
+    printf("IP address: %s\n", a.get_ip_address() ? a.get_ip_address() : "None");
+#endif
+#ifdef USB_ENABLED
+    usb.connect();
+    usb.printf("# \n");
+#endif
+    ThisThread::sleep_for(1000.f);
+  }
+}
diff -r 000000000000 -r 16519bf92477 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Sep 16 14:58:57 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#aa70f680bb5755e8fea3f93fc6e04d9b3de235bb