test

Dependencies:   F7_Ethernet mbed BSP_DISCO_F746NG SDFileSystem RF24

Committer:
lowlowry
Date:
Tue Jun 08 16:21:16 2021 +0000
Revision:
3:1c6da30ca347
Parent:
0:d984976f1f1c
test final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
leo44 0:d984976f1f1c 1 /* mbed Microcontroller Library
leo44 0:d984976f1f1c 2 * Copyright (c) 2006-2012 ARM Limited
leo44 0:d984976f1f1c 3 *
leo44 0:d984976f1f1c 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
leo44 0:d984976f1f1c 5 * of this software and associated documentation files (the "Software"), to deal
leo44 0:d984976f1f1c 6 * in the Software without restriction, including without limitation the rights
leo44 0:d984976f1f1c 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
leo44 0:d984976f1f1c 8 * copies of the Software, and to permit persons to whom the Software is
leo44 0:d984976f1f1c 9 * furnished to do so, subject to the following conditions:
leo44 0:d984976f1f1c 10 *
leo44 0:d984976f1f1c 11 * The above copyright notice and this permission notice shall be included in
leo44 0:d984976f1f1c 12 * all copies or substantial portions of the Software.
leo44 0:d984976f1f1c 13 *
leo44 0:d984976f1f1c 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
leo44 0:d984976f1f1c 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
leo44 0:d984976f1f1c 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
leo44 0:d984976f1f1c 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
leo44 0:d984976f1f1c 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
leo44 0:d984976f1f1c 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
leo44 0:d984976f1f1c 20 * SOFTWARE.
leo44 0:d984976f1f1c 21 */
leo44 0:d984976f1f1c 22 #include "RtosTimer.h"
leo44 0:d984976f1f1c 23
leo44 0:d984976f1f1c 24 #include <string.h>
leo44 0:d984976f1f1c 25
leo44 0:d984976f1f1c 26 #include "cmsis_os.h"
leo44 0:d984976f1f1c 27 #include "mbed_error.h"
leo44 0:d984976f1f1c 28
leo44 0:d984976f1f1c 29 namespace rtos {
leo44 0:d984976f1f1c 30
leo44 0:d984976f1f1c 31 RtosTimer::RtosTimer(void (*periodic_task)(void const *argument), os_timer_type type, void *argument) {
leo44 0:d984976f1f1c 32 #ifdef CMSIS_OS_RTX
leo44 0:d984976f1f1c 33 _timer.ptimer = periodic_task;
leo44 0:d984976f1f1c 34
leo44 0:d984976f1f1c 35 memset(_timer_data, 0, sizeof(_timer_data));
leo44 0:d984976f1f1c 36 _timer.timer = _timer_data;
leo44 0:d984976f1f1c 37 #endif
leo44 0:d984976f1f1c 38 _timer_id = osTimerCreate(&_timer, type, argument);
leo44 0:d984976f1f1c 39 }
leo44 0:d984976f1f1c 40
leo44 0:d984976f1f1c 41 osStatus RtosTimer::start(uint32_t millisec) {
leo44 0:d984976f1f1c 42 return osTimerStart(_timer_id, millisec);
leo44 0:d984976f1f1c 43 }
leo44 0:d984976f1f1c 44
leo44 0:d984976f1f1c 45 osStatus RtosTimer::stop(void) {
leo44 0:d984976f1f1c 46 return osTimerStop(_timer_id);
leo44 0:d984976f1f1c 47 }
leo44 0:d984976f1f1c 48
leo44 0:d984976f1f1c 49 RtosTimer::~RtosTimer() {
leo44 0:d984976f1f1c 50 osTimerDelete(_timer_id);
leo44 0:d984976f1f1c 51 }
leo44 0:d984976f1f1c 52
leo44 0:d984976f1f1c 53 }