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
Diff: src/boards.cpp
- Revision:
- 4:db38665c3727
- Parent:
- 1:9f8583ba2431
- Child:
- 5:09be5bbb5020
--- a/src/boards.cpp Tue Nov 27 17:47:57 2018 +0000 +++ b/src/boards.cpp Thu Nov 29 00:07:25 2018 +0000 @@ -33,7 +33,7 @@ #include "serial.h" #include "stdio.h" #include "parameters.h" - +#include "lut.h" unsigned int boardEnableBits; @@ -44,7 +44,7 @@ for(i=0;i<ticks;i++); } -void setBoardEnables(unsigned int enableBits) +void setBoardEnables(unsigned int enableBits[]) { unsigned int i, boardEnable; @@ -54,7 +54,7 @@ for (i = 0; i < MAX_BOARDS; i++) { // 0 == enabled - boardEnable = (enableBits & (1 << i)); + boardEnable = (enableBits[i] & (1 << i)); } @@ -62,14 +62,14 @@ } -void setBoardWeights(unsigned int enableWeights) +void setBoardWeights(unsigned int enableWeights[]) { unsigned int i, boardWeight; for (i = 0; i < MAX_BOARDS; i++) { // 0 == enabled - boardWeight = (enableWeights & (1 << i)); + boardWeight = (enableWeights[i] & (1 << i)); } @@ -115,4 +115,58 @@ return 0; } +} + +// start the converter +// RK: ch[i][reg].enabled has not been used correctly yet. Need to modify that code. +void startConverter(unsigned int reg) +{ + + int i; + //float period; + + running = TRUE; + + unsigned int boardsEnabled = 0; + + char stemp[50]; + + for (i = 0; i < MAX_BOARDS; i++) + { + //if (ch[i][reg].enabled == 1) + //{ + // Set the corresponding bit + boardsEnabled |= (1 << i); + + sprintf(stemp, "\n\rBoard %d RUNNING", i + 1); + sendSerial(stemp); + //} + } + + // Invert the bits because 0 == enabled on the SPI write + //boardsEnabled = ~boardsEnabled; + + // Fire in the hole! + setBoardEnables(thermCode); + + //setupRunVoltages(); + + //currentRegister = reg; + + //pulser.attach_us(&pulserInt, period); +} + +// stop the converter and set outputs to 0 +void stopConverter(void) +{ + //pulser.detach(); + setBoardEnables(ALLOFF); + running = FALSE; + +} + +void updateControls(void){ + getLUTcode(); + setBoardEnables(thermCode); + setBoardWeights(binCode); } \ No newline at end of file