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) 2006-2016 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 #include "FileHandle.h"
lypinator 0:bb348c97df44 17 #include "platform/mbed_retarget.h"
lypinator 0:bb348c97df44 18 #include "platform/mbed_critical.h"
lypinator 0:bb348c97df44 19
lypinator 0:bb348c97df44 20 namespace mbed {
lypinator 0:bb348c97df44 21
lypinator 0:bb348c97df44 22 off_t FileHandle::size()
lypinator 0:bb348c97df44 23 {
lypinator 0:bb348c97df44 24 /* remember our current position */
lypinator 0:bb348c97df44 25 off_t off = seek(0, SEEK_CUR);
lypinator 0:bb348c97df44 26 if (off < 0) {
lypinator 0:bb348c97df44 27 return off;
lypinator 0:bb348c97df44 28 }
lypinator 0:bb348c97df44 29 /* seek to the end to get the file length */
lypinator 0:bb348c97df44 30 off_t size = seek(0, SEEK_END);
lypinator 0:bb348c97df44 31 /* return to our old position */
lypinator 0:bb348c97df44 32 seek(off, SEEK_SET);
lypinator 0:bb348c97df44 33 return size;
lypinator 0:bb348c97df44 34 }
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 } // namespace mbed