SPU Master

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jimmy4399
Date:
Wed Jul 24 01:54:52 2019 +0000
Commit message:
SPI Master;

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 24 01:54:52 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+DigitalOut cs(PB_6);
+
+SPI spi(PA_7, PA_6, PB_3); // mosi, miso, sclk
+
+void init(void)
+{
+    spi.format(8,0);
+    spi.frequency(1000000);   //default frequency 1MHZ     
+    cs = 1;
+}
+
+int main() 
+{
+    while(1)
+    {
+        cs = 0;
+    
+        spi.write(0x8F);
+ 
+        cs = 1;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jul 24 01:54:52 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file