Added some IO modules (teslaGun, solenoid, powerEnable) as dedicated modules instead of general IO

Fixed code behind them

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@266 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-25 14:50:20 +00:00
parent 7e6f4a735c
commit 9a0d6a2288
22 changed files with 774 additions and 239 deletions

View File

@@ -24,6 +24,7 @@ ARFLAGS = rs
OBJECTS = \
ADCDevice.o \
CoverSolenoid.o \
DACDevice.o \
DisplayDevice.o \
hsb-mrts.o \
@@ -35,7 +36,9 @@ MAX5715.o \
nhd0420.o \
Observable.o \
PID.o \
storm700.o
Power6V5Supply.o \
storm700.o \
TeslaGunSafety.o
vpath %.o $(OBJDIR)

View File

@@ -0,0 +1,112 @@
// -----------------------------------------------------------------------------
/// @file CoverSolenoid.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
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file CoverSolenoid.h
/// @ingroup {group_name}
#ifndef SOLENOID_H_
#define SOLENOID_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "platform.h"
#include "gpio.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* CoverSolenoid_construct
* Constructor for a CoverSolenoid
*
* @param self
* @param solenoidGpio
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus CoverSolenoid_construct(struct Gpio* solenoidGpio);
/** ----------------------------------------------------------------------------
* CoverSolenoid_destruct
* Destructor for a CoverSolenoid
*
* @param self
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void CoverSolenoid_destruct(void);
/** ----------------------------------------------------------------------------
* CoverSolenoid_unlock
* Opens the CoverSolenoid
*
* @param self
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus CoverSolenoid_unlock(void);
/** ----------------------------------------------------------------------------
* CoverSolenoid_lock
* Closes the CoverSolenoid
*
* @param self
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus CoverSolenoid_lock(void);
#endif /* SOLENOID_H_ */

View File

@@ -55,7 +55,6 @@
typedef enum
{
COMMON_INTERLOCK = 0,
TESLA_INTERLOCK = !COMMON_INTERLOCK
} T_INTERLOCK_ID;
struct InterlockElement

View File

@@ -0,0 +1,107 @@
// -----------------------------------------------------------------------------
/// @file Power6V5Supply.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
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file Power6V5Supply.h
/// @ingroup {group_name}
#ifndef INC_POWER6V5SUPPLY_H_
#define INC_POWER6V5SUPPLY_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "platform.h"
#include "gpio.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* Power6V5Supply_construct
* Constructor for a 6V5 power supply
*
* @param self
* @param solenoidGpio
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Power6V5Supply_construct(struct Gpio* gpio);
/** ----------------------------------------------------------------------------
* Power6V5Supply_destruct
* Destructor for a 6V5 power supply
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Power6V5Supply_destruct(void);
/** ----------------------------------------------------------------------------
* Power6V5Supply_unlock
* Disables the 6V5 power supply
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Power6V5Supply_off(void);
/** ----------------------------------------------------------------------------
* Power6V5Supply_on
* Enables the 6V5 power supply
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Power6V5Supply_on(void);
#endif /* INC_POWER6V5SUPPLY_H_ */

View File

@@ -0,0 +1,112 @@
// -----------------------------------------------------------------------------
/// @file TeslaGunSafety.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
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file TeslaGunSafety.h
/// @ingroup {group_name}
#ifndef INC_TESLAGUNSAFETY_H_
#define INC_TESLAGUNSAFETY_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "platform.h"
#include "gpio.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* TeslaGunSafety_construct
* Constructor for a TeslaGunSafety
*
* @param self
* @param solenoidGpio
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus TeslaGunSafety_construct(struct Gpio* gpio);
/** ----------------------------------------------------------------------------
* TeslaGunSafety_destruct
* Destructor for a TeslaGunSafety
*
* @param self
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void TeslaGunSafety_destruct(void);
/** ----------------------------------------------------------------------------
* TeslaGunSafety_unlock
* Opens the TeslaGunSafety
*
* @param self
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus TeslaGunSafety_release(void);
/** ----------------------------------------------------------------------------
* TeslaGunSafety_block
* Blocks the TeslaGunSafety
*
* @param self
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus TeslaGunSafety_block(void);
#endif /* INC_TESLASAFETY_H_ */

View File

@@ -0,0 +1,114 @@
// -----------------------------------------------------------------------------
/// @file CoverSolenoid.c
/// @brief 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) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file CoverSolenoid.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "CoverSolenoid.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
struct CoverSolenoid
{
bool initialized;
struct Gpio* gpio;
};
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
static struct CoverSolenoid self;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
ErrorStatus CoverSolenoid_construct(struct Gpio* solenoidGpio)
{
ErrorStatus returnValue = SUCCESS;
if (!self.initialized)
{
self.gpio = solenoidGpio;
self.initialized = true;
}
else
{
returnValue = ERROR;
}
return returnValue;
}
void CoverSolenoid_destruct(void)
{
if (self.initialized)
{
self.initialized = false;
}
}
ErrorStatus CoverSolenoid_unlock(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, true);
}
else
{
returnValue = ERROR;
}
return returnValue;
}
ErrorStatus CoverSolenoid_lock(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, false);
}
else
{
returnValue = ERROR;
}
return returnValue;
}

View File

@@ -159,10 +159,6 @@ static void InterlockTask (void* parameters)
{
Error_postError(INTERLOCK_COMMON_FAIL);
}
else if (self->ID == TESLA_INTERLOCK)
{
Error_postError(INTERLOCK_TESLA_FAIL);
}
}
else
{

View File

@@ -0,0 +1,114 @@
// -----------------------------------------------------------------------------
/// @file Power6V5Supply.c
/// @brief 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) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file Power6V5Supply.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "Power6V5Supply.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
struct Power6V5Supply
{
bool initialized;
struct Gpio* gpio;
};
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
static struct Power6V5Supply self = {.initialized = false};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
ErrorStatus Power6V5Supply_construct(struct Gpio* gpio)
{
ErrorStatus returnValue = SUCCESS;
if (!self.initialized)
{
self.gpio = gpio;
self.initialized = true;
}
else
{
returnValue = ERROR;
}
return returnValue;
}
void Power6V5Supply_destruct(void)
{
if (self.initialized)
{
self.initialized = false;
}
}
ErrorStatus Power6V5Supply_off(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, true);
}
else
{
returnValue = ERROR;
}
return returnValue;
}
ErrorStatus Power6V5Supply_on(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, false);
}
else
{
returnValue = ERROR;
}
return returnValue;
}

View File

@@ -0,0 +1,114 @@
// -----------------------------------------------------------------------------
/// @file TeslaGunSafety.c
/// @brief 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) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file TeslaGunSafety.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "TeslaGunSafety.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
struct TeslaGunSafety
{
bool initialized;
struct Gpio* gpio;
};
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
static struct TeslaGunSafety self;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
ErrorStatus TeslaGunSafety_construct(struct Gpio* gpio)
{
ErrorStatus returnValue = SUCCESS;
if (!self.initialized)
{
self.gpio = gpio;
self.initialized = true;
}
else
{
returnValue = ERROR;
}
return returnValue;
}
void TeslaGunSafety_destruct(void)
{
if (self.initialized)
{
self.initialized = false;
}
}
ErrorStatus TeslaGunSafety_release(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, true);
}
else
{
returnValue = ERROR;
}
return returnValue;
}
ErrorStatus TeslaGunSafety_block(void)
{
ErrorStatus returnValue = SUCCESS;
if (self.initialized)
{
returnValue = GPIO_setValue(self.gpio, false);
}
else
{
returnValue = ERROR;
}
return returnValue;
}

View File

@@ -100,7 +100,6 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
if (returnValue == SUCCESS)
{
self->initialized = true;
NHD0420_sendData(self, "Hallo", 5);
}
}
else