Major updates:

- added DAConverter(s)
- added ADConverter(s)
- Fixed some display issues
- Made repair process and signalProfileGenerator calculate with voltages (signed) instead of DAC/ADC values
- Fixed several bugs in task handlings
- Put display data mirror into dedicated file displaycontent

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@261 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-24 13:56:55 +00:00
parent e3ca058c96
commit bb08cae83a
35 changed files with 1689 additions and 288 deletions

View File

@@ -31,7 +31,11 @@
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "ADCDevice.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
@@ -42,11 +46,57 @@
// Type definitions.
// -----------------------------------------------------------------------------
struct ADConverter
{
bool initialized;
int minVoltage;
int maxVoltage;
struct ADCDevice* adcDevice;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* ADConverter_construct
* Description of function
*
* @param self
* @param
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus ADConverter_construct(struct ADConverter* self, int minVoltage, int maxVoltage, struct ADCDevice* adcDevice);
/** ----------------------------------------------------------------------------
* ADConverter_destruct
* Description of function
*
* @param self
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void ADConverter_destruct(struct ADConverter* self);
/** ----------------------------------------------------------------------------
* ADConverter_setOutputVoltage
* Description of function
*
* @param self
*
* @return int
*
* @todo
* -----------------------------------------------------------------------------
*/
extern int ADConverter_getInputVoltage(const struct ADConverter* self);
#endif /* ADCONVERTER_H_ */

View File

@@ -0,0 +1,80 @@
// -----------------------------------------------------------------------------
/// @file ADConverters.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 ADConverters.h
/// @ingroup {group_name}
#ifndef ADCONVERTERS_H_
#define ADCONVERTERS_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
#include "ADConverter.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
extern struct ADConverter* adcRow1;
extern struct ADConverter* adcRow2;
extern struct ADConverter* adcRow3;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* ADConverters_construct
* Constructor for ADConverters
*
* @return ErrorStatus SUCCESS if constructor was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus ADConverters_construct(void);
/** ----------------------------------------------------------------------------
* ADConverters_destruct
* Destructor for ADConverters
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void ADConverters_destruct(void);
#endif /* ADCONVERTERS_H_ */

View File

@@ -31,7 +31,11 @@
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "stm32f10x.h"
#include "DACDevice.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
@@ -42,11 +46,60 @@
// Type definitions.
// -----------------------------------------------------------------------------
struct DAConverter
{
bool initialized;
int minVoltage;
int maxVoltage;
struct DACDevice* dacDevice;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* DAConverter_construct
* Description of function
*
* @param self
* @param
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus DAConverter_construct(struct DAConverter* self, int minVoltage, int maxVoltage, struct DACDevice* dacDevice);
/** ----------------------------------------------------------------------------
* DAConverter_destruct
* Description of function
*
* @param self
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DAConverter_destruct(struct DAConverter* self);
/** ----------------------------------------------------------------------------
* DAConverter_setOutputVoltage
* Description of function
*
* @param self
* @param voltage
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus DAConverter_setOutputVoltage(const struct DAConverter* self, int voltage);
#endif /* DACONVERTER_H_ */

View File

@@ -0,0 +1,83 @@
// -----------------------------------------------------------------------------
/// @file DAConverters.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 DAConverters.h
/// @ingroup {group_name}
#ifndef DACONVERTERS_H_
#define DACONVERTERS_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
#include "DAConverter.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
extern struct DAConverter* dacRow1;
extern struct DAConverter* dacRow2;
extern struct DAConverter* dacRow3;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* DAConverters_construct
* Constructor for DAConverters
*
* @return ErrorStatus SUCCESS if constructor was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus DAConverters_construct(void);
/** ----------------------------------------------------------------------------
* DAConverters_destruct
* Destructor for DAConverters
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DAConverters_destruct(void);
#endif /* DACONVERTERS_H_ */

View File

@@ -39,24 +39,20 @@
#include "stm32f10x.h"
#include "DisplayContent.h"
#include "DisplayDevice.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define DISPLAY_MAX_ROWS (6)
#define DISPLAY_MAX_COLUMNS (25)
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
struct DisplayCharacter
{
char character;
bool isUpdated;
};
struct Display
{
@@ -65,9 +61,8 @@ struct Display
int TaskPriority;
uint16_t stackSize;
bool runTask;
SemaphoreHandle_t displayShadowAccessSemaphore;
SemaphoreHandle_t displayWriteRequest;
struct DisplayCharacter displayShadow[DISPLAY_MAX_ROWS][DISPLAY_MAX_COLUMNS];
struct DisplayContent displayContent;
int maxCharactersPerTransmit;
int refreshFeedCounter;
int refreshFeedFrequency_ms;
@@ -233,5 +228,6 @@ extern ErrorStatus Display_write(struct Display* self, const char* buffer, size_
* -----------------------------------------------------------------------------
*/
extern void Display_feedRefreshCounter(struct Display* self);
extern void Display_feedRefreshCounterFromISR(struct Display* self);
#endif /* DISPLAY_H_ */

View File

@@ -0,0 +1,178 @@
// -----------------------------------------------------------------------------
/// @file DisplayContent.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 DisplayContent.h
/// @ingroup {group_name}
#ifndef DISPLAYCONTENT_H_
#define DISPLAYCONTENT_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "FreeRTOS.h"
#include "semphr.h"
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define DISPLAY_MAX_ROWS (6)
#define DISPLAY_MAX_COLUMNS (25)
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
struct DisplayCharacter
{
char character;
bool isUpdated;
};
struct DisplayContent
{
bool initialized;
SemaphoreHandle_t contentAccess;
size_t numberOfRows;
size_t numberOfColumns;
struct DisplayCharacter DisplayContent[DISPLAY_MAX_ROWS][DISPLAY_MAX_COLUMNS];
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* DisplayContent_construct
* Description of function
*
* @param self
* @param numberOfRows
* @param numberOfColumns
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus DisplayContent_construct(struct DisplayContent* self, size_t numberOfRows, size_t numberOfColumns);
/** ----------------------------------------------------------------------------
* DisplayContent_destruct
* Description of function
*
* @param self
* @param
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DisplayContent_destruct(struct DisplayContent* self);
/** ----------------------------------------------------------------------------
* DisplayContent_updateCharacter
* Description of function
*
* @param self
* @param row
* @param column
* @param character
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DisplayContent_updateCharacter(struct DisplayContent* self, unsigned int row, unsigned int column, char character);
/** ----------------------------------------------------------------------------
* DisplayContent_isCharacterUpdated
* Description of function
*
* @param self
* @param row
* @param column
*
* @return bool
*
* @todo
* -----------------------------------------------------------------------------
*/
extern bool DisplayContent_isCharacterUpdated(struct DisplayContent* self, unsigned int row, unsigned int column);
/** ----------------------------------------------------------------------------
* DisplayContent_getCharacter
* Description of function
*
* @param self
* @param row
* @param column
*
* @return char
*
* @todo
* -----------------------------------------------------------------------------
*/
extern char DisplayContent_getCharacter(struct DisplayContent* self, unsigned int row, unsigned int column);
/** ----------------------------------------------------------------------------
* DisplayContent_refresh
* Description of function
*
* @param self
* @param
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DisplayContent_refresh(struct DisplayContent* self);
/** ----------------------------------------------------------------------------
* DisplayContent_clear
* Description of function
*
* @param self
*
* @return return_type
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DisplayContent_clear(struct DisplayContent* self);
#endif /* DISPLAYCONTENT_H_ */

View File

@@ -44,7 +44,7 @@
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x8000 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0xA000 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
@@ -69,7 +69,6 @@ to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1

View File

@@ -39,7 +39,7 @@
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define HSB_MAINMENU_TASK_PRIORITY (5)
#define HSB_MAINMENU_TASK_PRIORITY (2)
#define HSB_MAINMENU_TASK_STACKSIZE (1024)
#define HSB_MAINDISP_TASK_PRIORITY (2)
@@ -47,8 +47,22 @@
#define HSB_MAINREPR_TASK_PRIORITY (2)
#define HSB_MAINREPR_TASK_STACKSIZE (1024)
#define HSB_MAINREPR_OOL_DURATION (10)
#define HSB_MAINREPR_OOL_VALUE (100)
#define HSB_MAINREPR_OOL_DURATION (20)
#define HSB_MAINREPR_OOL_VALUE (200)
#define HSB_ADC_ANODE_MIN_VOLTAGE (0)
#define HSB_ADC_ANODE_MAX_VOLTAGE (10042)
#define HSB_ADC_CMCP_MIN_VOLTAGE (0)
#define HSB_ADC_CMCP_MAX_VOLTAGE (-2018)
#define HSB_ADC_TESLA_MIN_VOLTAGE (0)
#define HSB_ADC_TESLA_MAX_VOLTAGE (6070)
#define HSB_DAC_ANODE_MIN_VOLTAGE (0)
#define HSB_DAC_ANODE_MAX_VOLTAGE (10500)
#define HSB_DAC_CMCP_MIN_VOLTAGE (0)
#define HSB_DAC_CMCP_MAX_VOLTAGE (-2200)
#define HSB_DAC_TESLA_MIN_VOLTAGE (0)
#define HSB_DAC_TESLA_MAX_VOLTAGE (6200)
// Exports of objects on application level

View File

@@ -38,6 +38,8 @@
#include "stm32f10x.h"
#include "ADConverter.h"
#include "DAConverter.h"
#include "repairPreset.h"
#include "repairProcessRow.h"
#include "SignalProfileGenerator.h"
@@ -60,12 +62,12 @@
struct RepairProcessParameters
{
const struct AdcChannel* adcRow1;
const struct AdcChannel* adcRow2;
const struct AdcChannel* adcRow3;
const struct MAX5715_DAC* dacRow1;
const struct MAX5715_DAC* dacRow2;
const struct MAX5715_DAC* dacRow3;
const struct ADConverter* adcR1;
const struct ADConverter* adcR2;
const struct ADConverter* adcR3;
const struct DAConverter* dacR1;
const struct DAConverter* dacR2;
const struct DAConverter* dacR3;
};

View File

@@ -56,10 +56,10 @@ struct RepairProcessRowErrorData
struct RepairProcessRow
{
bool initialized;
const struct AdcChannel* adcChannel;
uint16_t lastADCValue;
const struct MAX5715_DAC* dacChannel;
uint16_t lastDACValue;
const struct ADConverter* adcChannel;
int lastADCValue;
const struct DAConverter* dacChannel;
int lastDACValue;
int pidError;
struct Pid pid;
struct RepairProcessRowErrorData errorData;
@@ -88,7 +88,7 @@ struct RepairProcessRow
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const struct AdcChannel* adcChannel, const struct MAX5715_DAC* dacChannel, int outOfLimitsDuration, int outOfLimitsValue);
extern ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const struct ADConverter* adcChannel, const struct DAConverter* dacChannel, int outOfLimitsDuration, int outOfLimitsValue);
/** ----------------------------------------------------------------------------