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:
- 44:741ee27c8a34
- Parent:
- 43:291bbdba48f3
- Child:
- 46:0de65f1bd714
diff -r 291bbdba48f3 -r 741ee27c8a34 src/boards.cpp
--- a/src/boards.cpp Sat Mar 09 21:16:38 2019 +0000
+++ b/src/boards.cpp Sat Mar 09 22:32:40 2019 +0000
@@ -37,6 +37,18 @@
unsigned int boardEnableBits;
+I2C i2c(PB_6, PB_7);
+
+/*******************************************************************************
+initI2C
+*******************************************************************************/
+void initI2C(void){
+
+}
+
+/*******************************************************************************
+initBoards
+*******************************************************************************/
void initBoards(struct adcValues adcVals){
//en_out = 32;
setBoardEnables(16383);
@@ -44,6 +56,34 @@
}
/*******************************************************************************
+getMasterCommands
+*******************************************************************************/
+unsigned short getMasterCommands(void){
+ unsigned short slave_code = 0;
+ return slave_code;
+}
+
+/*******************************************************************************
+sendSlaveCommands
+*******************************************************************************/
+void sendSlaveCommands(unsigned short slave_code){
+
+ char data_write[2];
+ int status;
+
+ // Write slave1 code
+ data_write[1] = 0;
+ data_write[0] = slave_code | 0x00FF;
+ status = i2c.write(i2c_addr_slave1, data_write, 2, 0);
+
+ // Write slave2 code
+ data_write[1] = 0;
+ data_write[0] = slave_code | 0xFF00;
+ status = i2c.write(i2c_addr_slave2, data_write, 2, 0);
+
+}
+
+/*******************************************************************************
delay
*******************************************************************************/
void delay(long ticks)
@@ -194,9 +234,9 @@
/*******************************************************************************
-updateControls
+updateMasterControls
*******************************************************************************/
-void updateControls(unsigned short ref){
+unsigned short updateMasterControls(unsigned short ref){
unsigned int tBuf = getLUT_thermCode(ref);
//if(max_boards <= 3){
@@ -207,6 +247,8 @@
//unsigned int bBuf = getLUT_binCode(ref);
//en_out_code = setBoardWeights(bBuf);
//}
+ unsigned short slave_code = 0;
+ return slave_code;
}
void XupdateControls(unsigned short ref){
@@ -231,4 +273,20 @@
sendSerial("en_out_code updateControls\r\n");
wait(0.5);
+}
+
+/*******************************************************************************
+updateSlaveControls
+*******************************************************************************/
+void updateSlaveControls(unsigned short ref){
+
+ unsigned int tBuf = getLUT_thermCode(ref);
+ //if(max_boards <= 3){
+ // getLUT_binCodeArray(ref);
+ // setBoardControls(tBuf);
+ //}else{
+ //wr_out_code = setBoardEnables(tBuf);
+ //unsigned int bBuf = getLUT_binCode(ref);
+ //en_out_code = setBoardWeights(bBuf);
+ //}
}
\ No newline at end of file