Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /* mbed Microcontroller Library
lypinator 0:bb348c97df44 2 * Copyright (c) 2017 ARM Limited
lypinator 0:bb348c97df44 3 *
lypinator 0:bb348c97df44 4 * Licensed under the Apache License, Version 2.0 (the "License");
lypinator 0:bb348c97df44 5 * you may not use this file except in compliance with the License.
lypinator 0:bb348c97df44 6 * You may obtain a copy of the License at
lypinator 0:bb348c97df44 7 *
lypinator 0:bb348c97df44 8 * http://www.apache.org/licenses/LICENSE-2.0
lypinator 0:bb348c97df44 9 *
lypinator 0:bb348c97df44 10 * Unless required by applicable law or agreed to in writing, software
lypinator 0:bb348c97df44 11 * distributed under the License is distributed on an "AS IS" BASIS,
lypinator 0:bb348c97df44 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lypinator 0:bb348c97df44 13 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 14 * limitations under the License.
lypinator 0:bb348c97df44 15 */
lypinator 0:bb348c97df44 16 #ifndef MBED_POLL_H
lypinator 0:bb348c97df44 17 #define MBED_POLL_H
lypinator 0:bb348c97df44 18
lypinator 0:bb348c97df44 19 #define POLLIN 0x0001 ///< Data may be read without blocking
lypinator 0:bb348c97df44 20 #define POLLOUT 0x0010 ///< Data may be written without blocking
lypinator 0:bb348c97df44 21 #define POLLERR 0x1000 ///< An error has occurred on the device or stream
lypinator 0:bb348c97df44 22 #define POLLHUP 0x2000 ///< The device has been disconnected
lypinator 0:bb348c97df44 23 #define POLLNVAL 0x4000 ///< The specified file handle value is invalid
lypinator 0:bb348c97df44 24
lypinator 0:bb348c97df44 25 namespace mbed {
lypinator 0:bb348c97df44 26
lypinator 0:bb348c97df44 27 class FileHandle;
lypinator 0:bb348c97df44 28
lypinator 0:bb348c97df44 29 /** \addtogroup platform */
lypinator 0:bb348c97df44 30 /** @{*/
lypinator 0:bb348c97df44 31 /**
lypinator 0:bb348c97df44 32 * \defgroup platform_poll poll functions
lypinator 0:bb348c97df44 33 * @{
lypinator 0:bb348c97df44 34 */
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 struct pollfh {
lypinator 0:bb348c97df44 37 FileHandle *fh;
lypinator 0:bb348c97df44 38 short events;
lypinator 0:bb348c97df44 39 short revents;
lypinator 0:bb348c97df44 40 };
lypinator 0:bb348c97df44 41
lypinator 0:bb348c97df44 42 /** A mechanism to multiplex input/output over a set of file handles(file descriptors).
lypinator 0:bb348c97df44 43 * For every file handle provided, poll() examines it for any events registered for that particular
lypinator 0:bb348c97df44 44 * file handle.
lypinator 0:bb348c97df44 45 *
lypinator 0:bb348c97df44 46 * @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events
lypinator 0:bb348c97df44 47 * @param nfhs number of file handles
lypinator 0:bb348c97df44 48 * @param timeout timer value to timeout or -1 for loop forever
lypinator 0:bb348c97df44 49 *
lypinator 0:bb348c97df44 50 * @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error.
lypinator 0:bb348c97df44 51 */
lypinator 0:bb348c97df44 52 int poll(pollfh fhs[], unsigned nfhs, int timeout);
lypinator 0:bb348c97df44 53
lypinator 0:bb348c97df44 54 /**@}*/
lypinator 0:bb348c97df44 55
lypinator 0:bb348c97df44 56 /**@}*/
lypinator 0:bb348c97df44 57
lypinator 0:bb348c97df44 58 } // namespace mbed
lypinator 0:bb348c97df44 59
lypinator 0:bb348c97df44 60 #endif //MBED_POLL_H