Skip to content
Snippets Groups Projects
Commit 73d7f57f authored by Carlo Alessandro Nicolau's avatar Carlo Alessandro Nicolau
Browse files

Debug Version (something still missing but basically working)

parent d55d52db
No related branches found
No related tags found
No related merge requests found
Showing
with 36 additions and 19 deletions
......@@ -116,6 +116,7 @@ class DigitalVariableList:
firmware_config=fwcfg,
name='FLAG_HYDRO_PWR_FAULT',
ioname='DIN_HYDRO_PWR_FLT',
active_low=True,
description='Fault status acquisition of 12V ISO HYDRO power line',
enum_index=var_enum_index,
alarm=DigitalAlarmDescriptor(
......@@ -135,6 +136,7 @@ class DigitalVariableList:
firmware_config=fwcfg,
name='FLAG_LBL_PWR_FAULT',
ioname='DIN_LBL_PWR_FLT',
active_low=True,
description='Fault status acquisition of 12V ISO LBL power line',
enum_index=var_enum_index,
alarm=DigitalAlarmDescriptor(
......@@ -154,6 +156,7 @@ class DigitalVariableList:
firmware_config=fwcfg,
name='FLAG_GLRA_FAULT',
ioname='DIN_GLR_A_FLT',
active_low=True,
description='Fault status acquisition of 12V GLENAIR-A power line',
enum_index=var_enum_index,
alarm=None
......@@ -174,6 +177,7 @@ class DigitalVariableList:
firmware_config=fwcfg,
name='FLAG_GLRB_FAULT',
ioname='DIN_GLR_B_FLT',
active_low=True,
description='Fault status acquisition of 12V GLENAIR-B power line',
enum_index=var_enum_index,
alarm=None
......@@ -194,6 +198,7 @@ class DigitalVariableList:
firmware_config=fwcfg,
name='FLAG_POWERBOARD_FAULT',
ioname='DIN_PWB_FLT',
active_low=True,
description='Fault status acquisition of 12V POWER BOARD power line',
enum_index=var_enum_index,
alarm=None
......
......@@ -111,19 +111,21 @@ class DigitalVariableDescriptor(EntityDescriptor):
_enum_indexes = list()
def __init__(self, firmware_config, name, ioname, description, enum_index=None, alarm=None):
def __init__(self, firmware_config, name, ioname, description, active_low=False, enum_index=None, alarm=None):
"""
Coonbstructor
:param firmware_config: the class FirmwareConfig
:param name: name of the digital variable (used for code generation)
:param ioname: name of the pin control macro (i.e. _SetHigh and _SetLow will be appended)
:param description: human readeable description (used for comments)
:param active_low: True if the flag is active low (defaults to False)
:param enum_index: index used if used if enumerating
:param alarm: default values for the alarm
"""
EntityDescriptor.__init__(self, firmware_config, name)
self.ioname = ioname
self.description = description
self.active_low = active_low
self.enum_index = enum_index
self.alarm = alarm
# check enum uniqueness
......
......@@ -92,6 +92,13 @@ def generate_digitalvariables_source(_digialvariables):
digital_value_t [readfunc](void) {
return (digital_value_t)(0 != [ioname]_GetValue());
}
"""
ioread_tpl_active_low = """
// IO read function for variable [name] (active low)
digital_value_t [readfunc](void) {
return (digital_value_t)(0 == [ioname]_GetValue());
}
"""
source_list = list()
......@@ -132,7 +139,10 @@ digital_value_t [readfunc](void) {
source_list.append(entry_source)
ioread_source = ioread_tpl
if digitalvariable.active_low:
ioread_source = ioread_tpl_active_low
else:
ioread_source = ioread_tpl
ioread_source = ioread_source.replace('[name]', digitalvariable.name)
ioread_source = ioread_source.replace('[readfunc]', digitalvariable.get_read_function_name())
ioread_source = ioread_source.replace('[ioname]', digitalvariable.ioname)
......
// Auto-generated template file: alarm_callbacks.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "generated/sources/variables.h"
......
// Auto-generated template file: command_ALARM_ENABLE.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_FIRECOUNT_GET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_FIRED_GET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_FIRED_RESET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_MAXCOUNT_GET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_MAXCOUNT_RESET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_THRESHOLD_GET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_THRESHOLD_SET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_TIMEOUT_GET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ALARM_TIMEOUT_SET.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_BOARDTIME.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ECHO1.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ECHO32.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_ECHO4.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_LASTCOMMANDTIME.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
// Auto-generated template file: command_LASTERROR.tpl.c
// Generation timestamp: 2021-06-20 05:48:56.170376
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment