Sensorian  1.0
C API Reference Guide Library
Utilities.h
Go to the documentation of this file.
1 #ifndef __UTILITIES_H__
2 #define __UTILITIES_H__
3 
4 #include <bcm2835.h>
5 #include <stdio.h>
6 #include <stdint.h>
7 
8 #define ALPHA_BOARD
9 
10 typedef uint8_t PIN_t;
11 
12 typedef enum PinLev {LOWLEVEL = 0, HIGHLEVEL} PinLevel_t;
13 
14 #ifdef ALPHA_BOARD
15 
16 #define MPL_PIN RPI_V2_GPIO_P1_07
17 #define LUX_PIN RPI_V2_GPIO_P1_11
18 #define ACLM_PIN RPI_V2_GPIO_P1_12
19 #define ALERT_PIN RPI_V2_GPIO_P1_13
20 #define LED_PIN RPI_V2_GPIO_P1_15
21 #define MFP_PIN RPI_V2_GPIO_P1_18
22 
23 #else
24 
25 #define MPL_PIN RPI_V2_GPIO_P1_15
26 #define LUX_PIN RPI_V2_GPIO_P1_11
27 #define ACLM_PIN RPI_V2_GPIO_P1_07
28 #define ALERT_PIN RPI_V2_GPIO_P1_13
29 #define LED_PIN RPI_V2_GPIO_P1_12
30 #define MFP_PIN RPI_V2_GPIO_P1_18
31 
32 #endif
33 
34 void delay_ms(unsigned int ms);
35 
37 void pinModeOutput(PIN_t pin);
38 void digitalWrite(PIN_t pin, unsigned char level);
39 
46 void EnableDetectLowLevel(PIN_t pin);
50 
51 #endif
void pinModeOutput(PIN_t pin)
Configures the given pin as output.
Definition: Utilities.c:49
void DisableDetectRisingEdge(PIN_t pin)
Disables detection of rising edge.
Definition: Utilities.c:93
void EnableDetectFallingEdge(PIN_t pin)
Enables detection of falling edge.
Definition: Utilities.c:103
void DisableDetectFallinggEdge(PIN_t pin)
Dsiables detection of falling edge.
Definition: Utilities.c:113
void DisableDetectRisingInterrupt(PIN_t pin)
Disables detection of rising edge interrupt.
Definition: Utilities.c:173
void EnableDetectRisingEdge(PIN_t pin)
Enables detection of rising edge.
Definition: Utilities.c:83
PinLevel_t ReadPinStatus(PIN_t pin)
Configures the pins as input and returns the pin status.
Definition: Utilities.c:70
void EnableDetectLowLevel(PIN_t pin)
Enables detection of low level.
Definition: Utilities.c:143
enum PinLev PinLevel_t
void DisableDetectHighLevel(PIN_t pin)
Disables detection of high level.
Definition: Utilities.c:133
uint8_t PIN_t
Definition: Utilities.h:37
void delay_ms(unsigned int ms)
Delay in ms.
Definition: Utilities.c:39
void digitalWrite(PIN_t pin, unsigned char level)
Write a logic level to the pin. The pin should be confgured as output.
Definition: Utilities.c:60
PinLev
Definition: Utilities.h:39
void EnableDetectHighLevel(PIN_t pin)
Enables detection of high level on pin.
Definition: Utilities.c:123
void DisableDetectLowLevel(PIN_t pin)
Disables detection of low level.
Definition: Utilities.c:153
void EnableDetectRisingInterrupt(PIN_t pin)
Enables detection of rising edge interrupt.
Definition: Utilities.c:163