summaryrefslogtreecommitdiff
path: root/firmware/inc/peripheral/twi.h
diff options
context:
space:
mode:
authordmlunar <root@lunar.sh>2025-01-22 16:47:21 +0200
committerdmlunar <root@lunar.sh>2025-12-02 16:02:10 +0200
commit288b138cb59325c42d1a64d9a87e3c879494fd72 (patch)
tree03dce50bb5118a3deb46389f191cfb6da5e9bcb9 /firmware/inc/peripheral/twi.h
downloadvarpa-288b138cb59325c42d1a64d9a87e3c879494fd72.tar.gz
varpa-288b138cb59325c42d1a64d9a87e3c879494fd72.zip
varpa: initial public commitHEADmain
Diffstat (limited to 'firmware/inc/peripheral/twi.h')
-rw-r--r--firmware/inc/peripheral/twi.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/firmware/inc/peripheral/twi.h b/firmware/inc/peripheral/twi.h
new file mode 100644
index 0000000..8f08777
--- /dev/null
+++ b/firmware/inc/peripheral/twi.h
@@ -0,0 +1,35 @@
+/**
+ *
+ * Author: Dylan Muller
+ * Copyright (c) 2025
+ * All rights reserved.
+ *
+ * - Commercial/IP use prohibited.
+ * - Attribution required.
+ * See License.txt
+ *
+ */
+
+#ifndef TWI_H_
+#define TWI_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define TWI_ADDRESS_W(x) (((x) << 1) & ~0x01)
+#define TWI_ADDRESS_R(x) (((x) << 1) | 0x01)
+
+void twi_init(void);
+
+bool twi_busy(void);
+
+void twi_flush(void);
+
+void twi_start(
+ uint8_t address,
+ uint8_t *data,
+ size_t len
+);
+
+#endif