diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-10-25 13:37:22 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-10-25 13:37:22 +0200 |
| commit | 63f3186821cfa8db9770dcd6b305b385eb75ed6e (patch) | |
| tree | 9d82337051e0f79cf54e20aa86aba63211fd5031 /Software/Embedded_SW/Embedded | |
| parent | f20922743b92f60e8b9d10589a5e5a1ca6f838b9 (diff) | |
| download | Tango-63f3186821cfa8db9770dcd6b305b385eb75ed6e.tar.gz Tango-63f3186821cfa8db9770dcd6b305b385eb75ed6e.zip | |
shinko comm - working only with stub
Diffstat (limited to 'Software/Embedded_SW/Embedded')
7 files changed, 43 insertions, 4 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c index 6a902f89d..ce462876b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C_Task.c @@ -84,6 +84,7 @@ typedef enum WHS_SET_CLEAN_AIR, WHS_I2C_EEPROM_WRITE, WHS_I2C_EEPROM_READ, + WHS_I2C_RS485_DIRECTION, WHS_stop }I2C_ReadingMessages; @@ -608,6 +609,18 @@ void Trigger_WHS_I2C_EEprom_Read(uint32_t address, uint16_t size, uint8_t *p_dat Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); return; } + +void Trigger_RS485_Direction(bool TX_OR_RX) +{ + I2C_ReadingMessageStruc I2C_ReadingMessage; + + I2C_ReadingMessage.messageId = WHS_I2C_RS485_DIRECTION; + I2C_ReadingMessage.parameter = TX_OR_RX; + if (I2C_ReadingMsgQ != NULL) + Mailbox_post(I2C_ReadingMsgQ , &I2C_ReadingMessage, BIOS_NO_WAIT); + return; +} + void I2C_ReadingTask(UArg arg0, UArg arg1); void I2C_ReadingTask_Init(void) { @@ -824,6 +837,9 @@ void I2C_ReadingTask(UArg arg0, UArg arg1) case WHS_I2C_EEPROM_READ: // WHS_I2C_EEprom_Read(I2C_ReadingMessage.parameter, I2C_ReadingMessage.parameter2, I2C_ReadingMessage.parameter3); break; + case WHS_I2C_RS485_DIRECTION: + RS485_Change_Direction(I2C_ReadingMessage.parameter); + break; default: break; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c index 8ebd5a83d..5ce04aab9 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.c @@ -701,6 +701,20 @@ bool WHS_Reset_485(bool value) return status; } + +uint8_t RS485_Change_Direction(bool TX_OR_RX)//TX or RX - trigger i2c task +{ + if(TX_OR_RX == TX) + Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_ACTLOW_DE_REn = true; + else + Whs_I2C_EXP_U4_0x42_VALUE.bits.VALUE_ACTLOW_DE_REn = false; + + WHS_Write_IO(I2CExp2_ADDRESS,D_TCA9555_PORT_0); + + return OK; + +}; + uint8_t RS485_Direction(bool TX_OR_RX)//TX or RX { if(TX_OR_RX == TX) @@ -708,10 +722,13 @@ uint8_t RS485_Direction(bool TX_OR_RX)//TX or RX else Write_WHS_9555_io_value(I2CExp2_ADDRESS, D_TCA9555_PORT_0, 0, false); + //RS485_Change_Direction(TX_OR_RX); + return OK; } + //------------------------------ uint8_t WHS_Test_IO() { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h index 9b49861fb..e017bb14a 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h @@ -177,6 +177,7 @@ bool Write_WHS_pump(bool state); bool WHS_Control_blub(bool value); uint8_t RS485_Direction(bool TX_OR_RX);//TX or RX +uint8_t RS485_Change_Direction(bool TX_OR_RX); //------------------------------ uint8_t WHS_Test_IO(); diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c index 9f80f4487..ebefafbdd 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c +++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/WHS_Controller_Comm/WHS_UART/WHS_Uart.c @@ -100,7 +100,7 @@ uint8_t Uart3_Transmit(uint8_t * Uart3_Tx_Buff, uint32_t Length) for(i=0;i<Length-1;i++) { - ROM_UARTCharPutNonBlocking(UART3_BASE,temp_buf[i]);//send data + ROM_UARTCharPut/*NonBlocking*/(UART3_BASE,temp_buf[i]);//send data } return Status; @@ -114,7 +114,7 @@ uint8_t Uart3_Receive(uint8_t * Uart3_Rx_Buff, uint32_t RX_Length) for(i=0;i<RX_Length;i++) { - temp_buf[i] = ROM_UARTCharGetNonBlocking(UART3_BASE);//Receive data + temp_buf[i] = ROM_UARTCharGet/*NonBlocking*/(UART3_BASE);//Receive data if ((i == 0) && (temp_buf[0] == 0) )// There isn't communication / The controller is not connected - Shinko_Header_Asccii_ACK = 0x06 { #warning Add error / block communication diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 2fc3bef6a..1db7b8541 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -274,6 +274,9 @@ int main(void) Check_Head_Type_Via_EEPROM();//without trigger Check_WHS_Type_Via_EEPROM();//without trigger I2C_BUSY_DELAY = 100; //temporary workaround!!! + + //WHS_Type = WHS_TYPE_NEW; //for testing + if ((Head_Type >= HEAD_TYPE_UNKNOWN_WITH_CARD)&&(WHS_Type == WHS_TYPE_NEW)) { PP_Machine = true; diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 2073fbaf0..25a51edfa 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -188,6 +188,8 @@ uint32_t HWConfigurationInit(void) if (WHS_Type == WHS_TYPE_NEW) { +/* WHS_IO_Init(); + Task_sleep(1);//wait for WHS_IO_Init*/ InitConsole_WHS_UART3();//WHS Shinko communication } // Waste Init (WHS) diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c index b5dc7f3fe..614fd05eb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/newWHS_init.c @@ -86,8 +86,8 @@ bool newWHS_init(void) //Set_All_WHS_Fans(0xFF); // delayms(4000); //Trigger_SetWHSBlowerVoltage (0x0C00); - Task_sleep(1); - InitConsole_WHS_UART3();//WHS Shinko communication + //Task_sleep(1); + //InitConsole_WHS_UART3();//WHS Shinko communication |
