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-10-15 23:42:50 +0200
commit729f2a2c3ebfb2612d873caf453a1d7ca02180d9 (patch)
tree7bab2fcc0c7f50eab3013348697bc06ddd71d551 /firmware/inc/peripheral/twi.h
downloadvarpa-729f2a2c3ebfb2612d873caf453a1d7ca02180d9.tar.gz
varpa-729f2a2c3ebfb2612d873caf453a1d7ca02180d9.zip
varpa: initial public commit
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