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.
Dependencies: mbed SerialInputReactionHandler AMPulseTrain SwArr16MOSFET StrCommandHandler KajiLabES
Diff: main.cpp
- Revision:
- 2:5cb68cc8ecaa
- Parent:
- 1:b97639dad576
diff -r b97639dad576 -r 5cb68cc8ecaa main.cpp
--- a/main.cpp Wed Oct 23 20:08:31 2019 +0000
+++ b/main.cpp Wed Nov 27 23:41:55 2019 +0000
@@ -1,81 +1,32 @@
#include "mbed.h"
-#include "KajiLabES.h"
-#include "PMRC16ch.h"
-#include "sigbind.h"
-#include <iostream>
-#include <bitset>
-ProcessState pstate = WAIT_A_CERTAIN_KEY;
-ElectrodeSpacing spacing = WIDE_CONDITION;
-StimulationMode smode = BIPOLAR;
-Serial pc(USBTX, USBRX); // tx, rx
+#include "subroutines.h"
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);
-KajiLabES stimulator;
-PMRC16ch pmrc(16);
-uint32_t pw;//pulse width
-uint32_t pp;//pulse period
-uint32_t ph;//pulse hight
+ProcessState pstate = WAIT_A_CERTAIN_KEY;
int main()
{
- stimulator.init();
- myled1 = 1;
- pmrc.allHiZ();
- myled2 = 1;
- {
- using namespace aktk_sigbind;
- pc.baud(921600);
- pc.attach(&keyBind);
- pw = 100;
- pp = 5000;
- ph = 0;
- printKBManual();
- wait(.5);
+ printf("SystemCoreClock = %d Hz\n", SystemCoreClock);
+ myled1 = myled2 = myled3 = myled4 = 0;
+ init();
+
+PRELOOP_POINT:
+ while (pstate == WAIT_A_CERTAIN_KEY) {
+ wait(0.5);
+ myled3 = (!myled3);
}
- while(1) {
- while (pstate == WAIT_A_CERTAIN_KEY) {
- myled3 = (!myled3);
- wait(0.5);
- }
- myled3 = 1;
- pmrc.setPol(PMRC16ch::Cathodic);
- while (pstate == MAIN_ROUTINE) {
-
- for (int i = 0; i < 2; i++) {
- switch(smode){
- case BIPOLAR: pmrc.setPol((PMRC16ch::Polarity)i); break;
- case CATHODIC: pmrc.setPol(PMRC16ch::Cathodic); break;
- case ANODIC: pmrc.setPol(PMRC16ch::Anodic); break;
- }
- if(spacing == WIDE_CONDITION)
- //pmrc.setTrio(3,1,5);
- pmrc.setTwin(1, 2);
- else
- //pmrc.setTrio(3,2,4);
- pmrc.setTwin(1, 3);
- wait_us(pp-pw);
- stimulator.DAAD(ph);
- wait_us(pw);
- stimulator.DAAD(0);
- }
- /*
- for(int i = 0; i < 2; i++) {
- pmrc.setTwin(i+1, (i+1)%8+1);
- //pmrc.setTwin(i+1, (i+1)%8+1);
- //pmrc.setTwin(i+1, (i+1)%8+1);
- //pmrc.setOvsO(i+1);
- wait_us(pp-pw);
- stimulator.DAAD(ph);
- wait_us(pw);
- stimulator.DAAD(0);
- //pmrc.allHiZ();
- //wait_us(pw);
- }
- */
- if (pstate == TERMINATED) break;
- }
+
+
+ myled3 = 1;
+ while(pstate == MAIN_ROUTINE) {
+ wait(.1);
+ myled3 = (!myled3);
}
-}
+
+
+ myled3 = 0;
+ goto PRELOOP_POINT;
+}
\ No newline at end of file