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:
@@ -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)
|
||||
|
||||
@@ -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_ */
|
||||
@@ -55,7 +55,6 @@
|
||||
typedef enum
|
||||
{
|
||||
COMMON_INTERLOCK = 0,
|
||||
TESLA_INTERLOCK = !COMMON_INTERLOCK
|
||||
} T_INTERLOCK_ID;
|
||||
|
||||
struct InterlockElement
|
||||
|
||||
@@ -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_ */
|
||||
@@ -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_ */
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -82,21 +82,8 @@ extern struct Storm700* const storm700;
|
||||
// Export of GPIOs
|
||||
extern struct Gpio* const ledGreen;
|
||||
extern struct Gpio* const ledOrange;
|
||||
extern struct Gpio* const power6v5Enable;
|
||||
extern struct Gpio* const interlockNO;
|
||||
extern struct Gpio* const interlockNC;
|
||||
extern struct Gpio* const teslaNO;
|
||||
extern struct Gpio* const teslaNC;
|
||||
extern struct Gpio* const solenoid;
|
||||
extern struct Gpio* const mcp0Relay;
|
||||
extern struct Gpio* const mcp1Relay;
|
||||
extern struct Gpio* const mcp2Relay;
|
||||
extern struct Gpio* const cat0Relay;
|
||||
extern struct Gpio* const cat1Relay;
|
||||
extern struct Gpio* const cat2Relay;
|
||||
|
||||
extern struct Interlock* const interlock;
|
||||
extern struct Interlock* const teslalock;
|
||||
|
||||
extern struct NHD0420* const nhd0420;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "stm32f10x_adc.h"
|
||||
@@ -38,6 +39,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
#include "CathodeMCP.h"
|
||||
#include "CoverSolenoid.h"
|
||||
#include "gpio.h"
|
||||
#include "Interlock.h"
|
||||
#include "internalADC.h"
|
||||
@@ -45,10 +47,12 @@
|
||||
#include "MAX5715.h"
|
||||
#include "nhd0420.h"
|
||||
#include "PCBA.h"
|
||||
#include "Power6V5Supply.h"
|
||||
#include "rtc.h"
|
||||
#include "spi.h"
|
||||
#include "spiDevice.h"
|
||||
#include "storm700.h"
|
||||
#include "TeslaGunSafety.h"
|
||||
#include "uart.h"
|
||||
#include "Version.h"
|
||||
|
||||
@@ -132,9 +136,9 @@ static struct Gpio _ledGreen = {.initialized = false};
|
||||
static struct Gpio _ledOrange = {.initialized = false};
|
||||
static struct Gpio _power6v5Enable = {.initialized = false};
|
||||
static struct Gpio _interlockNO = {.initialized = false};
|
||||
static EXTI_InitTypeDef _interlockNOEXTI;
|
||||
static struct Gpio _interlockNC = {.initialized = false};
|
||||
static struct Gpio _teslaNO = {.initialized = false};
|
||||
static struct Gpio _teslaNC = {.initialized = false};
|
||||
static EXTI_InitTypeDef _interlockNCEXTI;
|
||||
static struct Gpio _solenoid = {.initialized = false};
|
||||
static struct Gpio _mcp0Relay = {.initialized = false};
|
||||
static struct Gpio _mcp1Relay = {.initialized = false};
|
||||
@@ -142,9 +146,9 @@ static struct Gpio _mcp2Relay = {.initialized = false};
|
||||
static struct Gpio _cat0Relay = {.initialized = false};
|
||||
static struct Gpio _cat1Relay = {.initialized = false};
|
||||
static struct Gpio _cat2Relay = {.initialized = false};
|
||||
static struct Gpio _teslaRelay = {.initialized = false};
|
||||
|
||||
static struct Interlock _interlock = {.initialized = false};
|
||||
static struct Interlock _teslalock = {.initialized = false};
|
||||
|
||||
static struct NHD0420 _nhd0420 = {.initialized = false};
|
||||
|
||||
@@ -180,21 +184,10 @@ struct Storm700* const storm700 = &_storm700;
|
||||
|
||||
struct Gpio* const ledGreen = &_ledGreen;
|
||||
struct Gpio* const ledOrange = &_ledOrange;
|
||||
struct Gpio* const power6v5Enable = & _power6v5Enable;
|
||||
struct Gpio* const interlockNO = &_interlockNO;
|
||||
struct Gpio* const interlockNC = &_interlockNC;
|
||||
struct Gpio* const teslaNO = &_teslaNO;
|
||||
struct Gpio* const teslaNC = &_teslaNC;
|
||||
struct Gpio* const solenoid = &_solenoid;
|
||||
struct Gpio* const mcp0Relay = &_mcp0Relay;
|
||||
struct Gpio* const mcp1Relay = &_mcp1Relay;
|
||||
struct Gpio* const mcp2Relay = &_mcp2Relay;
|
||||
struct Gpio* const cat0Relay = &_cat0Relay;
|
||||
struct Gpio* const cat1Relay = &_cat1Relay;
|
||||
struct Gpio* const cat2Relay = &_cat2Relay;
|
||||
|
||||
|
||||
struct Interlock* const interlock = &_interlock;
|
||||
struct Interlock* const teslalock = &_teslalock;
|
||||
|
||||
|
||||
struct NHD0420* const nhd0420 = &_nhd0420;
|
||||
|
||||
@@ -497,41 +490,37 @@ static ErrorStatus initIO (void)
|
||||
|
||||
/* GPIO initialisation ---------------------------------------------------*/
|
||||
// 6V5 enable -> PE12 output
|
||||
power6v5Enable->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||
_power6v5Enable.gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||
// Interlock1 - PB0 input
|
||||
interlockNO->gpio = configureGPIO(GPIOB, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_0);
|
||||
_interlockNO.gpio = configureGPIO(GPIOB, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_0);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);
|
||||
// Interlock2 - PB1 input
|
||||
interlockNC->gpio = configureGPIO(GPIOB, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_1);
|
||||
_interlockNC.gpio = configureGPIO(GPIOB, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_1);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource1);
|
||||
// Solenoid - PB5 output
|
||||
solenoid->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_5);
|
||||
_solenoid.gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_5);
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
// MCP0Relay - PD8 output
|
||||
mcp0Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_8);
|
||||
_mcp0Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_8);
|
||||
// MCP1Relay - PD9 output
|
||||
mcp1Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
_mcp1Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
// MCP2Relay - PD10 output
|
||||
mcp2Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_10);
|
||||
_mcp2Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_10);
|
||||
// CAT0Relay - PD11 output
|
||||
cat0Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_11);
|
||||
_cat0Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_11);
|
||||
// CAT1Relay - PD12 output
|
||||
cat1Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||
_cat1Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_12);
|
||||
// CAT2Relay - PD13 output
|
||||
cat2Relay->gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_13);
|
||||
_cat2Relay.gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_13);
|
||||
|
||||
CathodeMCP_setIO(mcp0Relay, mcp1Relay, mcp2Relay, cat0Relay, cat1Relay, cat2Relay);
|
||||
}
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
// Tesla lock PB10 output
|
||||
teslaNO->gpio = configureGPIO(GPIOB, GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource9);
|
||||
teslaNC->gpio = configureGPIO(GPIOB, GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz, GPIO_Pin_10);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource10);
|
||||
// Tesla Gun relay PB9 (or 10???)
|
||||
_teslaRelay.gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -709,50 +698,39 @@ static ErrorStatus initPeriphery(void)
|
||||
// Orange LED
|
||||
GPIO_construct(ledOrange, OUTPUT, ledOrange->gpio);
|
||||
// 6V5 Power Enable
|
||||
GPIO_construct(power6v5Enable, OUTPUT, power6v5Enable->gpio);
|
||||
// powerEnable is inverted. Set to HIGH/TRUE to switch OFF
|
||||
GPIO_setValue(power6v5Enable, true);
|
||||
GPIO_construct(&_power6v5Enable, OUTPUT, _power6v5Enable.gpio);
|
||||
|
||||
IRQ_setInterruptProperties(EXTI0_IRQn, 12, 0, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI1_IRQn, 12, 0, ENABLE);
|
||||
// InterlockNO
|
||||
EXTI_InitTypeDef intNOEXTI = configureEXTI(EXTI_Line0, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(interlockNO, INPUT, interlockNO->gpio);
|
||||
_interlockNOEXTI = configureEXTI(EXTI_Line0, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(&_interlockNO, INPUT, _interlockNO.gpio);
|
||||
// InterlockNC
|
||||
EXTI_InitTypeDef intNCEXTI = configureEXTI(EXTI_Line1, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(interlockNC, INPUT, interlockNC->gpio);
|
||||
|
||||
Interlock_construct(interlock, COMMON_INTERLOCK, interlockNO, intNOEXTI, interlockNC, intNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
_interlockNCEXTI = configureEXTI(EXTI_Line1, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(&_interlockNC, INPUT, _interlockNC.gpio);
|
||||
|
||||
// Solenoid
|
||||
GPIO_construct(solenoid, OUTPUT, solenoid->gpio);
|
||||
GPIO_construct(&_solenoid, OUTPUT, _solenoid.gpio);
|
||||
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
// MCP0Relay
|
||||
GPIO_construct(mcp0Relay, OUTPUT, mcp0Relay->gpio);
|
||||
GPIO_construct(&_mcp0Relay, OUTPUT, _mcp0Relay.gpio);
|
||||
// MCP1Relay
|
||||
GPIO_construct(mcp1Relay, OUTPUT, mcp1Relay->gpio);
|
||||
GPIO_construct(&_mcp1Relay, OUTPUT, _mcp1Relay.gpio);
|
||||
// MCP2Relay
|
||||
GPIO_construct(mcp2Relay, OUTPUT, mcp2Relay->gpio);
|
||||
GPIO_construct(&_mcp2Relay, OUTPUT, _mcp2Relay.gpio);
|
||||
// CAT0Relay
|
||||
GPIO_construct(cat0Relay, OUTPUT, cat0Relay->gpio);
|
||||
GPIO_construct(&_cat0Relay, OUTPUT, _cat0Relay.gpio);
|
||||
// CAT1Relay
|
||||
GPIO_construct(cat1Relay, OUTPUT, cat1Relay->gpio);
|
||||
GPIO_construct(&_cat1Relay, OUTPUT, _cat1Relay.gpio);
|
||||
// CAT2Relay
|
||||
GPIO_construct(cat2Relay, OUTPUT, cat2Relay->gpio);
|
||||
GPIO_construct(&_cat2Relay, OUTPUT, _cat2Relay.gpio);
|
||||
}
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
IRQ_setInterruptProperties(EXTI9_5_IRQn, 12, 12, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI15_10_IRQn, 12, 12, ENABLE);
|
||||
// Tesla Lock
|
||||
EXTI_InitTypeDef teslaNOEXTI = configureEXTI(EXTI_Line9, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(teslaNO, INPUT, teslaNO->gpio);
|
||||
EXTI_InitTypeDef teslaNCEXTI = configureEXTI(EXTI_Line10, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, DISABLE);
|
||||
GPIO_construct(teslaNC, INPUT, teslaNC->gpio);
|
||||
|
||||
Interlock_construct(teslalock, TESLA_INTERLOCK, teslaNO, teslaNOEXTI, teslaNC, teslaNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
GPIO_construct(&_teslaRelay, OUTPUT, _teslaRelay.gpio);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -763,6 +741,31 @@ static ErrorStatus initPlatformDevices (void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CathodeMCP_setIO(&_mcp0Relay, &_mcp1Relay, &_mcp2Relay, &_cat0Relay, &_cat1Relay, &_cat2Relay);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
Interlock_construct(interlock, COMMON_INTERLOCK, &_interlockNO, _interlockNOEXTI, &_interlockNC, _interlockNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
Power6V5Supply_construct(&_power6v5Enable);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CoverSolenoid_construct(&_solenoid);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
TeslaGunSafety_construct(&_teslaRelay);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
@@ -793,7 +796,6 @@ static ErrorStatus initPlatformDevices (void)
|
||||
/* NewHavenDispplay 04 20 */
|
||||
/* --------------------------------------------------------------------*/
|
||||
returnValue = NHD0420_construct(nhd0420, &spiDisplay->device);
|
||||
// returnValue = NHD0420_construct(nhd0420, &uart1->device);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
|
||||
@@ -49,7 +49,6 @@ typedef enum
|
||||
{
|
||||
GPIO_FAIL,
|
||||
INTERLOCK_COMMON_FAIL,
|
||||
INTERLOCK_TESLA_FAIL,
|
||||
POWERENABLE_FAIL,
|
||||
REPAIR_FAIL,
|
||||
} T_ErrorCode;
|
||||
|
||||
@@ -92,33 +92,6 @@ extern struct Display* const mainDisplay;
|
||||
extern ErrorStatus hsb_generateStartScreen(struct Display* Display);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* hsb_solenoidLock
|
||||
* Locks the solenoid
|
||||
*
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if locking was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus hsb_solenoidLock (void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* hsb_solenoidUnlock
|
||||
* Unlocks the solenoid
|
||||
*
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if locking was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus hsb_solenoidUnlock (void);
|
||||
|
||||
|
||||
extern ErrorStatus hsb_enableSafety(void);
|
||||
extern ErrorStatus hsb_disableSafety(void);
|
||||
|
||||
@@ -108,7 +108,7 @@ static int calculateVoltage(const struct ADConverter* self, uint32_t adcValue)
|
||||
returnValue = returnValue / maxAdcValue;
|
||||
returnValue = returnValue + self->minVoltage;
|
||||
|
||||
LOGGER_DEBUG(mainLog, "%X, %d, %d, %d", adcValue, self->maxVoltage, self->minVoltage, returnValue);
|
||||
LOGGER_DEBUG(mainLog, "%X, %d, %d, %d", (unsigned int)adcValue, self->maxVoltage, self->minVoltage, returnValue);
|
||||
// if (returnValue < self->minVoltage)
|
||||
// {
|
||||
// returnValue = self->minVoltage;
|
||||
|
||||
@@ -105,7 +105,7 @@ void SignalProfileGenerator_calculate(struct SignalProfileGenerator* self)
|
||||
self->softStartTimer = self->secondsCounter + self->repairPreset->preset[self->currentPresetIndex].softstartDuration;
|
||||
self->voltageHoldTimer = self->secondsCounter + self->repairPreset->preset[self->currentPresetIndex].duration;
|
||||
|
||||
LOGGER_DEBUG(mainLog, "startTime %d - softStartTime %d - HoldTimer %d", self->startTime, self->softStartTimer, self->voltageHoldTimer);
|
||||
LOGGER_DEBUG(mainLog, "startTime %d - softStartTime %d - HoldTimer %d", (unsigned int)self->startTime, (unsigned int)self->softStartTimer, (unsigned int)self->voltageHoldTimer);
|
||||
|
||||
// If first preset, start voltage is 0
|
||||
if (self->currentPresetIndex == 0)
|
||||
|
||||
@@ -33,9 +33,11 @@
|
||||
#include "Error.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "CoverSolenoid.h"
|
||||
#include "Interlock.h"
|
||||
#include "Logger.h"
|
||||
#include "PCBA.h"
|
||||
#include "Power6V5Supply.h"
|
||||
#include "Version.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -97,16 +99,6 @@ ErrorStatus hsb_generateStartScreen(struct Display* Display)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus hsb_solenoidLock (void)
|
||||
{
|
||||
return GPIO_setValue(solenoid, false);
|
||||
}
|
||||
|
||||
ErrorStatus hsb_solenoidUnlock (void)
|
||||
{
|
||||
return GPIO_setValue(solenoid, true);
|
||||
}
|
||||
|
||||
ErrorStatus hsb_enableSafety(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
@@ -114,7 +106,7 @@ ErrorStatus hsb_enableSafety(void)
|
||||
// First, Lock the cover
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
hsb_solenoidLock();
|
||||
CoverSolenoid_lock();
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
@@ -132,33 +124,11 @@ ErrorStatus hsb_enableSafety(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// TESLA has a second interlock that must be closed
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
if (Interlock_isClosed(teslalock))
|
||||
{
|
||||
// Enable Interrupt for tesla interlock switch
|
||||
Interlock_setEXTI(teslalock, ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Error_postError(INTERLOCK_TESLA_FAIL);
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if Interlock(s) closed, continue procedure
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Power the circuit
|
||||
if (GPIO_setValue(power6v5Enable, false) != SUCCESS)
|
||||
{
|
||||
Error_postError(POWERENABLE_FAIL);
|
||||
returnValue = ERROR;
|
||||
}
|
||||
Power6V5Supply_on();
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -168,19 +138,10 @@ ErrorStatus hsb_disableSafety(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
// Power the circuit
|
||||
if (GPIO_setValue(power6v5Enable, true) != SUCCESS)
|
||||
{
|
||||
Error_postError(POWERENABLE_FAIL);
|
||||
returnValue = ERROR;
|
||||
}
|
||||
// Un-Power the circuit
|
||||
Power6V5Supply_off();
|
||||
|
||||
Interlock_setEXTI(interlock, DISABLE);
|
||||
// TESLA has a second interlock that must be closed
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
Interlock_setEXTI(teslalock, DISABLE);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -172,8 +172,6 @@ static ErrorStatus systeminfoCommandHandler(void)
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(interlock->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(teslalock->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(keypad->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(mainDisplay->taskHandle);
|
||||
@@ -197,9 +195,6 @@ static void initTask(void* parameters)
|
||||
// IRQs are defined here
|
||||
initPlatform();
|
||||
|
||||
// Disable power
|
||||
GPIO_setValue(power6v5Enable, false);
|
||||
|
||||
// Create a small task that only blinks a LED and flashes the identification letter on the display
|
||||
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
|
||||
|
||||
@@ -217,39 +212,28 @@ static void initTask(void* parameters)
|
||||
vTaskDelay(INIT_START_SCREEN_DELAY);
|
||||
|
||||
|
||||
hwTestItems.display = &nhd0420->displayDevice;
|
||||
hwTestItems.internalADC = adc1;
|
||||
hwTestItems.externalDAC = max5715;
|
||||
hwTestItems.power6v5Enable = power6v5Enable;
|
||||
hwTestItems.interlockNO = interlockNO;
|
||||
hwTestItems.interlockNC = interlockNC;
|
||||
hwTestItems.teslaNO = teslaNO;
|
||||
hwTestItems.teslaNC = teslaNC;
|
||||
hwTestItems.solenoid = solenoid;
|
||||
hwTestItems.mcp0Relay = mcp0Relay;
|
||||
hwTestItems.mcp1Relay = mcp1Relay;
|
||||
hwTestItems.mcp2Relay = mcp2Relay;
|
||||
hwTestItems.cat0Relay = cat0Relay;
|
||||
hwTestItems.cat1Relay = cat1Relay;
|
||||
hwTestItems.cat2Relay = cat2Relay;
|
||||
hwTestItems.pcba = PCBA_getInstance();
|
||||
hwTestItems.keypad = keypad;
|
||||
///TODO MUST BE UPDATED
|
||||
// hwTestItems.display = &nhd0420->displayDevice;
|
||||
// hwTestItems.internalADC = adc1;
|
||||
// hwTestItems.externalDAC = max5715;
|
||||
// hwTestItems.power6v5Enable = power6v5Enable;
|
||||
// hwTestItems.interlockNO = interlockNO;
|
||||
// hwTestItems.interlockNC = interlockNC;
|
||||
// hwTestItems.solenoid = solenoid;
|
||||
// hwTestItems.mcp0Relay = mcp0Relay;
|
||||
// hwTestItems.mcp1Relay = mcp1Relay;
|
||||
// hwTestItems.mcp2Relay = mcp2Relay;
|
||||
// hwTestItems.cat0Relay = cat0Relay;
|
||||
// hwTestItems.cat1Relay = cat1Relay;
|
||||
// hwTestItems.cat2Relay = cat2Relay;
|
||||
// hwTestItems.pcba = PCBA_getInstance();
|
||||
// hwTestItems.keypad = keypad;
|
||||
// EEPROM TO BE DONE
|
||||
// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
|
||||
|
||||
// Construct the repair menu
|
||||
repairMenus_construct();
|
||||
|
||||
// DAConverter_setOutputVoltage(dacRow1, -500);
|
||||
// DAConverter_setOutputVoltage(dacRow2, -400);
|
||||
// DAConverter_setOutputVoltage(dacRow3, -300);
|
||||
//
|
||||
// while (1)
|
||||
// {
|
||||
// LOGGER_DEBUG(mainLog, "%i %i %i", ADConverter_getInputVoltage(adcRow1), ADConverter_getInputVoltage(adcRow2), ADConverter_getInputVoltage(adcRow3));
|
||||
// vTaskDelay(1000);
|
||||
// }
|
||||
|
||||
|
||||
// xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);
|
||||
|
||||
|
||||
@@ -38,10 +38,12 @@
|
||||
#include "Error.h"
|
||||
#include "hsb-mrts.h"
|
||||
|
||||
#include "CoverSolenoid.h"
|
||||
#include "Logger.h"
|
||||
#include "Interlock.h"
|
||||
#include "internalADC.h"
|
||||
#include "MAX5715.h"
|
||||
#include "TeslaGunSafety.h"
|
||||
|
||||
#include "KeyboardDevice.h"
|
||||
#include "PCBA.h"
|
||||
@@ -268,10 +270,6 @@ void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interloc
|
||||
{
|
||||
snprintf(self->errorMessage, sizeof(self->errorMessage) / sizeof(self->errorMessage[0]), "COVER OPEN");
|
||||
}
|
||||
else if (interlockID == TESLA_INTERLOCK)
|
||||
{
|
||||
snprintf(self->errorMessage, sizeof(self->errorMessage) / sizeof(self->errorMessage[0]), "SAFETY TUBE MISSING");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -676,13 +674,13 @@ static void repairMenu_selectPreset(struct RepairMenu* self, int cursorIndex)
|
||||
|
||||
static void repairMenu_solenoidLock(struct RepairMenu* self, int cursorIndex)
|
||||
{
|
||||
hsb_solenoidLock();
|
||||
CoverSolenoid_lock();
|
||||
}
|
||||
|
||||
|
||||
static void repairMenu_solenoidUnlock(struct RepairMenu* self, int cursorIndex)
|
||||
{
|
||||
hsb_solenoidUnlock();
|
||||
CoverSolenoid_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -704,12 +702,11 @@ static void repairMenu_startRepairProcess(struct RepairMenu* self, int cursorInd
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// For MCP/Cathode, the right settings must be made
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
// In case of a TESLA repair, release the teslaGunSafety
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
|
||||
TeslaGunSafety_release();
|
||||
}
|
||||
///TODO
|
||||
}
|
||||
|
||||
// If all is OK, start the repair process
|
||||
@@ -741,6 +738,10 @@ static void repairMenu_startRepairProcess(struct RepairMenu* self, int cursorInd
|
||||
|
||||
static void repairMenu_stopRepairProcess(struct RepairMenu* self, int cursorIndex)
|
||||
{
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
TeslaGunSafety_block();
|
||||
}
|
||||
repairProcesses_mainRepairProcessRemoveObserver(self->observer);
|
||||
repairProcesses_abortMainRepairProcess();
|
||||
hsb_disableSafety();
|
||||
|
||||
@@ -110,10 +110,6 @@ static ErrorStatus repairMenu_errorReceive(const void* const data)
|
||||
{
|
||||
repairMenu_interlockFailed(mainMenu, COMMON_INTERLOCK);
|
||||
}
|
||||
else if (errorCode == INTERLOCK_TESLA_FAIL)
|
||||
{
|
||||
repairMenu_interlockFailed(mainMenu, TESLA_INTERLOCK);
|
||||
}
|
||||
else if (errorCode == POWERENABLE_FAIL)
|
||||
{
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Interlock.h"
|
||||
#include "Logger.h"
|
||||
#include "PCBA.h"
|
||||
#include "Power6V5Supply.h"
|
||||
#include "rtc.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -79,13 +80,9 @@ ErrorStatus repairProcesses_startMainRepairProcess(const struct RepairPreset* re
|
||||
void repairProcesses_abortMainRepairProcess(void)
|
||||
{
|
||||
Interlock_setEXTI(interlock, DISABLE);
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
Interlock_setEXTI(teslalock, DISABLE);
|
||||
}
|
||||
|
||||
// DISABLE external power
|
||||
GPIO_setValue(power6v5Enable, true);
|
||||
Power6V5Supply_off();
|
||||
|
||||
repairProcess_destruct(&mainRepairProcess);
|
||||
Observable_deleteObserver(RTC_getObservable(rtc), repairProcesses_feedMainRepairProcessSecondsCounter);
|
||||
|
||||
@@ -295,44 +295,9 @@ void EXTI9_5_IRQHandler (void)
|
||||
else if (EXTI_GetITStatus(EXTI_Line9) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line9);
|
||||
|
||||
xSemaphoreGiveFromISR(teslalock->semaphore, &higherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
|
||||
void EXTI15_10_IRQHandler (void)
|
||||
{
|
||||
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
if (EXTI_GetITStatus(EXTI_Line10) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line10);
|
||||
xSemaphoreGiveFromISR(teslalock->semaphore, &higherPriorityTaskWoken);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line11) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line11);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line12) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line12);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line13) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line13);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line14) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line14);
|
||||
}
|
||||
else if (EXTI_GetITStatus(EXTI_Line15) != RESET)
|
||||
{
|
||||
EXTI_ClearITPendingBit(EXTI_Line15);
|
||||
}
|
||||
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user