summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--include/driver/aemr_transition_sync.h22
-rw-r--r--src/driver/aemr_transition_sync.cc58
3 files changed, 88 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 9ab2f86..613741c 100644
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,10 @@ ifneq ($(findstring resistive_load,${drivers}), )
CONFIG_driver_resistive_load = y
endif
+ifneq ($(findstring aemr_transition_sync,${drivers}), )
+ CONFIG_driver_aemr_transition_sync = y
+endif
+
ifneq ($(findstring softi2c,${drivers}), )
CONFIG_driver_softi2c = y
endif
@@ -241,6 +245,10 @@ ifdef CONFIG_driver_resistive_load
COMMON_FLAGS += -DRESISTIVE_LOAD_PIN4=GPIO::${resistor4_pin}
endif
+ifdef CONFIG_driver_aemr_transition_sync
+ CXX_TARGETS += src/driver/aemr_transition_sync.cc
+endif
+
ifdef CONFIG_driver_softi2c
CXX_TARGETS += src/driver/soft_i2c.cc
COMMON_FLAGS += -DDRIVER_SOFTI2C
diff --git a/include/driver/aemr_transition_sync.h b/include/driver/aemr_transition_sync.h
new file mode 100644
index 0000000..e805025
--- /dev/null
+++ b/include/driver/aemr_transition_sync.h
@@ -0,0 +1,22 @@
+#ifndef AEMR_TRANSITION_SYNC_H
+#define AEMR_TRANSITION_SYNC_H
+
+class AEMRTransitionSync {
+ private:
+ AEMRTransitionSync(const AEMRTransitionSync &copy);
+
+ public:
+ AEMRTransitionSync() {}
+ void setup();
+ void transBlip();
+ void trans10u();
+ void trans100u();
+ void trans1m();
+ void trans2m();
+ void trans5m();
+ void trans10m();
+};
+
+extern AEMRTransitionSync aemrTransitionSync;
+
+#endif
diff --git a/src/driver/aemr_transition_sync.cc b/src/driver/aemr_transition_sync.cc
new file mode 100644
index 0000000..b7881a4
--- /dev/null
+++ b/src/driver/aemr_transition_sync.cc
@@ -0,0 +1,58 @@
+#include "driver/aemr_transition_sync.h"
+#include "driver/gpio.h"
+#include "arch.h"
+
+void AEMRTransitionSync::setup()
+{
+ gpio.led_off(0);
+}
+
+void AEMRTransitionSync::transBlip()
+{
+ gpio.led_on(1);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans10u()
+{
+ gpio.led_on(1);
+ arch.delay_us(10);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans100u()
+{
+ gpio.led_on(1);
+ arch.delay_us(100);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans1m()
+{
+ gpio.led_on(1);
+ arch.delay_ms(1);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans2m()
+{
+ gpio.led_on(1);
+ arch.delay_ms(2);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans5m()
+{
+ gpio.led_on(1);
+ arch.delay_ms(5);
+ gpio.led_off(1);
+}
+
+void AEMRTransitionSync::trans10m()
+{
+ gpio.led_on(1);
+ arch.delay_ms(10);
+ gpio.led_off(1);
+}
+
+AEMRTransitionSync aemrTransitionSync;