diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-22 09:57:56 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-22 09:57:56 +0300 |
| commit | e64ec3bb6dd7294f9765bf4ca032e4aea42509e8 (patch) | |
| tree | f46a2564394361a1b6f0ab1c42cfd0b61f8b60ff /Software/Embedded_SW/Embedded/Drivers | |
| parent | 62c58ec1e5496c2e6a12be1179ee8ed5ee2890f3 (diff) | |
| download | Tango-e64ec3bb6dd7294f9765bf4ca032e4aea42509e8.tar.gz Tango-e64ec3bb6dd7294f9765bf4ca032e4aea42509e8.zip | |
IDS - do not switch off valve between segments if used in the next segment. SCREW - preparations for interrupts. Alarm Handling - low temperature. Homing - bi-directional.
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.c | 24 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.h | 5 |
2 files changed, 20 insertions, 9 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.c index 4da372ed5..e5c78cf79 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.c @@ -16,19 +16,21 @@ #include "Drivers/Motors/Motor.h" #include "drivers/FPGA/FPGA_SPI_Comm.h" +#include "drivers/FPGA/FPGA_INTERRUPTS/fpga_interrupts.h" #define Screw_Not_Busy_Mask 0x02 volatile uint32_t delay; static bool flag = 0; +SCREW_InterruptCallback Callback_Fptr = NULL; void PortPIntHandler(void)//FPGA1_INTn() { volatile uint32_t temp = F1_Moto_Driver_NBUSY2_D; // read the busy value - delay=400; + /*delay=400; if (GPIOIntStatus(GPIO_PORTP_BASE, false) & GPIO_PIN_0) { @@ -53,14 +55,18 @@ void PortPIntHandler(void)//FPGA1_INTn() while(delay) { delay -=1; - } + }*/ // must be done minimum 20uSec after the move command !!! - temp = F1_Moto_Driver_NBUSY2_L; // read the latch in order to clear the latch value (read it after moving to prevent interrupt before movement) +// temp = F1_Moto_Driver_NBUSY2_L; // read the latch in order to clear the latch value (read it after moving to prevent interrupt before movement) GPIOIntClear(GPIO_PORTP_BASE, GPIO_INT_PIN_0); + + if (Callback_Fptr) + Callback_Fptr(); } -void Screw_Interrupt(bool IsEnable) + +void Screw_Interrupt(bool IsEnable ,SCREW_InterruptCallback callback) { volatile short temp = F1_Moto_Driver_NBUSY2_M; @@ -69,12 +75,14 @@ void Screw_Interrupt(bool IsEnable) temp |= Screw_Not_Busy_Mask; // Mask F1_MOTO_SCREW_A1_NBUSY F1_Moto_Driver_NBUSY2_M = temp; temp = F1_Moto_Driver_NBUSY2_L; // read the latch in order to clear the latch value + Callback_Fptr = callback; } else { temp &= ~Screw_Not_Busy_Mask; // Unask F1_MOTO_SCREW_A1_NBUSY F1_Moto_Driver_NBUSY2_M = temp; temp = F1_Moto_Driver_NBUSY2_L; // read the latch in order to clear the latch value + Callback_Fptr = NULL; } } @@ -86,10 +94,10 @@ void Init_GPI_Interrupts() // **** Settings for FPGA1_INTn ***** // Pin P0 setup - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP); // Enable port p - SysCtlDelay(3); - GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_0); // Init PP0 as input - GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // Enable weak pullup resistor for PP0 + //SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP); // Enable port p + //SysCtlDelay(3); + //GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_0); // Init PP0 as input + //GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // Enable weak pullup resistor for PP0 // Interrupt setup GPIOIntDisable(GPIO_PORTP_BASE, GPIO_PIN_0); // Disable interrupt for PP0 (in case it was enabled) diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.h index f17ce0bac..7eafc551b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_INTERRUPTS/FPGA_Interrupts.h @@ -8,9 +8,12 @@ #ifndef DRIVERS_FPGA_FPGA_INTERRUPTS_FPGA_INTERRUPTS_H_ #define DRIVERS_FPGA_FPGA_INTERRUPTS_FPGA_INTERRUPTS_H_ +typedef void (* SCREW_InterruptCallback)(void); + + +void Screw_Interrupt(bool IsEnable ,SCREW_InterruptCallback callback); void Init_GPI_Interrupts(); -void Screw_Interrupt(bool IsEnable); #endif /* DRIVERS_FPGA_FPGA_INTERRUPTS_FPGA_INTERRUPTS_H_ */ |
