summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkutayboz <kutayboz@gmail.com>2023-06-09 02:05:44 +0300
committerkutayboz <kutayboz@gmail.com>2023-06-09 02:05:44 +0300
commitc516904d94603631a1abccc7525e00c9c35533f8 (patch)
treeb729ff84ff50d7fe911902f9fe2a6b2b09d1a690 /src
parentfa86a84a62be8a24a37ec8560cbe3decc9a60845 (diff)
downloadcelnetmon-c516904d94603631a1abccc7525e00c9c35533f8.tar.gz
Changed pin numbers to preprocessor definitions
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 08363b6..7d7a575 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,6 +8,8 @@
#define PATH_TO_SERIAL_PORT "/dev/serial0"
#define PATH_TO_GPIO_CHIP "/dev/gpiochip0"
+#define PIN_NUM_PWR_KEY 17
+#define PIN_NUM_STATUS 27
int main() {
/* char *commandList[] = {"AT",
@@ -39,7 +41,8 @@ int main() {
"AT+QPING=1,\"www.google.fi\"",
"AT+QPING=1,\"8.8.8.8\""}; */
- if (0 != powerOn(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, 27, 17)) {
+ if (0 != powerOn(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, PIN_NUM_STATUS,
+ PIN_NUM_PWR_KEY)) {
printf("Error powering the module on\n");
return 1;
}
@@ -56,7 +59,8 @@ int main() {
if (0 != tcpipInit(PATH_TO_SERIAL_PORT)) {
printf("Error initiating TCP/IP context\nPowering off\n");
- if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, 27, 17)) {
+ if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, PIN_NUM_STATUS,
+ PIN_NUM_PWR_KEY)) {
printf("Error powering the module off\n");
return 1;
}
@@ -65,14 +69,16 @@ int main() {
if (0 != tcpipClose(PATH_TO_SERIAL_PORT)) {
printf("Error closing TCP/IP context\nPowering off\n");
- if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, 27, 17)) {
+ if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, PIN_NUM_STATUS,
+ PIN_NUM_PWR_KEY)) {
printf("Error powering the module off\n");
return 1;
}
return 1;
}
- if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, 27, 17)) {
+ if (0 != powerOff(PATH_TO_SERIAL_PORT, PATH_TO_GPIO_CHIP, PIN_NUM_STATUS,
+ PIN_NUM_PWR_KEY)) {
printf("Error powering the module off\n");
return 1;
}