diff --git a/host/python/codegen/digitalvariables.py b/host/python/codegen/digitalvariables.py index d109d312c3f271e43986605c3908948fc68b8f68..645cf6dabc2759718822605e9fa887c39894a6b2 100644 --- a/host/python/codegen/digitalvariables.py +++ b/host/python/codegen/digitalvariables.py @@ -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 diff --git a/host/python/codegen/entities/descriptors.py b/host/python/codegen/entities/descriptors.py index 6a070d83c498e500512932dd81ebe0769f41bd8c..59d4bd4630fd52daa60121f50dca03b6380cddf6 100644 --- a/host/python/codegen/entities/descriptors.py +++ b/host/python/codegen/entities/descriptors.py @@ -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 diff --git a/host/python/codegen/generate_digitalvariables.py b/host/python/codegen/generate_digitalvariables.py index b2f1e962cde7f5bce1a021573f82050cd23469c7..3887d409764b416fdd234b37fc1d5d98881d845e 100644 --- a/host/python/codegen/generate_digitalvariables.py +++ b/host/python/codegen/generate_digitalvariables.py @@ -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) diff --git a/host/python/codegen/output/templates/alarm_callbacks.tpl.c b/host/python/codegen/output/templates/alarm_callbacks.tpl.c index fc31d451e5661739ca6d331eb9f799ea2d48f9b5..cf84839d01a84488a45802b362cbd709ef83c57c 100644 --- a/host/python/codegen/output/templates/alarm_callbacks.tpl.c +++ b/host/python/codegen/output/templates/alarm_callbacks.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_ENABLE.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_ENABLE.tpl.c index 360938eaea1b31f6dd4cc5e2dc5f3fe0900b120e..537de8dcf0b1d93063f24da395c2740d0ef62dd9 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_ENABLE.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_ENABLE.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_FIRECOUNT_GET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_FIRECOUNT_GET.tpl.c index 751396e05998122ccd024093f6d754eb9acfc3e0..a4a366457262806c7954a2665193e079a16748f3 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_FIRECOUNT_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_FIRECOUNT_GET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_FIRED_GET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_FIRED_GET.tpl.c index b92cca948c2ac643d47a391e8d873d606143895d..2cb802a17648ce13c9c20041257570ba56ab7125 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_FIRED_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_FIRED_GET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_FIRED_RESET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_FIRED_RESET.tpl.c index ad41dc301d4fd35012b75e051c057fb4cb2eeeb5..863ac01e5520e96410660b98ac9cb7ec26f1c9cd 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_FIRED_RESET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_FIRED_RESET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_GET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_GET.tpl.c index 3c45e7348175d39d94838d68a5a97f7c0bdb51e6..22f373bdb3b9569f9a2c4e7ca010adcba9ce6b91 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_GET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_RESET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_RESET.tpl.c index f9dbe4eae2d025a9af00728fa46148f19da35016..55ce9f0f9790b07a56372f5bb14b2f55e04e33e3 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_RESET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_MAXCOUNT_RESET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_GET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_GET.tpl.c index e4fae8d84d461168e49487b971174578128e7397..e1c7eb2645587fc604fc50191d6856d965d71e46 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_GET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_SET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_SET.tpl.c index 53ee06614313517f99fd251d7d7f04cf6f20b1e3..910866fb365a19ba6b5fe9af431c1219dc48f011 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_SET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_THRESHOLD_SET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_GET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_GET.tpl.c index 559869029f2c67f21bd3a394827b6235f949d799..32f2cef7c731da29658181e148d88426f84b696a 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_GET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_SET.tpl.c b/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_SET.tpl.c index 79838fd3be267feb12db2cb69757f8c788c87ca7..c72b52bc6c1916ae815aa07cc6109ddad6e769b2 100644 --- a/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_SET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ALARM_TIMEOUT_SET.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_BOARDTIME.tpl.c b/host/python/codegen/output/templates/commands/command_BOARDTIME.tpl.c index 9751cc6bf157960fedd364b6f0d31e4b3ced4037..3ed0e0f73d9e5a18cd93a7acbf93df83763f0c95 100644 --- a/host/python/codegen/output/templates/commands/command_BOARDTIME.tpl.c +++ b/host/python/codegen/output/templates/commands/command_BOARDTIME.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ECHO1.tpl.c b/host/python/codegen/output/templates/commands/command_ECHO1.tpl.c index c1677ba9978d3e30ae64a0e1640f63843908e825..04d2c3083618d0cb6343c4d31ed7d8a1507d318c 100644 --- a/host/python/codegen/output/templates/commands/command_ECHO1.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ECHO1.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ECHO32.tpl.c b/host/python/codegen/output/templates/commands/command_ECHO32.tpl.c index bd90820defa42fa457c92827401f0d0ae30ff2dc..bfaddcbea0368c3f31fbfe3488f6434d5d6d4f76 100644 --- a/host/python/codegen/output/templates/commands/command_ECHO32.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ECHO32.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_ECHO4.tpl.c b/host/python/codegen/output/templates/commands/command_ECHO4.tpl.c index 76d5139d6cfbdfb33f8fd2892923593e268fcd7e..02d9ed34875b6429e0ef68b7e7e2ede7edb2cc77 100644 --- a/host/python/codegen/output/templates/commands/command_ECHO4.tpl.c +++ b/host/python/codegen/output/templates/commands/command_ECHO4.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_LASTCOMMANDTIME.tpl.c b/host/python/codegen/output/templates/commands/command_LASTCOMMANDTIME.tpl.c index 84db3ed9fe0126079b4591632d7461d2945ed243..86822e1ae629abbbb2560f5813f389d966edc710 100644 --- a/host/python/codegen/output/templates/commands/command_LASTCOMMANDTIME.tpl.c +++ b/host/python/codegen/output/templates/commands/command_LASTCOMMANDTIME.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_LASTERROR.tpl.c b/host/python/codegen/output/templates/commands/command_LASTERROR.tpl.c index 05efcf1c50c73e9fe33573093ada58df5abe03d1..4ef72aaab947ecb238e701b6e96db7c0f28558f6 100644 --- a/host/python/codegen/output/templates/commands/command_LASTERROR.tpl.c +++ b/host/python/codegen/output/templates/commands/command_LASTERROR.tpl.c @@ -1,5 +1,5 @@ // 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" diff --git a/host/python/codegen/output/templates/commands/command_RESCUE_ENABLE.tpl.c b/host/python/codegen/output/templates/commands/command_RESCUE_ENABLE.tpl.c index 70444aa72e6739af9d119457c9b4cf70495f1899..d54bd95321cbd231081562b52cc7d5bb4897e03c 100644 --- a/host/python/codegen/output/templates/commands/command_RESCUE_ENABLE.tpl.c +++ b/host/python/codegen/output/templates/commands/command_RESCUE_ENABLE.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_RESCUE_ENABLE.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_GET.tpl.c b/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_GET.tpl.c index 9aa923ff28e3568f635f1d3b9782db07d6d29906..8fc1e9fa92365ebf84d2bf80e1a89aa84f5bb6e0 100644 --- a/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_GET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_RESCUE_STATUS_GET.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_RESET.tpl.c b/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_RESET.tpl.c index b8efe25ebda02c8acf0395f309d2b1ceb1e807e1..a734f847e2f4bddf9b20526374a2e5327751223a 100644 --- a/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_RESET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_RESCUE_STATUS_RESET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_RESCUE_STATUS_RESET.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_GET.tpl.c b/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_GET.tpl.c index 4c67348c47e8c907af10f5db945f9b4aeddf0bc8..dcab3600db002d66c2849c1ea7788044a3c47489 100644 --- a/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_GET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_RESCUE_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" diff --git a/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_SET.tpl.c b/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_SET.tpl.c index 68e3c0a215169a9e625bf2c68973cc303f76dbe4..4f2f3688aa4662b51d112dc71c1712690575be57 100644 --- a/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_SET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_RESCUE_TIMEOUT_SET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_RESCUE_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" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGE_GETALL.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGE_GETALL.tpl.c index df362e005e34ea17833055d944b270e2b73f8e5c..e4069c740d015592d2034e38b285e142d36c0bfa 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGE_GETALL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGE_GETALL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_AVERAGE_GETALL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_GET.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_GET.tpl.c index 4fdb9db41654941af8fd8e9f80ad8f44adb575b3..8f20d860a41b46bd2565df65ad0f9c711e7f7d9e 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_GET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_GET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_AVERAGING_PRESCALER_GET.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_SET.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_SET.tpl.c index ad7a765703cdaf2c7c6b7b56a5fa87fb1e2957bb..1dc3e743559b626850ce0fa9178b61bbfdf52411 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_SET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_AVERAGING_PRESCALER_SET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_AVERAGING_PRESCALER_SET.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_GET_SINGLE.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_GET_SINGLE.tpl.c index 59428909f55be4af8fbcd0345d4fa30ad75149f3..b82fda45ab0dd0ebb8ee4b9d19c76a215484a869 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_GET_SINGLE.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_GET_SINGLE.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_GET_SINGLE.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUES_GETALL.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUES_GETALL.tpl.c index 1a88e0c9839c2900202a35dda8659a1a9759fce4..d2887eca7d119f591789f46623681d5eda7c2279 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUES_GETALL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUES_GETALL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_MAXVALUES_GETALL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUE_RESET.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUE_RESET.tpl.c index b7a1c7be17cfed2ff5854b7f417906050949965e..9baecc56283ca834729b55a2cde3f1476e6bcc7f 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUE_RESET.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_MAXVALUE_RESET.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_MAXVALUE_RESET.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_OFFSETS_GETALL.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_OFFSETS_GETALL.tpl.c index 011cb75ea174364dd63766f6a17bfa5f6aa835db..77bb070e904bb783bda26c9e7f5f00036e1cf931 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_OFFSETS_GETALL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_OFFSETS_GETALL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_OFFSETS_GETALL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SENSOR_VALUES_GETALL.tpl.c b/host/python/codegen/output/templates/commands/command_SENSOR_VALUES_GETALL.tpl.c index 668dde748ca5d92cfaf4b09452cc7bec6f1f5f91..6c1c32a3e2ae41355bfab0061e74f097487c4014 100644 --- a/host/python/codegen/output/templates/commands/command_SENSOR_VALUES_GETALL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SENSOR_VALUES_GETALL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SENSOR_VALUES_GETALL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_SWITCH_CONTROL.tpl.c b/host/python/codegen/output/templates/commands/command_SWITCH_CONTROL.tpl.c index 65f0b1a5d17ce675165fc9bf7407426e107f366f..cfd47c4ba67907c4167060a4635d15d62b5ac6c4 100644 --- a/host/python/codegen/output/templates/commands/command_SWITCH_CONTROL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_SWITCH_CONTROL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_SWITCH_CONTROL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_USER_PIN_CONTROL.tpl.c b/host/python/codegen/output/templates/commands/command_USER_PIN_CONTROL.tpl.c index f960e688e449dd1b34dbdd2f744dc3f29466e899..49be46e6cbb07ca8c6e21024f9764179cdd8b1bf 100644 --- a/host/python/codegen/output/templates/commands/command_USER_PIN_CONTROL.tpl.c +++ b/host/python/codegen/output/templates/commands/command_USER_PIN_CONTROL.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_USER_PIN_CONTROL.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_VALCHECK.tpl.c b/host/python/codegen/output/templates/commands/command_VALCHECK.tpl.c index 5c9446e27924aa2ac21f57d83528343f981d377d..fdf2544e4467dd0fe90018aab02f2b372d60d7ab 100644 --- a/host/python/codegen/output/templates/commands/command_VALCHECK.tpl.c +++ b/host/python/codegen/output/templates/commands/command_VALCHECK.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_VALCHECK.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/host/python/codegen/output/templates/commands/command_VERSION.tpl.c b/host/python/codegen/output/templates/commands/command_VERSION.tpl.c index 59ef1a9976a433e2bcf2e18e5f8c2d1d49f2a048..ee654788df89f6990b110b40dd8e6712ab00c16f 100644 --- a/host/python/codegen/output/templates/commands/command_VERSION.tpl.c +++ b/host/python/codegen/output/templates/commands/command_VERSION.tpl.c @@ -1,5 +1,5 @@ // Auto-generated template file: command_VERSION.tpl.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "../typedefs.h" diff --git a/micro/BPD-V01-FIRMWARE.X/BPD_MCC_config.mc3 b/micro/BPD-V01-FIRMWARE.X/BPD_MCC_config.mc3 index 28c8c9b30ed1fa826c5315f8dd9c5166494686be..2b08456cb246671f42e52b6543a804265edd7900 100644 --- a/micro/BPD-V01-FIRMWARE.X/BPD_MCC_config.mc3 +++ b/micro/BPD-V01-FIRMWARE.X/BPD_MCC_config.mc3 @@ -1,9 +1,5 @@ <config configVersion="1.1" device="PIC18F46K22" coreVersion="5.0.2"> <usedClasses class="java.util.HashMap"> - <entry> - <string>ADC</string> - <string>class com.microchip.mcc.mcu8.modules.adc.ADC</string> - </entry> <entry> <string>TMR0</string> <string>class com.microchip.mcc.mcu8.modules.tmr0_v1.TMR0</string> @@ -12,6 +8,10 @@ <string>System Module</string> <string>class com.microchip.mcc.mcu8.systemManager.SystemManager</string> </entry> + <entry> + <string>ADC</string> + <string>class com.microchip.mcc.mcu8.modules.adc.ADC</string> + </entry> <entry> <string>FVR</string> <string>class com.microchip.mcc.mcu8.modules.fvr.FVR</string> @@ -32,14 +32,14 @@ <string>CCP5</string> <string>class com.microchip.mcc.mcu8.modules.ccp_v3.CCP</string> </entry> - <entry> - <string>RESET</string> - <string>class com.microchip.mcc.mcu8.systemManager.reset.RESET</string> - </entry> <entry> <string>EUSART1</string> <string>class com.microchip.mcc.mcu8.modules.eusart.EUSART</string> </entry> + <entry> + <string>RESET</string> + <string>class com.microchip.mcc.mcu8.systemManager.reset.RESET</string> + </entry> <entry> <string>Interrupt Module</string> <string>class com.microchip.mcc.mcu8.interruptManager.InterruptManager</string> @@ -1253,14 +1253,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR2" registerAlias="TCON" settingAlias="TOUTPS" alias="1:7"/> <value>6</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="DT1"/> - <value>disabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR2" registerAlias="TCON" settingAlias="TOUTPS" alias="1:6"/> <value>5</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="DT1"/> + <value>disabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="INTCON2" settingAlias="nWPUEN" alias="enabled"/> <value>0</value> @@ -1329,14 +1329,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="CONFIG1H" settingAlias="PRICLKEN" alias="OFF"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="TMRI" settingAlias="order"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="CCP5" name="pwmCCPRDisplayValue"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="TMRI" settingAlias="order"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR0" name="minPeriod"/> <value>0.000004</value> @@ -1577,14 +1577,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="RESET" registerAlias="RCON" settingAlias="POR" alias="occurred"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="ADC" registerAlias="ADCON0" settingAlias="CHS"/> - <value>AN0</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR2" registerAlias="TCON" settingAlias="TOUTPS"/> <value>1:4</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="ADC" registerAlias="ADCON0" settingAlias="CHS"/> + <value>AN0</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="BRG16"/> <value>16bit_generator</value> @@ -1706,11 +1706,11 @@ <value>2</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="PS" alias="1:64"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CCP5" registerAlias="CCPCON" settingAlias="CCPM" alias="Rising edge"/> <value>5</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="CCP5" registerAlias="CCPCON" settingAlias="CCPM" alias="Rising edge"/> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="PS" alias="1:64"/> <value>5</value> </entry> <entry> @@ -2601,14 +2601,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RB2"/> <value>AIN_GLR_A_I_MON</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="DTRXP" alias="inverted"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR2" registerAlias="TCON" settingAlias="TOUTPS" alias="1:16"/> <value>15</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="DTRXP" alias="inverted"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="Pin Module" name="Custom Name RB3"/> <value>AIN_GLR_B_I_MON</value> @@ -2821,14 +2821,14 @@ <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="ADC" registerAlias="ADRESL" settingAlias="ADRESL"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="FVR" registerAlias="FVRCON" settingAlias="FVREN"/> - <value>enabled</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="EUSART1" registerAlias="TXSTA" settingAlias="SYNC" alias="asynchronous"/> <value>0</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="FVR" registerAlias="FVRCON" settingAlias="FVREN"/> + <value>enabled</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="System Module" registerAlias="CONFIG2L" settingAlias="BORV" alias="190"/> <value>24</value> @@ -3477,14 +3477,14 @@ <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="LATD" settingAlias="LATD0" alias="clear"/> <value>0</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="ADC" registerAlias="ADCON0" settingAlias="CHS" alias="AN14"/> - <value>14</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR2" name="timerstart"/> <value>enabled</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="ADC" registerAlias="ADCON0" settingAlias="CHS" alias="AN14"/> + <value>14</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="Pin Module" registerAlias="LATA" settingAlias="LATA4" alias="set"/> <value>1</value> @@ -3842,11 +3842,11 @@ <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="FVR" registerAlias="FVRCON" settingAlias="FVRRDY"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="ABDEN"/> <value>disabled</value> </entry> <entry> - <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="ABDEN"/> + <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="FVR" registerAlias="FVRCON" settingAlias="FVRRDY"/> <value>disabled</value> </entry> <entry> @@ -4357,14 +4357,14 @@ <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="ADC" name="AN17"/> <value>disabled</value> </entry> - <entry> - <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="BRG16" alias="16bit_generator"/> - <value>1</value> - </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR2" name="TMR2_TMRIISRFunction"/> <value>ISR</value> </entry> + <entry> + <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="BRG16" alias="16bit_generator"/> + <value>1</value> + </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="ADC" name="AN19"/> <value>disabled</value> diff --git a/micro/BPD-V01-FIRMWARE.X/alarm_callbacks.c b/micro/BPD-V01-FIRMWARE.X/alarm_callbacks.c index e28cd3e53bf0480a89e6ddf871dc4e223c1f9054..4b038824f5bd4fbeedbc18af2a0ea37e3a94eeb1 100644 --- a/micro/BPD-V01-FIRMWARE.X/alarm_callbacks.c +++ b/micro/BPD-V01-FIRMWARE.X/alarm_callbacks.c @@ -6,52 +6,68 @@ // Callback function for alarm on analog variable MON_VEOC_RTN_I (DU backbone return current sensor signal acquisition ) void alarm_MON_VEOC_RTN_I() { - // TODO implement auto-generated callback function alarm_MON_VEOC_RTN_I + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable MON_VEOC_FWR_I (DU backbone forward current sensor signal acquisition ) void alarm_MON_VEOC_FWR_I() { - // TODO implement auto-generated callback function alarm_MON_VEOC_FWR_I + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable MON_HYDRO_I (HYDRO current sensor signal acquisition ) void alarm_MON_HYDRO_I() { - // TODO implement auto-generated callback function alarm_MON_HYDRO_I + // OPEN HYDRO + switch_SWITCH_HYDRO_set_open_fromIRQ(); } // Callback function for alarm on analog variable MON_LBL_I (LBL current sensor signal acquisition ) void alarm_MON_LBL_I() { - // TODO implement auto-generated callback function alarm_MON_LBL_I + // OPEN LBL + switch_SWITCH_LBL_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_DUL_ALARMPOS1 (DUL current limiting on VEOC direct alarm 1) void alarm_FLAG_DUL_ALARMPOS1() { - // TODO implement auto-generated callback function alarm_FLAG_DUL_ALARMPOS1 + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_DUL_ALARMPOS2 (DUL current limiting on VEOC direct alarm 2) void alarm_FLAG_DUL_ALARMPOS2() { - // TODO implement auto-generated callback function alarm_FLAG_DUL_ALARMPOS2 + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_DUL_ALARMNEG1 (DUL current limiting on VEOC return alarm 1) void alarm_FLAG_DUL_ALARMNEG1() { - // TODO implement auto-generated callback function alarm_FLAG_DUL_ALARMNEG1 + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_DUL_ALARMNEG2 (DUL current limiting on VEOC return alarm 2) void alarm_FLAG_DUL_ALARMNEG2() { - // TODO implement auto-generated callback function alarm_FLAG_DUL_ALARMNEG2 + // OPEN VEOC + switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(); + switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_HYDRO_PWR_FAULT (Fault status acquisition of 12V ISO HYDRO power line) void alarm_FLAG_HYDRO_PWR_FAULT() { - // TODO implement auto-generated callback function alarm_FLAG_HYDRO_PWR_FAULT + // OPEN HYDRO + switch_SWITCH_HYDRO_set_open_fromIRQ(); } // Callback function for alarm on analog variable FLAG_LBL_PWR_FAULT (Fault status acquisition of 12V ISO LBL power line) void alarm_FLAG_LBL_PWR_FAULT() { - // TODO implement auto-generated callback function alarm_FLAG_LBL_PWR_FAULT + // OPEN LBL + switch_SWITCH_LBL_set_open_fromIRQ(); } diff --git a/micro/BPD-V01-FIRMWARE.X/errors.c b/micro/BPD-V01-FIRMWARE.X/errors.c index c77c3985d25c25b694c046f3743bb27ef6f92304..9c77ea70bfe759225ca45951923f3b816b04ab37 100644 --- a/micro/BPD-V01-FIRMWARE.X/errors.c +++ b/micro/BPD-V01-FIRMWARE.X/errors.c @@ -9,6 +9,7 @@ #include "errors.h" #include "hardware.h" #include "errorcodes.h" +#include "generated/sources/variables.h" err_t errors_last_error = NOERR; @@ -17,18 +18,56 @@ void error_notify(err_t _err) { // notify one error (probably to remove on final version) errors_last_error = _err; - // T O D O DEBUG remove USER PIN activity - // DIGITAL_OUT_USER_J1_1_SetHigh(); - // DIGITAL_OUT_USER_J1_1_SetLow(); + // Signal with some LED flashes + // TODO COMMENT OUT error_notify + INTERRUPT_GlobalInterruptDisable(); + for(int k=0; k<8; k++) { + userpin_SWITCH_LED_D9_set_high(); + userpin_SWITCH_LED_D10_set_high(); + __delay_ms(50); + userpin_SWITCH_LED_D9_set_low(); + userpin_SWITCH_LED_D10_set_low(); + __delay_ms(50); + } + for(int k=0; k<8; k++) { + userpin_SWITCH_LED_D9_set_high(); + userpin_SWITCH_LED_D10_set_low(); + __delay_ms(50); + userpin_SWITCH_LED_D9_set_low(); + userpin_SWITCH_LED_D10_set_high(); + __delay_ms(50); + } + userpin_SWITCH_LED_D9_set_low(); + userpin_SWITCH_LED_D10_set_low(); + INTERRUPT_GlobalInterruptEnable(); + } void error_die_forever(void) { // THIS SHOULD NEVE HAPPEN, PLEASE UNCOMMENT DURING DEVELOPMENT - // INTERRUPT_GlobalInterruptDisable(); - // while(1) { - // DIGITAL_OUT_USER_J1_1_SetHigh(); - // __delay_ms(250); - // DIGITAL_OUT_USER_J1_1_SetLow(); - // __delay_ms(250); - // } + // TODO COMMENT OUT error_die_forever + INTERRUPT_GlobalInterruptDisable(); + while(1) { + userpin_SWITCH_LED_D9_set_high(); + userpin_SWITCH_LED_D10_set_high(); + __delay_ms(250); + userpin_SWITCH_LED_D9_set_low(); + userpin_SWITCH_LED_D10_set_low(); + __delay_ms(250); + } +} + +// ... see .h +void error_die_forever_fromIRQ(void) { + // THIS SHOULD NEVE HAPPEN, PLEASE UNCOMMENT DURING DEVELOPMENT + // TODO COMMENT OUT error_die_forever_fromIRQ + INTERRUPT_GlobalInterruptDisable(); + while(1) { + userpin_SWITCH_LED_D9_set_high(); + userpin_SWITCH_LED_D10_set_low(); + __delay_ms(250); + userpin_SWITCH_LED_D9_set_low(); + userpin_SWITCH_LED_D10_set_high(); + __delay_ms(250); + } } diff --git a/micro/BPD-V01-FIRMWARE.X/errors.h b/micro/BPD-V01-FIRMWARE.X/errors.h index f2af29bc3500fe4e645b1d204ebc0f8133e694f3..3859f83b1fcd15bb389b3740c7eeed1a0c6042a9 100644 --- a/micro/BPD-V01-FIRMWARE.X/errors.h +++ b/micro/BPD-V01-FIRMWARE.X/errors.h @@ -17,5 +17,9 @@ extern err_t errors_last_error; void error_notify(err_t _err); void error_die_forever(void); +// Just replicated versions of non-IRQ, to avoid compiler complaining: +// "appears in multiple call graphs and has been duplicated by the compiler" +void error_die_forever_fromIRQ(void); + #endif // __ERRORS_H diff --git a/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.c b/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.c index 8b6eb71dbd91b6cf37d7473bb57cbdd9ad5117a6..1422a914a94ebaad32972c07c23ad75a9a3d4d35 100644 --- a/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.c +++ b/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.c @@ -1,5 +1,5 @@ // Auto-generated file: commandstable.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "commandstable.h" diff --git a/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.h b/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.h index a27cb2634a855efba6fb3f8b657a5d845806ef77..fca07ab79a43c984058bf2e71c677d4ed50499bf 100644 --- a/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.h +++ b/micro/BPD-V01-FIRMWARE.X/generated/sources/commandstable.h @@ -1,5 +1,5 @@ // Auto-generated file: commandstable.h -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #ifndef _AUTOGENERATED_COMMANDSTABLE_H #define _AUTOGENERATED_COMMANDSTABLE_H @@ -190,10 +190,10 @@ err_t command_INVALID(void); #define COMMAND_TABLE_VERSION_NUM 34 #define TEMPLATE_GENERATION_YEAR 2021 #define TEMPLATE_GENERATION_MONTH 6 -#define TEMPLATE_GENERATION_DAY 20 -#define TEMPLATE_GENERATION_HOUR 5 -#define TEMPLATE_GENERATION_MINUTE 48 -#define TEMPLATE_GENERATION_SECOND 56 +#define TEMPLATE_GENERATION_DAY 21 +#define TEMPLATE_GENERATION_HOUR 19 +#define TEMPLATE_GENERATION_MINUTE 42 +#define TEMPLATE_GENERATION_SECOND 34 #endif // _AUTOGENERATED_COMMANDSTABLE_H diff --git a/micro/BPD-V01-FIRMWARE.X/generated/sources/datatypes.h b/micro/BPD-V01-FIRMWARE.X/generated/sources/datatypes.h index 246cea6aec7f47ad9b9dcd13defd5f93afe3cb2c..18f894a568054e4c5a6b6aa9bdcb75e9c34c194e 100644 --- a/micro/BPD-V01-FIRMWARE.X/generated/sources/datatypes.h +++ b/micro/BPD-V01-FIRMWARE.X/generated/sources/datatypes.h @@ -1,5 +1,5 @@ // Auto-generated file: datatypes.h -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #ifndef _AUTOGENERATED_DATATYPES_H #define _AUTOGENERATED_DATATYPES_H diff --git a/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.c b/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.c index e24d7bfeb1618d53802674df10f2a50c71277152..95a3dd65159196ba200b33f00acb05e18d2da4bd 100644 --- a/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.c +++ b/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.c @@ -1,5 +1,5 @@ // Auto-generated file: variables.c -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #include "variables.h" #include "../../configuration.h" @@ -681,33 +681,33 @@ digital_value_t ioread_DIN_ALRMNEG2(void) { } -// IO read function for variable FLAG_HYDRO_PWR_FAULT +// IO read function for variable FLAG_HYDRO_PWR_FAULT (active low) digital_value_t ioread_DIN_HYDRO_PWR_FLT(void) { - return (digital_value_t)(0 != DIN_HYDRO_PWR_FLT_GetValue()); + return (digital_value_t)(0 == DIN_HYDRO_PWR_FLT_GetValue()); } -// IO read function for variable FLAG_LBL_PWR_FAULT +// IO read function for variable FLAG_LBL_PWR_FAULT (active low) digital_value_t ioread_DIN_LBL_PWR_FLT(void) { - return (digital_value_t)(0 != DIN_LBL_PWR_FLT_GetValue()); + return (digital_value_t)(0 == DIN_LBL_PWR_FLT_GetValue()); } -// IO read function for variable FLAG_GLRA_FAULT +// IO read function for variable FLAG_GLRA_FAULT (active low) digital_value_t ioread_DIN_GLR_A_FLT(void) { - return (digital_value_t)(0 != DIN_GLR_A_FLT_GetValue()); + return (digital_value_t)(0 == DIN_GLR_A_FLT_GetValue()); } -// IO read function for variable FLAG_GLRB_FAULT +// IO read function for variable FLAG_GLRB_FAULT (active low) digital_value_t ioread_DIN_GLR_B_FLT(void) { - return (digital_value_t)(0 != DIN_GLR_B_FLT_GetValue()); + return (digital_value_t)(0 == DIN_GLR_B_FLT_GetValue()); } -// IO read function for variable FLAG_POWERBOARD_FAULT +// IO read function for variable FLAG_POWERBOARD_FAULT (active low) digital_value_t ioread_DIN_PWB_FLT(void) { - return (digital_value_t)(0 != DIN_PWB_FLT_GetValue()); + return (digital_value_t)(0 == DIN_PWB_FLT_GetValue()); } diff --git a/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.h b/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.h index e556c202af0cbc1a3d8a7a79e4aa92de5d2821fe..8122807bd344b6f16949ce6858fbc855e4ed62ed 100644 --- a/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.h +++ b/micro/BPD-V01-FIRMWARE.X/generated/sources/variables.h @@ -1,5 +1,5 @@ // Auto-generated file: variables.h -// Generation timestamp: 2021-06-20 05:48:56.170376 +// Generation timestamp: 2021-06-21 19:42:34.864200 #ifndef _AUTOGENERATED_VARIABLES_H #define _AUTOGENERATED_VARIABLES_H diff --git a/micro/BPD-V01-FIRMWARE.X/nbproject/configurations.xml b/micro/BPD-V01-FIRMWARE.X/nbproject/configurations.xml index 5cb90fb1f22d6deabfaa7f652f2e4dfbe19adef0..30174c00a25801d4640c83065d2b5e51574a3f5e 100644 --- a/micro/BPD-V01-FIRMWARE.X/nbproject/configurations.xml +++ b/micro/BPD-V01-FIRMWARE.X/nbproject/configurations.xml @@ -132,7 +132,7 @@ <targetPluginBoard></targetPluginBoard> <platformTool>noID</platformTool> <languageToolchain>XC8</languageToolchain> - <languageToolchainVersion>2.20</languageToolchainVersion> + <languageToolchainVersion>2.00</languageToolchainVersion> <platform>2</platform> </toolsSet> <packs> @@ -273,7 +273,7 @@ <targetPluginBoard></targetPluginBoard> <platformTool>ICD3PlatformTool</platformTool> <languageToolchain>XC8</languageToolchain> - <languageToolchainVersion>2.20</languageToolchainVersion> + <languageToolchainVersion>2.00</languageToolchainVersion> <platform>2</platform> </toolsSet> <packs> diff --git a/micro/BPD-V01-FIRMWARE.X/spurious.c b/micro/BPD-V01-FIRMWARE.X/spurious.c index 44d3ab4d2b6ed682d9ceb32f3ffce0f9f095ae3b..ef40d7fc955c4fe749e662361119c1e7fa4062d3 100644 --- a/micro/BPD-V01-FIRMWARE.X/spurious.c +++ b/micro/BPD-V01-FIRMWARE.X/spurious.c @@ -12,256 +12,6 @@ #include "generated/sources/variables.h" #include "mcc_generated_files/mcc.h" -// analog and digital alarm structures are defined and initialized in file variables.c under generated folder - -//bool variable_is_analog_by_enum(enum_variable_number_t _variable_index) { -// switch(_variable_index) { -// -// case VARIABLE_NUMBER_MON_DUL_BOARDTEMP: -// case VARIABLE_NUMBER_MON_TEMP2: -// case VARIABLE_NUMBER_MON_TEMP1: -// case VARIABLE_NUMBER_MON_VEOC_RTN_I: -// case VARIABLE_NUMBER_MON_VEOC_FWR_I: -// case VARIABLE_NUMBER_MON_HYDRO_I: -// case VARIABLE_NUMBER_MON_INPUT_V: -// case VARIABLE_NUMBER_MON_LBL_I: -// case VARIABLE_NUMBER_MON_GLRA_I: -// case VARIABLE_NUMBER_MON_GLRB_I: -// case VARIABLE_NUMBER_MON_PWB_I: -// return true; -// -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS1: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS2: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG1: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG2: -// case VARIABLE_NUMBER_FLAG_HYDRO_PWR_FAULT: -// case VARIABLE_NUMBER_FLAG_LBL_PWR_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRA_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRB_FAULT: -// case VARIABLE_NUMBER_FLAG_POWERBOARD_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRA_GOOD: -// case VARIABLE_NUMBER_FLAG_GLRB_GOOD: -// case VARIABLE_NUMBER_FLAG_POWERBOARD_GOOD: -// return false; -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return false; -//} -// -//analog_variable_t* analog_variable_get_pointer_by_enum(enum_variable_number_t _variable_index) { -// switch(_variable_index) { -// -// case VARIABLE_NUMBER_MON_DUL_BOARDTEMP: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_DUL_BOARDTEMP]); -// case VARIABLE_NUMBER_MON_TEMP2: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP2]); -// case VARIABLE_NUMBER_MON_TEMP1: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP1]); -// case VARIABLE_NUMBER_MON_VEOC_RTN_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_RTN_I]); -// case VARIABLE_NUMBER_MON_VEOC_FWR_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_FWR_I]); -// case VARIABLE_NUMBER_MON_HYDRO_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_HYDRO_I]); -// case VARIABLE_NUMBER_MON_INPUT_V: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_INPUT_V]); -// case VARIABLE_NUMBER_MON_LBL_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_LBL_I]); -// case VARIABLE_NUMBER_MON_GLRA_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRA_I]); -// case VARIABLE_NUMBER_MON_GLRB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRB_I]); -// case VARIABLE_NUMBER_MON_PWB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_PWB_I]); -// -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS1: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS2: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG1: -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG2: -// case VARIABLE_NUMBER_FLAG_HYDRO_PWR_FAULT: -// case VARIABLE_NUMBER_FLAG_LBL_PWR_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRA_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRB_FAULT: -// case VARIABLE_NUMBER_FLAG_POWERBOARD_FAULT: -// case VARIABLE_NUMBER_FLAG_GLRA_GOOD: -// case VARIABLE_NUMBER_FLAG_GLRB_GOOD: -// case VARIABLE_NUMBER_FLAG_POWERBOARD_GOOD: -// error_die_forever(); -// break; -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return &(analog_variables[0]); -//} -// -//digital_variable_t* digital_variable_get_pointer_by_enum(enum_variable_number_t _variable_index) { -// switch(_variable_index) { -// -// case VARIABLE_NUMBER_MON_DUL_BOARDTEMP: -// case VARIABLE_NUMBER_MON_TEMP2: -// case VARIABLE_NUMBER_MON_TEMP1: -// case VARIABLE_NUMBER_MON_VEOC_RTN_I: -// case VARIABLE_NUMBER_MON_VEOC_FWR_I: -// case VARIABLE_NUMBER_MON_HYDRO_I: -// case VARIABLE_NUMBER_MON_INPUT_V: -// case VARIABLE_NUMBER_MON_LBL_I: -// case VARIABLE_NUMBER_MON_GLRA_I: -// case VARIABLE_NUMBER_MON_GLRB_I: -// case VARIABLE_NUMBER_MON_PWB_I: -// error_die_forever(); -// break; -// -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS1: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMPOS1]); -// case VARIABLE_NUMBER_FLAG_DUL_ALARMPOS2: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMPOS2]); -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG1: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMNEG1]); -// case VARIABLE_NUMBER_FLAG_DUL_ALARMNEG2: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMNEG2]); -// case VARIABLE_NUMBER_FLAG_HYDRO_PWR_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_HYDRO_PWR_FAULT]); -// case VARIABLE_NUMBER_FLAG_LBL_PWR_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_LBL_PWR_FAULT]); -// case VARIABLE_NUMBER_FLAG_GLRA_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRA_FAULT]); -// case VARIABLE_NUMBER_FLAG_GLRB_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRB_FAULT]); -// case VARIABLE_NUMBER_FLAG_POWERBOARD_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_POWERBOARD_FAULT]); -// case VARIABLE_NUMBER_FLAG_GLRA_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRA_GOOD]); -// case VARIABLE_NUMBER_FLAG_GLRB_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRB_GOOD]); -// case VARIABLE_NUMBER_FLAG_POWERBOARD_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_POWERBOARD_GOOD]); -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return &(digital_variables[0]); -//} -// -//bool alarm_is_analog_by_enum(enum_alarm_number_t _alarm_index) { -// switch(_alarm_index) { -// -// case ALARM_NUMBER_ALARM_SLOW_MON_DUL_BOARDTEMP: -// case ALARM_NUMBER_ALARM_FAST_MON_DUL_BOARDTEMP: -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP2: -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP2: -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP1: -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP1: -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_RTN_I: -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_RTN_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_FWR_I: -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_FWR_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_HYDRO_I: -// case ALARM_NUMBER_ALARM_FAST_MON_HYDRO_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_INPUT_V: -// case ALARM_NUMBER_ALARM_FAST_MON_INPUT_V: -// case ALARM_NUMBER_ALARM_SLOW_MON_LBL_I: -// case ALARM_NUMBER_ALARM_FAST_MON_LBL_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRA_I: -// case ALARM_NUMBER_ALARM_FAST_MON_GLRA_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRB_I: -// case ALARM_NUMBER_ALARM_FAST_MON_GLRB_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_PWB_I: -// case ALARM_NUMBER_ALARM_FAST_MON_PWB_I: -// return true; -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS1: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS2: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG1: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG2: -// case ALARM_NUMBER_ALARM_FLAG_HYDRO_PWR_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_LBL_PWR_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRA_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRB_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRA_GOOD: -// case ALARM_NUMBER_ALARM_FLAG_GLRB_GOOD: -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_GOOD: -// return false; -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return false; -//} -// -//analogalarm_info_t* alarm_get_analog_alarm_ptr_by_enum(enum_alarm_number_t _alarm_index) { -// switch(_alarm_index) { -// -// case ALARM_NUMBER_ALARM_SLOW_MON_DUL_BOARDTEMP: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_DUL_BOARDTEMP].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_DUL_BOARDTEMP: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_DUL_BOARDTEMP].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP2: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP2].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP2: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP2].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP1: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP1].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP1: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_TEMP1].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_RTN_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_RTN_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_RTN_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_RTN_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_FWR_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_FWR_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_FWR_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_VEOC_FWR_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_HYDRO_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_HYDRO_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_HYDRO_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_HYDRO_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_INPUT_V: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_INPUT_V].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_INPUT_V: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_INPUT_V].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_LBL_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_LBL_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_LBL_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_LBL_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRA_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRA_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_GLRA_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRA_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRB_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_GLRB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_GLRB_I].alarms.fast); -// case ALARM_NUMBER_ALARM_SLOW_MON_PWB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_PWB_I].alarms.slow); -// case ALARM_NUMBER_ALARM_FAST_MON_PWB_I: return &(analog_variables[ANALOG_VARIABLE_INDEX_MON_PWB_I].alarms.fast); -// -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS1: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS2: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG1: -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG2: -// case ALARM_NUMBER_ALARM_FLAG_HYDRO_PWR_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_LBL_PWR_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRA_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRB_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_FAULT: -// case ALARM_NUMBER_ALARM_FLAG_GLRA_GOOD: -// case ALARM_NUMBER_ALARM_FLAG_GLRB_GOOD: -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_GOOD: -// error_die_forever(); -// break; -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return &(analog_variables[0].alarms.slow); -//} -// -//digitalalarm_info_t* alarm_get_digital_alarm_ptr_by_enum(enum_alarm_number_t _alarm_index) { -// switch(_alarm_index) { -// -// case ALARM_NUMBER_ALARM_SLOW_MON_DUL_BOARDTEMP: -// case ALARM_NUMBER_ALARM_FAST_MON_DUL_BOARDTEMP: -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP2: -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP2: -// case ALARM_NUMBER_ALARM_SLOW_MON_TEMP1: -// case ALARM_NUMBER_ALARM_FAST_MON_TEMP1: -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_RTN_I: -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_RTN_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_VEOC_FWR_I: -// case ALARM_NUMBER_ALARM_FAST_MON_VEOC_FWR_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_HYDRO_I: -// case ALARM_NUMBER_ALARM_FAST_MON_HYDRO_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_INPUT_V: -// case ALARM_NUMBER_ALARM_FAST_MON_INPUT_V: -// case ALARM_NUMBER_ALARM_SLOW_MON_LBL_I: -// case ALARM_NUMBER_ALARM_FAST_MON_LBL_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRA_I: -// case ALARM_NUMBER_ALARM_FAST_MON_GLRA_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_GLRB_I: -// case ALARM_NUMBER_ALARM_FAST_MON_GLRB_I: -// case ALARM_NUMBER_ALARM_SLOW_MON_PWB_I: -// case ALARM_NUMBER_ALARM_FAST_MON_PWB_I: -// error_die_forever(); -// break; -// -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS1: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMPOS1].alarm); -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMPOS2: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMPOS2].alarm); -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG1: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMNEG1].alarm); -// case ALARM_NUMBER_ALARM_FLAG_DUL_ALARMNEG2: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_DUL_ALARMNEG2].alarm); -// case ALARM_NUMBER_ALARM_FLAG_HYDRO_PWR_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_HYDRO_PWR_FAULT].alarm); -// case ALARM_NUMBER_ALARM_FLAG_LBL_PWR_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_LBL_PWR_FAULT].alarm); -// case ALARM_NUMBER_ALARM_FLAG_GLRA_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRA_FAULT].alarm); -// case ALARM_NUMBER_ALARM_FLAG_GLRB_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRB_FAULT].alarm); -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_FAULT: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_POWERBOARD_FAULT].alarm); -// case ALARM_NUMBER_ALARM_FLAG_GLRA_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRA_GOOD].alarm); -// case ALARM_NUMBER_ALARM_FLAG_GLRB_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_GLRB_GOOD].alarm); -// case ALARM_NUMBER_ALARM_FLAG_POWERBOARD_GOOD: return &(digital_variables[DIGITAL_VARIABLE_INDEX_FLAG_POWERBOARD_GOOD].alarm); -// -// } -// error_die_forever(); -// // never reached, just to avoid one warning -// return &(digital_variables[0].alarm); -//} - bool* alarm_get_enable_ptr_by_enum(enum_alarm_number_t _alarm_index) { if(alarm_is_analog_by_enum(_alarm_index)) { return &(alarm_get_analog_alarm_ptr_by_enum(_alarm_index)->enabled); @@ -278,14 +28,6 @@ alarm_timeout_t* alarm_get_timeout_ptr_by_enum(enum_alarm_number_t _alarm_index) } } -//alarm_timeout_t* alarm_get_timeout_counter_ptr_by_enum(enum_alarm_number_t _alarm_index) { -// if(alarm_is_analog_by_enum(_alarm_index)) { -// return &(alarm_get_analog_alarm_ptr_by_enum(_alarm_index)->timeout_counter); -// }else{ -// return &(alarm_get_digital_alarm_ptr_by_enum(_alarm_index)->timeout_counter); -// } -//} - alarm_timeout_t* alarm_get_timeout_counter_max_ptr_by_enum(enum_alarm_number_t _alarm_index) { if(alarm_is_analog_by_enum(_alarm_index)) { return &(alarm_get_analog_alarm_ptr_by_enum(_alarm_index)->timeout_counter_max); @@ -302,38 +44,31 @@ alarm_firecount_t* alarm_get_firecount_ptr_by_enum(enum_alarm_number_t _alarm_in } } -//DA RIVEDERE... -//// open switch SWITCH_VEOC_RETURN and update switch structure (call from irq only) -//void switch_SWITCH_VEOC_RETURN_set_open_irq(void) { -// DIGITAL_OUT_SWITCH_VEOC_RETURN_SetLow(); -// switches.state_SWITCH_VEOC_RETURN = SWITCHSTATE_OPEN; -//} -// -//// open switch SWITCH_VEOC_DIRECT and update switch structure (call from irq only) -//void switch_SWITCH_VEOC_DIRECT_set_open_irq(void) { -// DIGITAL_OUT_SWITCH_VEOC_DIRECT_SetLow(); -// switches.state_SWITCH_VEOC_DIRECT = SWITCHSTATE_OPEN; -//} -// -//// open switch SWITCH_12V_ENABLE and update switch structure (call from irq only) -//void switch_SWITCH_12V_ENABLE_set_open_irq(void) { -// DIGITAL_OUT_SWITCH_12V_ENABLE_SetLow(); -// switches.state_SWITCH_12V_ENABLE = SWITCHSTATE_OPEN; -//} -// -//// open switch SWITCH_HYDRO and update switch structure (call from irq only) -//void switch_SWITCH_HYDRO_set_open_irq(void) { -// DIGITAL_OUT_SWITCH_HYDRO_SetLow(); -// switches.state_SWITCH_HYDRO = SWITCHSTATE_OPEN; -//} -// -//// open switch SWITCH_LBL and update switch structure (call from irq only) -//void switch_SWITCH_LBL_set_open_irq(void) { -// DIGITAL_OUT_SWITCH_LBL_SetLow(); -// switches.state_SWITCH_LBL = SWITCHSTATE_OPEN; -//} +// ...see .h +void switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(void) { + DOUT_375V_RTN_SWITCH_ON_OFF_SetLow(); + switches.state_SWITCH_VEOC_RETURN = SWITCHSTATE_OPEN; +} + +// ...see .h +void switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(void) { + DOUT_375V_FWR_SWTCH_ON_OFF_SetLow(); + switches.state_SWITCH_VEOC_DIRECT = SWITCHSTATE_OPEN; +} + +// ...see .h +void switch_SWITCH_HYDRO_set_open_fromIRQ(void) { + DOUT_HYDRO_SWITCH_ON_OFF_SetLow(); + switches.state_SWITCH_HYDRO = SWITCHSTATE_OPEN; +} + +// ...see .h +void switch_SWITCH_LBL_set_open_fromIRQ(void) { + DOUT_LBL_SWITCH_ON_OFF_SetLow(); + switches.state_SWITCH_LBL = SWITCHSTATE_OPEN; +} void dummy_alarm_callback(void) { // should never be called - error_die_forever(); + error_die_forever_fromIRQ(); } diff --git a/micro/BPD-V01-FIRMWARE.X/spurious.h b/micro/BPD-V01-FIRMWARE.X/spurious.h index 5b9b17daf43bd6a1c28c74324334fd2c3def7222..fa9881cd254c82c2158102a43f48f7bdaea82163 100644 --- a/micro/BPD-V01-FIRMWARE.X/spurious.h +++ b/micro/BPD-V01-FIRMWARE.X/spurious.h @@ -13,27 +13,19 @@ #include "typedefs.h" #include "generated/sources/variables.h" -// moved to pythonized stuff -//bool variable_is_analog_by_enum(enum_variable_number_t _variable_index); -//analog_variable_t* analog_variable_get_pointer_by_enum(enum_variable_number_t _variable_index); -//bool alarm_is_analog_by_enum(enum_alarm_number_t _alarm_index); -//analogalarm_info_t* alarm_get_analog_alarm_ptr_by_enum(enum_alarm_number_t _alarm_index); -//digital_variable_t* digital_variable_get_pointer_by_enum(enum_variable_number_t _variable_index); -//digitalalarm_info_t* alarm_get_digital_alarm_ptr_by_enum(enum_alarm_number_t _alarm_index); - bool* alarm_get_enable_ptr_by_enum(enum_alarm_number_t _alarm_index); alarm_timeout_t* alarm_get_timeout_ptr_by_enum(enum_alarm_number_t _alarm_index); //alarm_timeout_t* alarm_get_timeout_counter_ptr_by_enum(enum_alarm_number_t _alarm_index); alarm_timeout_t* alarm_get_timeout_counter_max_ptr_by_enum(enum_alarm_number_t _alarm_index); alarm_firecount_t* alarm_get_firecount_ptr_by_enum(enum_alarm_number_t _alarm_index); -//DA RINOMINARE -//void switch_SWITCH_VEOC_RETURN_set_open_irq(void); -//void switch_SWITCH_VEOC_DIRECT_set_open_irq(void); -//void switch_SWITCH_12V_ENABLE_set_open_irq(void); -//void switch_SWITCH_HYDRO_set_open_irq(void); -//void switch_SWITCH_LBL_set_open_irq(void); - +// Switch control functions (to be called from IRQ) +// they are just replicated versions of non-IRQ, to avoid compiler complaining: +// "appears in multiple call graphs and has been duplicated by the compiler" +void switch_SWITCH_VEOC_RETURN_set_open_fromIRQ(void); +void switch_SWITCH_VEOC_DIRECT_set_open_fromIRQ(void); +void switch_SWITCH_HYDRO_set_open_fromIRQ(void); +void switch_SWITCH_LBL_set_open_fromIRQ(void); void dummy_alarm_callback(void); diff --git a/micro/BPD-V01-FIRMWARE.X/timing.c b/micro/BPD-V01-FIRMWARE.X/timing.c index 17e02eaaa3d7f0bb4fe3becbce2fa00e6196d39b..c0b0779895e08aa15ad394b71c0dec4ca4c9ba64 100644 --- a/micro/BPD-V01-FIRMWARE.X/timing.c +++ b/micro/BPD-V01-FIRMWARE.X/timing.c @@ -70,6 +70,12 @@ void timing_tick_irq(void) { // check if a second has elapsed if(_tick_counter_us >= 1000000) { // ONE second elapsed! + + // TODO LED remove activity + if(userpin_SWITCH_LED_D9_get()) userpin_SWITCH_LED_D9_set_low(); + else userpin_SWITCH_LED_D9_set_high(); + + // increment number of seconds since last received command _timing_seconds_lc += 1; // increment number of seconds since reset