microSD カードのビットマップ・ファイルのビュアー.画像の最大値 縦:272ピクセル,横:480ピクセル. Bitmap file viewer for microSD card. Maximum size Vertical: 272 pixels, Horizontal: 480.
Dependencies: SDFileSystem_Warning_Fixed F746_GUI
mbed_src_STM32F7/common/BusIn.cpp@1:bb146d5fe9aa, 2018-10-23 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Tue Oct 23 11:51:47 2018 +0000
- Revision:
- 1:bb146d5fe9aa
- Parent:
- 0:f62ffd3644bf
2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:f62ffd3644bf | 1 | /* mbed Microcontroller Library |
MikamiUitOpen | 0:f62ffd3644bf | 2 | * Copyright (c) 2006-2013 ARM Limited |
MikamiUitOpen | 0:f62ffd3644bf | 3 | * |
MikamiUitOpen | 0:f62ffd3644bf | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
MikamiUitOpen | 0:f62ffd3644bf | 5 | * you may not use this file except in compliance with the License. |
MikamiUitOpen | 0:f62ffd3644bf | 6 | * You may obtain a copy of the License at |
MikamiUitOpen | 0:f62ffd3644bf | 7 | * |
MikamiUitOpen | 0:f62ffd3644bf | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MikamiUitOpen | 0:f62ffd3644bf | 9 | * |
MikamiUitOpen | 0:f62ffd3644bf | 10 | * Unless required by applicable law or agreed to in writing, software |
MikamiUitOpen | 0:f62ffd3644bf | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
MikamiUitOpen | 0:f62ffd3644bf | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MikamiUitOpen | 0:f62ffd3644bf | 13 | * See the License for the specific language governing permissions and |
MikamiUitOpen | 0:f62ffd3644bf | 14 | * limitations under the License. |
MikamiUitOpen | 0:f62ffd3644bf | 15 | */ |
MikamiUitOpen | 0:f62ffd3644bf | 16 | #include "BusIn.h" |
MikamiUitOpen | 0:f62ffd3644bf | 17 | #include "mbed_assert.h" |
MikamiUitOpen | 0:f62ffd3644bf | 18 | |
MikamiUitOpen | 0:f62ffd3644bf | 19 | namespace mbed { |
MikamiUitOpen | 0:f62ffd3644bf | 20 | |
MikamiUitOpen | 0:f62ffd3644bf | 21 | BusIn::BusIn(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) { |
MikamiUitOpen | 0:f62ffd3644bf | 22 | PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15}; |
MikamiUitOpen | 0:f62ffd3644bf | 23 | |
MikamiUitOpen | 0:f62ffd3644bf | 24 | _nc_mask = 0; |
MikamiUitOpen | 0:f62ffd3644bf | 25 | for (int i=0; i<16; i++) { |
MikamiUitOpen | 0:f62ffd3644bf | 26 | _pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0; |
MikamiUitOpen | 0:f62ffd3644bf | 27 | if (pins[i] != NC) { |
MikamiUitOpen | 0:f62ffd3644bf | 28 | _nc_mask |= (1 << i); |
MikamiUitOpen | 0:f62ffd3644bf | 29 | } |
MikamiUitOpen | 0:f62ffd3644bf | 30 | } |
MikamiUitOpen | 0:f62ffd3644bf | 31 | } |
MikamiUitOpen | 0:f62ffd3644bf | 32 | |
MikamiUitOpen | 0:f62ffd3644bf | 33 | BusIn::BusIn(PinName pins[16]) { |
MikamiUitOpen | 0:f62ffd3644bf | 34 | _nc_mask = 0; |
MikamiUitOpen | 0:f62ffd3644bf | 35 | for (int i=0; i<16; i++) { |
MikamiUitOpen | 0:f62ffd3644bf | 36 | _pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0; |
MikamiUitOpen | 0:f62ffd3644bf | 37 | if (pins[i] != NC) { |
MikamiUitOpen | 0:f62ffd3644bf | 38 | _nc_mask |= (1 << i); |
MikamiUitOpen | 0:f62ffd3644bf | 39 | } |
MikamiUitOpen | 0:f62ffd3644bf | 40 | } |
MikamiUitOpen | 0:f62ffd3644bf | 41 | } |
MikamiUitOpen | 0:f62ffd3644bf | 42 | |
MikamiUitOpen | 0:f62ffd3644bf | 43 | BusIn::~BusIn() { |
MikamiUitOpen | 0:f62ffd3644bf | 44 | for (int i=0; i<16; i++) { |
MikamiUitOpen | 0:f62ffd3644bf | 45 | if (_pin[i] != 0) { |
MikamiUitOpen | 0:f62ffd3644bf | 46 | delete _pin[i]; |
MikamiUitOpen | 0:f62ffd3644bf | 47 | } |
MikamiUitOpen | 0:f62ffd3644bf | 48 | } |
MikamiUitOpen | 0:f62ffd3644bf | 49 | } |
MikamiUitOpen | 0:f62ffd3644bf | 50 | |
MikamiUitOpen | 0:f62ffd3644bf | 51 | int BusIn::read() { |
MikamiUitOpen | 0:f62ffd3644bf | 52 | int v = 0; |
MikamiUitOpen | 0:f62ffd3644bf | 53 | for (int i=0; i<16; i++) { |
MikamiUitOpen | 0:f62ffd3644bf | 54 | if (_pin[i] != 0) { |
MikamiUitOpen | 0:f62ffd3644bf | 55 | v |= _pin[i]->read() << i; |
MikamiUitOpen | 0:f62ffd3644bf | 56 | } |
MikamiUitOpen | 0:f62ffd3644bf | 57 | } |
MikamiUitOpen | 0:f62ffd3644bf | 58 | return v; |
MikamiUitOpen | 0:f62ffd3644bf | 59 | } |
MikamiUitOpen | 0:f62ffd3644bf | 60 | |
MikamiUitOpen | 0:f62ffd3644bf | 61 | void BusIn::mode(PinMode pull) { |
MikamiUitOpen | 0:f62ffd3644bf | 62 | for (int i=0; i<16; i++) { |
MikamiUitOpen | 0:f62ffd3644bf | 63 | if (_pin[i] != 0) { |
MikamiUitOpen | 0:f62ffd3644bf | 64 | _pin[i]->mode(pull); |
MikamiUitOpen | 0:f62ffd3644bf | 65 | } |
MikamiUitOpen | 0:f62ffd3644bf | 66 | } |
MikamiUitOpen | 0:f62ffd3644bf | 67 | } |
MikamiUitOpen | 0:f62ffd3644bf | 68 | |
MikamiUitOpen | 0:f62ffd3644bf | 69 | #ifdef MBED_OPERATORS |
MikamiUitOpen | 0:f62ffd3644bf | 70 | BusIn::operator int() { |
MikamiUitOpen | 0:f62ffd3644bf | 71 | return read(); |
MikamiUitOpen | 0:f62ffd3644bf | 72 | } |
MikamiUitOpen | 0:f62ffd3644bf | 73 | |
MikamiUitOpen | 0:f62ffd3644bf | 74 | DigitalIn& BusIn::operator[] (int index) { |
MikamiUitOpen | 0:f62ffd3644bf | 75 | MBED_ASSERT(index >= 0 && index <= 16); |
MikamiUitOpen | 0:f62ffd3644bf | 76 | MBED_ASSERT(_pin[index]); |
MikamiUitOpen | 0:f62ffd3644bf | 77 | return *_pin[index]; |
MikamiUitOpen | 0:f62ffd3644bf | 78 | } |
MikamiUitOpen | 0:f62ffd3644bf | 79 | |
MikamiUitOpen | 0:f62ffd3644bf | 80 | #endif |
MikamiUitOpen | 0:f62ffd3644bf | 81 | |
MikamiUitOpen | 0:f62ffd3644bf | 82 | } // namespace mbed |