Sensorian  1.0
C API Reference Guide Library
main.c
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2015 Sensorian
3  * *
4  * This file is part of Sensorian. *
5  * *
6  * Sensorian is free software: you can redistribute it and/or modify it *
7  * under the terms of the GNU Lesser General Public License as published *
8  * by the Free Software Foundation, either version 3 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * Sensorian is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with Sensorian. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  ****************************************************************************/
20 
28 #include <bcm2835.h>
29 #include <stdio.h>
30 #include "Utilities.h"
31 
32 int main(int argc, char **argv)
33 {
34  if (!bcm2835_init()) //Configure I2C pins
35  {
36  printf("BCM libray error.\n");
37  }
38  unsigned char pval = 0;
39  printf("GPIO read pin status.\r\n");
40 
41  while (1)
42  {
43  pval = ReadPinStatus(MFP_PIN);
44  printf("MFP pin level is %d\r\n",pval);
45  delay_ms(1000);
46  pval = ReadPinStatus(MPL_PIN);
47  printf("MPL pin level is %d\r\n",pval);
48  delay_ms(1000);
49  pval = ReadPinStatus(LUX_PIN);
50  printf("LUX pin level is %d\r\n",pval);
51  delay_ms(1000);
52  pval = ReadPinStatus(ALERT_PIN);
53  printf("ALERT pin level is %d\r\n",pval);
54  delay_ms(1000);
55  pval = ReadPinStatus(LED_PIN);
56  printf("LED pin level is %d\r\n",pval);
57  delay_ms(1000);
58  pval = ReadPinStatus(ACLM_PIN);
59  printf("ACLM pin level is %d\r\n",pval);
60  delay_ms(1000);
61  }
62 
63  bcm2835_close();
64  return 0;
65 }
#define ALERT_PIN
Definition: Utilities.h:45
#define MFP_PIN
Definition: Utilities.h:47
PinLevel_t ReadPinStatus(PIN_t pin)
Configures the pins as input and returns the pin status.
Definition: Utilities.c:70
#define MPL_PIN
Definition: Utilities.h:42
int main(int argc, char **argv)
Definition: main.c:34
void delay_ms(unsigned int ms)
Delay in ms.
Definition: Utilities.c:39
#define ACLM_PIN
Definition: Utilities.h:44
Utilities driver header.
#define LED_PIN
Definition: Utilities.h:46
#define LUX_PIN
Definition: Utilities.h:43