MySensors Library & Examples  2.3.2
BCM.h
1 /*
2  * The MySensors Arduino library handles the wireless radio link and protocol
3  * between your home built sensors/actuators and HA controller of choice.
4  * The sensors forms a self healing radio network with optional repeaters. Each
5  * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6  * network topology allowing messages to be routed to nodes.
7  *
8  * Created by Henrik Ekblad <[email protected]>
9  * Copyright (C) 2013-2019 Sensnology AB
10  * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11  *
12  * Documentation: http://www.mysensors.org
13  * Support Forum: http://forum.mysensors.org
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * version 2 as published by the Free Software Foundation.
18  */
19 
20 #ifndef BCM_h
21 #define BCM_h
22 
23 #include <stdint.h>
24 #include "bcm2835.h"
25 
26 #define INPUT BCM2835_GPIO_FSEL_INPT
27 #define OUTPUT BCM2835_GPIO_FSEL_OUTP
28 
32 class BCMClass
33 {
34 
35 public:
39  ~BCMClass();
45  uint8_t init();
52  void pinMode(uint8_t gpio, uint8_t mode);
59  void digitalWrite(uint8_t gpio, uint8_t value);
66  uint8_t digitalRead(uint8_t gpio);
73  inline uint8_t digitalPinToInterrupt(uint8_t gpio);
79  uint8_t isInitialized();
80 
81 private:
82  static uint8_t initialized;
83 };
84 
85 uint8_t BCMClass::digitalPinToInterrupt(uint8_t gpio)
86 {
87  return gpio;
88 }
89 
90 extern BCMClass BCM;
91 
92 #endif
BCMClass::isInitialized
uint8_t isInitialized()
Checks if SPI was initialized.
BCMClass::digitalRead
uint8_t digitalRead(uint8_t gpio)
Reads the value from a specified pin.
BCMClass::~BCMClass
~BCMClass()
BCMClass destructor.
BCMClass::digitalPinToInterrupt
uint8_t digitalPinToInterrupt(uint8_t gpio)
Returns the same GPIO, no conversion is required.
Definition: BCM.h:85
BCMClass
BCM class.
Definition: BCM.h:32
BCMClass::pinMode
void pinMode(uint8_t gpio, uint8_t mode)
Configures the specified pin to behave either as an input or an output.
BCMClass::digitalWrite
void digitalWrite(uint8_t gpio, uint8_t value)
Write a high or a low value for the given pin.
BCMClass::init
uint8_t init()
Initializes BCM.