summaryrefslogtreecommitdiff
path: root/dio.h
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-08-21 18:42:49 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-08-21 18:42:49 +0200
commit063ac23917f608202b337b09fe355d9223493245 (patch)
tree8d45778269529e4d2a0bcbca8cc128c9a15cc0bd /dio.h
parentff6ccb57551afe8904254313fb7ed0204fe74d19 (diff)
downloadTraffic-light-063ac23917f608202b337b09fe355d9223493245.tar.xz
Traffic-light-063ac23917f608202b337b09fe355d9223493245.zip
Added intital project
Diffstat (limited to 'dio.h')
-rw-r--r--dio.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/dio.h b/dio.h
new file mode 100644
index 0000000..6c369e9
--- /dev/null
+++ b/dio.h
@@ -0,0 +1,25 @@
+#include "tm4c123gh6pm.h"
+#include "Bitwise_operations.h"
+#include <stdint.h>
+
+#define DIROFF 0x400 / 4
+#define PUROFF 0x510 / 4
+#define POROFF 0x514 / 4
+#define DENOFF 0x51c / 4
+#define LOCKOFF 0x520 / 4
+#define COMMITOFF 0x524 / 4
+
+#define PORTF GPIO_PORTF_DATA_R
+#define RIGHT_SWITCH !DIO_ReadPin(&PORTF, 0)
+#define LEFT_SWITCH !DIO_ReadPin(&PORTF, 4)
+#define BOTH_SWITCHES RIGHT_SWITCH && LEFT_SWITCH
+#define DELAY 10000
+
+
+void DIO_Init(char port, unsigned int dir, unsigned int pur);
+void DIO_WritePin(volatile uint32_t* port, unsigned int pin, unsigned int value);
+void DIO_WritePort(volatile uint32_t* port, unsigned int value);
+int DIO_ReadPin(volatile uint32_t* port, unsigned int pin);
+uint32_t DIO_ReadPort(volatile uint32_t port);
+void delay(int value);
+