Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: SerialControl.c
- Revision:
- 0:70e79ca6391c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialControl.c Wed Mar 16 10:20:41 2011 +0000
@@ -0,0 +1,87 @@
+#include "mbed.h"
+#include "header.h"
+extern float InputLightLevel; // in dBm
+extern float OutputLightLevel; // in dBm
+extern float ReflectedLightLevel; // in dBm
+extern float PumpLightLevel1; // in dBm
+extern float PumpLightLevel2; // in dBm
+extern float InputLightLevelM;
+extern float OutputLightLevelM;
+extern float ReflectedLightLevelM;
+extern float PumpLightLevel1M;
+extern float PumpLightLevel2M;
+extern float AmplifierGain; //in dB
+extern float AmplifierPower; //in dBm
+extern char AmplifierMode; // C = Constant Current, G = Constant Gain, P = constant output power
+extern float PumpCurrent1; // mA
+extern float PumpCurrent2; // mA
+extern char SerialControl;
+
+Serial disp(USBTX, USBRX); // usb for now
+void waitforcommand(void)
+{
+ char c;
+ int i;
+ float f;
+
+ disp.scanf("%c,%d,%f",&c,&i,&f);
+ disp.printf("<%c><%d><%f>\n\r",c,i,f);
+ if ((c == 'r') || (c == 'R'))
+ {
+ switch (i)
+ {
+ case 0:
+ disp.printf("%f",InputLightLevel);
+ break;
+ case 1:
+ disp.printf("%f",OutputLightLevel);
+ break;
+ case 2:
+ disp.printf("%f",ReflectedLightLevel);
+ break;
+ case 3:
+ disp.printf("%f",PumpLightLevel1);
+ break;
+ case 4:
+ disp.printf("%f",PumpLightLevel2);
+ break;
+ case 5:
+ disp.printf("%f",AmplifierGain);
+ break;
+ case 6:
+ disp.printf("%f",AmplifierPower);
+ break;
+ case 7:
+ disp.printf("%c",AmplifierMode);
+ break;
+ case 8:
+ disp.printf("%f",PumpCurrent1);
+ break;
+ case 9:
+ disp.printf("%f",PumpCurrent2);
+ break;
+
+ }
+ }
+ if ((c == 'w') || (c == 'W'))
+ {
+ switch (i)
+ {
+ case 5:
+ AmplifierGain=f;
+ break;
+ case 6:
+ AmplifierPower=f;
+ break;
+ case 7:
+ //AmplifierMode);
+ break;
+ case 8:
+ PumpCurrent1=f;
+ break;
+ case 9:
+ PumpCurrent2=f;
+ break;
+ }
+ }
+}
\ No newline at end of file