Domenico Vitale / Mbed 2 deprecated Sens_Temp_SPI

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
domemort
Date:
Wed Nov 03 15:36:25 2021 +0000
Commit message:
-

Changed in this revision

master.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
slave.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/master.cpp	Wed Nov 03 15:36:25 2021 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+SPI          port(D11, D12, D13);
+DigitalOut   cs(D7);
+AnalogIn     adc_temp(ADC_TEMP);
+
+char         buffer[2];
+
+int main(){
+    cs=1;
+    port.format(8,3);
+    port.frequency(1000000);
+       while(1){
+           cs=1;
+           buffer[0] = adc_temp.read();
+           buffer[1] = adc_temp.read()<<8;
+           cs=0;
+           port.write(buffer[0]);
+           cs=1;
+           cs=0;
+           port.write(buffer[1]);
+           wait_ms(50);
+           }
+    
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 03 15:36:25 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/slave.cpp	Wed Nov 03 15:36:25 2021 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+SPISlave         port(D11, D12, D13, D7);
+Serial           pc(USBTX, USBRX);
+
+int main(){
+    while (1){
+        
+        
+        
+        
+        
+        }
+    
+    
+    
+    
+    
+    
+    
+    }
\ No newline at end of file