ARCS6 AR6-REV.24062600
読み取り中…
検索中…
一致する文字列を見つけられません
RPi2GPIO.hh
[詳解]
1
8//
9// Copyright (C) 2011-2019 Yuki YOKOKURA
10// This program is free software;
11// you can redistribute it and/or modify it under the terms of the FreeBSD License.
12// For details, see the License.txt file.
13
14#ifndef RPI2GPIO
15#define RPI2GPIO
16
17#include <stdint.h>
18
19namespace ARCS { // ARCS名前空間
21 class RPi2GPIO {
22 public:
24 enum IOmode {
26 OUT
27 };
28 RPi2GPIO();
29 ~RPi2GPIO();
30 RPi2GPIO(RPi2GPIO&& r);
31 void SetConfig(int port, IOmode mode); // 入出力を設定する関数 port : GPIO番号,mode : RPi2GPIO::IN or RPi2GPIO::OUT
32 void SetConfig_GPIO9to0(uint32_t bitdata); // GPIO9~0の設定レジスタを一括設定する関数
33 void SetConfig_GPIO19to10(uint32_t bitdata);// GPIO19~10の設定レジスタを一括設定する関数
34 void SetConfig_GPIO29to20(uint32_t bitdata);// GPIO29~20の設定レジスタを一括設定する関数
35 void SetConfig_GPIO39to30(uint32_t bitdata);// GPIO39~30の設定レジスタを一括設定する関数
36 void SetConfig_GPIO49to40(uint32_t bitdata);// GPIO49~40の設定レジスタを一括設定する関数
37 void SetConfig_GPIO53to50(uint32_t bitdata);// GPIO53~50の設定レジスタを一括設定する関数
38 void SetConfig_AllOutput(void); // すべてのGPIOピンを出力モードに設定する関数
39 void SetBitDataLo(uint32_t bitdata); // GPIO31~0 からビットデータを一括出力する関数
40 void SetBitDataHi(uint32_t bitdata); // GPIO39~32 からビットデータを一括出力する関数
41 void BitSet(unsigned int port); // 指定したGPIOを 1 にする関数
42 void BitClear(unsigned int port); // 指定したGPIOを 0 にする関数
43 uint32_t GetBitDataLo(void) const; // GPIO31~0 からデータを一括入力する関数
44 uint32_t GetBitDataHi(void) const; // GPIO53~32 からデータを一括入力する関数
45 bool BitGet(unsigned int port) const; // 指定したGPIOからビットの状態を取得する関数
46 void SetACTLED(bool onoff); // ACT LED の点灯を制御する関数 onoff=trueでオン、onff=falseでオフ
47 void SetPWRLED(bool onoff); // PWR LED の点灯を制御する関数 onoff=trueでオン、onff=falseでオフ
48
49 private:
50 RPi2GPIO(const RPi2GPIO&) = delete;
51 const RPi2GPIO& operator=(const RPi2GPIO&) = delete;
52
53 static const int IOREG_SIZE = 64;
54 static const unsigned long IOREG_ADDRESS = 0x3F200000;
55
56 int fd;
57 uint32_t* IOptr;
58 };
59}
60
61#endif
62
Raspberry Pi 2 GPIOコントローラ
Definition RPi2GPIO.hh:21
IOmode
入出力モード設定用
Definition RPi2GPIO.hh:24
@ OUT
出力モード
Definition RPi2GPIO.hh:26
@ IN
入力モード
Definition RPi2GPIO.hh:25
RPi2GPIO()
コンストラクタ
Definition RPi2GPIO.cc:49
~RPi2GPIO()
デストラクタ
Definition RPi2GPIO.cc:61