Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rf4f7e0ee3baef51d91de64d44a0a00ff967f56c0 -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision f4f7e0ee3baef51d91de64d44a0a00ff967f56c0) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -19,6 +19,8 @@ #include "can.h" #include "etpwm.h" +#include "gio.h" +#include "reg_het.h" #include "Battery.h" #include "BloodFlow.h" @@ -149,14 +151,15 @@ NUM_OF_BLOOD_FLOW_SELF_TEST_STATES ///< Number of blood pump self-test states } BLOOD_FLOW_SELF_TEST_STATE_T; -// Pin assignments for pump stop and direction outputs -#define STOP_CAN3_PORT_MASK 0x00000002 // (Tx - re-purposed as output GPIO for blood pump stop signal) -#define DIR_CAN3_PORT_MASK 0x00000002 // (Rx - re-purposed as output GPIO for blood pump direction signal) +// Pin assignments for pump stop and direction outputs and rotor hall sensor input +#define STOP_CAN3_PORT_MASK 0x00000002 ///< (Tx - re-purposed as output GPIO for blood pump stop signal) +#define DIR_CAN3_PORT_MASK 0x00000002 ///< (Rx - re-purposed as output GPIO for blood pump direction signal) +#define BP_ROTOR_HALL_SENSOR_NHET_ID 0x0000000C ///< NHET pin number associated with BP rotor hall sensor input // Blood pump stop and direction macros -#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} // Macro to set blood pump direction signal high. -#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} // Macro to set blood pump direction signal low. -#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} // Macro to set blood pump stop signal (active low). -#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} // Macro to clear blood pump stop signal (active low). +#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal high. +#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal low. +#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} ///< Macro to set blood pump stop signal (active low). +#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} ///< Macro to clear blood pump stop signal (active low). // ********** private data ********** @@ -960,6 +963,7 @@ { BLOOD_PUMP_STATUS_PAYLOAD_T payload; HD_OP_MODE_T opMode = getCurrentOperationMode(); + U32 hallSensor = gioGetBit( hetPORT1, BP_ROTOR_HALL_SENSOR_NHET_ID ); payload.setPoint = targetBloodFlowRate; payload.measFlow = getMeasuredBloodFlowRate(); @@ -977,6 +981,7 @@ { payload.presFlow = 0; } + payload.rotorHall = ( hallSensor > 0 ? 0 : 1 ); // 1=home, 0=not home broadcastData( MSG_ID_BLOOD_FLOW_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&payload, sizeof( BLOOD_PUMP_STATUS_PAYLOAD_T ) ); bloodFlowDataPublicationTimerCounter = 0; } Index: firmware/App/Controllers/BloodFlow.h =================================================================== diff -u -r0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision 0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa) +++ firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -50,6 +50,7 @@ F32 pwmDC; U32 rotorCount; U32 presFlow; + U32 rotorHall; } BLOOD_PUMP_STATUS_PAYLOAD_T; // ********** public function prototypes ********** Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r55ae901025333639420cb770cd5e7c1dca78afd3 -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 55ae901025333639420cb770cd5e7c1dca78afd3) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -20,6 +20,7 @@ #include "etpwm.h" #include "gio.h" #include "mibspi.h" +#include "reg_het.h" #include "Battery.h" #include "DialInFlow.h" @@ -158,9 +159,10 @@ NUM_OF_DIAL_IN_FLOW_SELF_TEST_STATES ///< Number of dialysate inlet pump self-test states. } DIAL_IN_FLOW_SELF_TEST_STATE_T; -// Pin assignments for pump stop and direction outputs +// Pin assignments for pump stop and direction outputs and DPi rotor hall sensor input #define STOP_DI_PUMP_GIO_PORT_PIN 2U ///< Pin # on GIO A for stopping the dialysate inlet pump. #define DIR_DI_PUMP_SPI5_PORT_MASK 0x00000100 ///< Pin on unused SPI5 peripheral (ENA) - re-purposed as output GPIO to set dialysate inlet pump direction. +#define DIP_ROTOR_HALL_SENSOR_NHET_ID 0x0000001E ///< NHET pin number associated with DPi rotor hall sensor input // DialIn pump stop and direction macros #define SET_DIP_DIR() {mibspiREG5->PC3 |= DIR_DI_PUMP_SPI5_PORT_MASK;} ///< Macro for setting the dialysate inlet pump direction pin high. #define CLR_DIP_DIR() {mibspiREG5->PC3 &= ~DIR_DI_PUMP_SPI5_PORT_MASK;} ///< Macro for setting the dialysate inlet pump direction pin low. @@ -1099,6 +1101,7 @@ { DIALIN_PUMP_STATUS_PAYLOAD_T payload; HD_OP_MODE_T opMode = getCurrentOperationMode(); + U32 hallSensor = gioGetBit( hetPORT1, DIP_ROTOR_HALL_SENSOR_NHET_ID ); payload.setPoint = targetDialInFlowRate; payload.measFlow = getMeasuredDialInFlowRate(); @@ -1116,6 +1119,7 @@ { payload.presFlow = 0; } + payload.rotorHall = ( hallSensor > 0 ? 0 : 1 ); // 1=home, 0=not home broadcastData( MSG_ID_DIALYSATE_FLOW_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&payload, sizeof( DIALIN_PUMP_STATUS_PAYLOAD_T ) ); dialInFlowDataPublicationTimerCounter = 0; } Index: firmware/App/Controllers/DialInFlow.h =================================================================== diff -u -r0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision 0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa) +++ firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -47,6 +47,7 @@ F32 pwmDC; U32 rotorCount; U32 presFlow; + U32 rotorHall; } DIALIN_PUMP_STATUS_PAYLOAD_T; // ********** public function prototypes ********** Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r3d409ee7130063937dce719281bb072c87023d3f -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 3d409ee7130063937dce719281bb072c87023d3f) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -20,6 +20,7 @@ #include "etpwm.h" #include "gio.h" #include "mibspi.h" +#include "reg_het.h" #include "Battery.h" #include "DialOutFlow.h" @@ -143,11 +144,13 @@ NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES ///< Number of dialysate outlet pump self-test states. } DIAL_OUT_PUMP_SELF_TEST_STATE_T; -// Pin assignments and macros for pump stop and direction outputs +// Pin assignments for pump stop and direction outputs and DPo rotor hall sensor input #define STOP_DO_PUMP_MIBSPI1_PORT_MASK 0x00000400 ///< MIBSPI1 SIMO[0] - re-purposed as GPIOoutput for pump controller run/stop pin. +#define STOP_DO_PUMP_GIO_PORT_PIN 6U ///< GIO port A pin used for pump controller direction pin. +#define DOP_ROTOR_HALL_SENSOR_NHET_ID 0x0000000E ///< NHET pin number associated with DPo rotor hall sensor input +// Dialysate outlet pump stop and direction macros #define SET_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to stop. #define CLR_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to run. -#define STOP_DO_PUMP_GIO_PORT_PIN 6U ///< GIO port A pin used for pump controller direction pin. #define SET_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) ///< Macro sets pump controller direction to forward direction. #define CLR_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_LOW ) ///< Macro sets pump controller direction to reverse direction. @@ -900,6 +903,7 @@ if ( ++dialOutFlowDataPublicationTimerCounter >= getU32OverrideValue( &dialOutDataPublishInterval ) ) { DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; + U32 hallSensor = gioGetBit( hetPORT1, DOP_ROTOR_HALL_SENSOR_NHET_ID ); dialOutBroadCastVariables.refUFVolMl = getTotalTargetDialOutUFVolumeInMl(); dialOutBroadCastVariables.measUFVolMl = getTotalMeasuredUFVolumeInMl(); @@ -911,6 +915,7 @@ dialOutBroadCastVariables.dopCorrOffset = dopRateCorrectionOffset; dialOutBroadCastVariables.dopCalcRate = dopMeasuredRate; dialOutBroadCastVariables.ufCalcRate = ufMeasuredRate; + dialOutBroadCastVariables.rotorHall = ( hallSensor > 0 ? 0 : 1 ); // 1=home, 0=not home broadcastData( MSG_ID_DIALYSATE_OUT_FLOW_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&dialOutBroadCastVariables, sizeof( DIAL_OUT_FLOW_DATA_T ) ); dialOutFlowDataPublicationTimerCounter = 0; Index: firmware/App/Controllers/DialOutFlow.h =================================================================== diff -u -r01588478fb5cb7e78646b3646ba70a40269db20c -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 --- firmware/App/Controllers/DialOutFlow.h (.../DialOutFlow.h) (revision 01588478fb5cb7e78646b3646ba70a40269db20c) +++ firmware/App/Controllers/DialOutFlow.h (.../DialOutFlow.h) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) @@ -47,6 +47,7 @@ F32 dopCorrOffset; ///< Latest correction offset for calculated DPo flow rate. F32 dopCalcRate; ///< Latest calculated DPo flow rate. F32 ufCalcRate; ///< Latest calculated UF rate. + U32 rotorHall; ///< Latest rotor hall sensor state (1=home, 0=not home) } DIAL_OUT_FLOW_DATA_T; #pragma pack(pop)