Index: firmware/App/Drivers/PAL.c =================================================================== diff -u -r6ce9326aeabf018e9c531163359f7283f9d60ae9 -r090cfb22a7c0b4738299c3fb411ca77aaba8d968 --- firmware/App/Drivers/PAL.c (.../PAL.c) (revision 6ce9326aeabf018e9c531163359f7283f9d60ae9) +++ firmware/App/Drivers/PAL.c (.../PAL.c) (revision 090cfb22a7c0b4738299c3fb411ca77aaba8d968) @@ -14,7 +14,7 @@ * @date (original) 07-Aug-2024 * ***************************************************************************/ - +#include "mibspi.h" #include "reg_system.h" #include "reg_crc.h" @@ -25,13 +25,17 @@ * @{ */ -// ********** private definitions ********** +// ********** private definitions ********** +#define SAFETY_SPI1_PORT_MASK 0x00000010 ///< Safety shutdown GPIO port mask (CS[4] - re-purposed as output GPIO). +#define SET_SAFETY_SHUTDOWN() {mibspiREG1->PC3 |= SAFETY_SPI1_PORT_MASK;} ///< Set safety shutdown GPIO macro. +#define CLR_SAFETY_SHUTDOWN() {mibspiREG1->PC3 &= ~SAFETY_SPI1_PORT_MASK;} ///< Clear safety shutdown GPIO macro. + /*********************************************************************//** * @brief * The setSystemREG1_SYSECR function sets the SYSECR register to a given value. - * @details Inputs: none - * @details Outputs: SYSECR register set to given value + * @details \b Inputs: none + * @details \b Outputs: SYSECR register set to given value * @return none *************************************************************************/ void setSystemREG1_SYSECR( U32 regval ) @@ -42,8 +46,8 @@ /*********************************************************************//** * @brief * The getSystemREG1_SYSECR function gets the current value of the SYSECR register. - * @details Inputs: SYSECR register - * @details Outputs: none + * @details \b Inputs: SYSECR register + * @details \b Outputs: none * @return Value of the SYSECR register *************************************************************************/ U32 getSystemREG1_SYSECR( void ) @@ -55,8 +59,8 @@ * @brief * The setCrcREG_PSA_SIGREGL1 function sets the CRC PSA_SIGREGL1 register * to a given value. - * @details Inputs: none - * @details Outputs: PSA_SIGREGL1 register set to given value + * @details \b Inputs: none + * @details \b Outputs: PSA_SIGREGL1 register set to given value * @return none *************************************************************************/ void setCrcREG_PSA_SIGREGL1( U32 regval ) @@ -68,13 +72,37 @@ * @brief * The getCrcREG_PSA_SIGREGL1 function gets the current value of the CRC * PSA_SIGREGL1 register. - * @details Inputs: PSA_SIGREGL1 register - * @details Outputs: none + * @details \b Inputs: PSA_SIGREGL1 register + * @details \b Outputs: none * @return Value of the PSA_SIGREGL1 register *************************************************************************/ U32 getCrcREG_PSA_SIGREGL1( void ) { return crcREG->PSA_SIGREGL1; } +/*********************************************************************//** + * @brief + * The set_saftey_shutdown function sets the GPIO to disable 24v supply. + * @details \b Inputs: none + * @details \b Outputs: mibspiREG1->PC3 + * @return Value none + *************************************************************************/ +void set_safety_shutdown( void ) +{ + SET_SAFETY_SHUTDOWN(); +} + +/*********************************************************************//** + * @brief + * The clear_saftety_shutdown function clears the GPIO to enable 24v supply. + * @details \b Inputs: none + * @details \b Outputs: mibspiREG1->PC3 + * @return Value none + *************************************************************************/ +void clear_saftety_shutdown( void ) +{ + CLR_SAFETY_SHUTDOWN(); +} + /**@}*/