Recep spi with no lib

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
SamirIss
Date:
Mon Nov 04 08:29:01 2019 +0000
Commit message:
Recep spi with no lib;

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 000000000000 -r 077ff1a96d18 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 04 08:29:01 2019 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+ 
+SPI spi(A6,A5,A4); // mosi, miso, sclk
+DigitalOut led(LED1);
+Serial pc(D1,D0);
+ 
+int main() {
+    // Chip must be deselected
+    led = 1;
+    wait(1);
+    led = 0;
+    
+        // Setup the spi for 8 bit data, high steady state clock,
+        // second edge capture, with a 1MHz clock rate
+        spi.format(8,3);
+        spi.frequency(1000000);
+    while(1){
+        led = 1;
+         spi.write(0x8F);
+        int f = spi.write(0x00);
+        pc.printf("com : 0x%X\n", f);
+        wait(0.1);
+        led = 0;
+        wait(0.1);
+    }
+}
diff -r 000000000000 -r 077ff1a96d18 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 04 08:29:01 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file