aaa

Dependencies:   mbed-STM32F103C8T6 mbed

Fork of STM32F103C8T6_USBSerial by Zoltan Hudak

Files at this revision

API Documentation at this revision

Comitter:
artembio
Date:
Mon Feb 19 11:52:44 2018 +0000
Parent:
5:0be85f1bdb35
Commit message:
aaa

Changed in this revision

MCP4822.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice_STM32F103.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0be85f1bdb35 -r d3175b589df4 MCP4822.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP4822.lib	Mon Feb 19 11:52:44 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Lerche/code/MCP4822/#96eff565b2c0
diff -r 0be85f1bdb35 -r d3175b589df4 USBDevice_STM32F103.lib
--- a/USBDevice_STM32F103.lib	Wed Apr 26 17:57:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/users/hudakz/code/USBDevice_STM32F103/#c86eab438152
diff -r 0be85f1bdb35 -r d3175b589df4 main.cpp
--- a/main.cpp	Wed Apr 26 17:57:55 2017 +0000
+++ b/main.cpp	Mon Feb 19 11:52:44 2018 +0000
@@ -1,21 +1,19 @@
 #include "stm32f103c8t6.h"
-#include "mbed.h"
-#include "USBSerial.h"
+#include "mbed.h" 
+#include "MCP4822.h"
 
-DigitalOut  myled(LED1);
+MCP4822 MCP(SPI_MOSI, SPI_SCK, SPI_CS);    // MOSI, SCLK, nCS
 
-int main() {
-    confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)
-    
-    Serial    pc(PA_2, PA_3);
-    //USBSerial usbSerial;  // connection must be blocked when USB is not plugged in
-    USBSerial usbSerial(0x1f00, 0x2012, 0x0001,  false);    // connection is not blocked when USB is not plugged in
-    
-    while(1) {
-        myled = !myled;
-        pc.printf("I am a serial port\r\n");            // 9600 bit/s
-        usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
-        wait_ms(1000);
-    }
-}
-
+int main() {                
+    while(1){
+    MCP.writeA(1650);       // 1650 V out
+    MCP.writeB(1650);       // Same on B output
+    wait(5);
+    MCP.writeA(0);          // Zero v out
+    MCP.writeB(0);          // Same on B
+    wait(5);
+    MCP.writeA(3300);       // Guess what? 
+    MCP.writeB(3300);       // 3.3 V
+    wait(5);
+    }                       // Return to beginning. 
+}
\ No newline at end of file