From 0cb04999031ca856ec6b145c25a22de27242ea32 Mon Sep 17 00:00:00 2001 From: susanw1 Date: Sat, 18 Nov 2023 15:29:47 +0000 Subject: [PATCH] [#141] Changed from module 3 to 4 --- .../c++/arduino/pins-module/PinModule.hpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/receivers/native/arduino/src/main/c++/arduino/pins-module/PinModule.hpp b/receivers/native/arduino/src/main/c++/arduino/pins-module/PinModule.hpp index e19b12b75..10ea84469 100644 --- a/receivers/native/arduino/src/main/c++/arduino/pins-module/PinModule.hpp +++ b/receivers/native/arduino/src/main/c++/arduino/pins-module/PinModule.hpp @@ -49,14 +49,16 @@ #include "commands/DigitalPinReadCommand.hpp" #include "commands/PinCapabilitiesCommand.hpp" -#define MODULE_EXISTS_003 EXISTENCE_MARKER_UTIL -#define MODULE_SWITCH_003 MODULE_SWITCH_UTIL(PinModule::execute) +#define MODULE_EXISTS_004 EXISTENCE_MARKER_UTIL +#define MODULE_SWITCH_004 MODULE_SWITCH_UTIL(PinModule::execute) #ifdef ZSCRIPT_PIN_SUPPORT_NOTIFICATIONS -#define MODULE_NOTIFICATION_EXISTS_003 EXISTENCE_MARKER_UTIL -#define MODULE_NOTIFICATION_SWITCH_003 NOTIFICATION_SWITCH_UTIL(PinModule::notification) +#define MODULE_NOTIFICATION_EXISTS_004 EXISTENCE_MARKER_UTIL +#define MODULE_NOTIFICATION_SWITCH_004 NOTIFICATION_SWITCH_UTIL(PinModule::notification) #endif + namespace Zscript { + template class PinModule { #ifdef ZSCRIPT_PIN_SUPPORT_NOTIFICATIONS @@ -67,7 +69,7 @@ class PinModule { static volatile bool hasDigitalNotificationWaiting; static void onNotificationNeededDigital() { - if (!notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x30)) { + if (!notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x40)) { hasDigitalNotificationWaiting = true; } } @@ -76,7 +78,7 @@ class PinModule { static volatile bool hasAnalogNotificationWaiting; static void onNotificationNeededAnalog() { - if (!notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x31)) { + if (!notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x41)) { hasAnalogNotificationWaiting = true; } } @@ -101,13 +103,13 @@ class PinModule { if (!notificationSource.hasNotification()) { if (hasDigitalNotificationWaiting) { hasDigitalNotificationWaiting = false; - notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x30); + notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x40); hasDigitalNotificationWaiting |= DigitalNotification::checkForWaitingNotification(); } #ifdef ZSCRIPT_PIN_SUPPORT_ANALOG_NOTIFICATIONS else if (hasAnalogNotificationWaiting) { hasAnalogNotificationWaiting = false; - notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x31); + notificationSource.setNotification(&GenericCore::LockSet::Empty, 0x41); hasAnalogNotificationWaiting |= AnalogNotification::checkForWaitingNotification(); } #endif @@ -178,11 +180,15 @@ class PinModule { template GenericCore::ZscriptNotificationSource PinModule::notificationSource; + template volatile bool PinModule::hasDigitalNotificationWaiting = false; + #ifdef ZSCRIPT_PIN_SUPPORT_ANALOG_NOTIFICATIONS + template volatile bool PinModule::hasAnalogNotificationWaiting = false; + #endif #endif }