mbed-drivers
mbed-drivers
PortIn.h
1
/*
2
* Copyright (c) 2006-2016, ARM Limited, All Rights Reserved
3
* SPDX-License-Identifier: Apache-2.0
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6
* not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
#ifndef MBED_PORTIN_H
18
#define MBED_PORTIN_H
19
20
#include "platform.h"
21
22
#if DEVICE_PORTIN
23
24
#include "port_api.h"
25
26
namespace
mbed
{
27
51
class
PortIn
{
52
public
:
53
59
PortIn
(PortName port,
int
mask = 0xFFFFFFFF) {
60
port_init(&_port, port, mask, PIN_INPUT);
61
}
62
68
int
read
() {
69
return
port_read(&_port);
70
}
71
76
void
mode
(PinMode
mode
) {
77
port_mode(&_port, mode);
78
}
79
82
operator
int() {
83
return
read
();
84
}
85
86
private
:
87
port_t _port;
88
};
89
90
}
// namespace mbed
91
92
#endif
93
94
#endif
mbed::PortIn::read
int read()
Definition:
PortIn.h:68
mbed::PortIn::mode
void mode(PinMode mode)
Definition:
PortIn.h:76
mbed::PortIn
Definition:
PortIn.h:51
mbed::PortIn::PortIn
PortIn(PortName port, int mask=0xFFFFFFFF)
Definition:
PortIn.h:59
mbed
Definition:
BusIn.cpp:19
Generated on Fri Oct 7 2016 15:12:40 for mbed-drivers by
1.8.11