summaryrefslogtreecommitdiffstats
path: root/hal/pin.tpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-05-04 00:16:36 +0200
committerNao Pross <naopross@thearcway.org>2018-05-04 00:16:36 +0200
commitc3767ac0c6bcb9a1aed1e7b666061f829a371e1f (patch)
tree36d1339fb999c066f424b8f03707e9a996aff02a /hal/pin.tpp
parentDefined Heap size (diff)
downloadSAMLiquidSmoke-c3767ac0c6bcb9a1aed1e7b666061f829a371e1f.tar.gz
SAMLiquidSmoke-c3767ac0c6bcb9a1aed1e7b666061f829a371e1f.zip
Start own HAL implementation based on MCC's generated files
Other changes: - Undo conversion of MCC files to C++ - Delete old Led implementation
Diffstat (limited to 'hal/pin.tpp')
-rw-r--r--hal/pin.tpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/hal/pin.tpp b/hal/pin.tpp
new file mode 100644
index 0000000..4f6bd4a
--- /dev/null
+++ b/hal/pin.tpp
@@ -0,0 +1,30 @@
+/*
+ * File: pin.cpp
+ * Author: naopross
+ *
+ * Created on May 3, 2018, 8:02 PM
+ */
+
+#include "pin.hpp"
+
+template<typename reg, unsigned bit>
+pin<reg, bit>::pin(reg *r)
+{
+ _register = r;
+}
+
+
+template<typename reg, unsigned bit>
+pin<reg, bit>::~pin()
+{
+
+}
+
+template<typename reg, unsigned bit>
+void pin<reg, bit>::set(bool v)
+{
+ if (v)
+ *reinterpret_cast<volatile uint8_t *>(_register) |= 1<<bit;
+ else
+ *reinterpret_cast<volatile uint8_t *>(_register) &= ~(1<<bit);
+} \ No newline at end of file