Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Interlock.h
dvl 33bbbf4827 More doxygen documentation
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@418 05563f52-14a8-4384-a975-3d1654cca0fa
2018-01-11 14:20:29 +00:00

150 lines
4.2 KiB
C

// -----------------------------------------------------------------------------
/// @file Interlock.h
/// @brief File description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision$
/// $Author$
/// $Date$
// (c) 2015 Micro-Key bv
// -----------------------------------------------------------------------------
/**
* Interlock implementation
* \defgroup Interlock Package Interlock
* \ingroup HAL
* @{
*/
#ifndef INC_INTERLOCK_H_
#define INC_INTERLOCK_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "platform.h"
#include "gpio.h"
#include "stm32f10x_exti.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
typedef enum
{
COMMON_INTERLOCK = 0,
} T_INTERLOCK_ID;
struct InterlockElement
{
struct Gpio* io;
EXTI_InitTypeDef ioEXTI;
};
struct Interlock
{
struct InterlockElement NO;
struct InterlockElement NC;
bool initialized;
T_INTERLOCK_ID ID;
TaskHandle_t taskHandle;
SemaphoreHandle_t semaphore;
int waitToDebounce_ms;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* Interlock_construct
* Constructor for an Interlock
* Also creates and starts a FreeRTOS task for IO debouncing
*
* @param self The object to create
* @param NO
* @param NOEXTI
* @param NC
* @param NCEXTI
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Interlock_construct(struct Interlock* self, T_INTERLOCK_ID ID, struct Gpio* NO, EXTI_InitTypeDef NOEXTI, struct Gpio* NC, EXTI_InitTypeDef NCEXTI, int waitToDebounce_ms);
/** ----------------------------------------------------------------------------
* Interlock_getStatus
* Get the current status of the interlock
*
* @param self Interlock object
* @param command Interrupt status
* @param NO value on GPIO NO
* @param NC value on GPIO NC
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Interlock_getStatus(struct Interlock* self, FunctionalState* command, int* NO, int* NC);
/** ----------------------------------------------------------------------------
* Interlock_isClosed
* Check for interlock closed. Scans both I/Os
*
* @param self The interlock object
*
* @return bool TRUE is NC=1 and NO=0
*
* @todo
* -----------------------------------------------------------------------------
*/
extern bool Interlock_isClosed(struct Interlock* self);
/** ----------------------------------------------------------------------------
* Interlock_setEXTI
* Description of function
*
* @param self
* @param command
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Interlock_setEXTI(struct Interlock* self, FunctionalState command);
#endif /* INC_INTERLOCK_H_ */
/** @} */