QuadroCopter  0.1.4
pinOverlay.h
Go to the documentation of this file.
1 //
2 // Created by Michael Brookes on 29/05/2016.
3 /*
4 Copyright (C) 2017 Michael Brookes
5 
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 This program 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 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef BEAGLEBONE_PWM_PINOVERLAY_H
21 #define BEAGLEBONE_PWM_PINOVERLAY_H
22 
23 #include "overlayBase.h"
25 
26 #define MAX_BUF 255
27 
28 namespace quadro {
29 
30  namespace overlays {
31 
32  class pinOverlay : public overlayBase {
33 
34  public:
35 
36  pinOverlay( pinBlocks _BLOCK, PWMPins _PIN ) throw( overlaySetupException& );
37 
38  struct overlaySettings {
39  const char* overlay = "bone_pwm_P";
40  const char* overlayDir = "/sys/devices/ocp.3/";
41  const char* searchFile = "pwm_test_P";
43  } settings;
44 
46 
47  private:
48  void setBlock( pinBlocks _BLOCK );
49 
50  void setPin( PWMPins _PIN );
51 
52  void findPinDir();
53 
54  char pinOverlayName[24];
55 
56  PWMPins pin;
57  pinBlocks block;
58 
59  };
60 
61  }
62 
63 }
64 
65 #endif //BEAGLEBONE_PWM_PINOVERLAY_H
const char * overlay
Definition: pinOverlay.h:39
Definition: overlayBase.h:60
pinBlocks
Definition: overlayBase.h:43
const char * searchFile
Definition: pinOverlay.h:41
struct quadro::overlays::pinOverlay::overlaySettings settings
Definition: pinOverlay.h:32
Definition: overlaySetupException.h:18
Definition: aeronautics.h:23
char pinOverlayDir[MAX_BUF]
Stores the PWM folder name.
Definition: pinOverlay.h:45
pinOverlay(pinBlocks _BLOCK, PWMPins _PIN)
Definition: pinOverlay.cpp:25
PWMPins
PinNum refers to a exposed PWM Pin on your BBB, this enum can be expanded to include more if required...
Definition: overlayBase.h:51
const char * overlayDir
Definition: pinOverlay.h:40
#define MAX_BUF
Definition: pinOverlay.h:26
bool overlayLoaded
Definition: pinOverlay.h:42