mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
mbed_us_ticker_api.c
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2015 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #include "hal/us_ticker_api.h" 00018 00019 static ticker_event_queue_t events = { 0 }; 00020 00021 static ticker_irq_handler_type irq_handler = ticker_irq_handler; 00022 00023 static const ticker_interface_t us_interface = { 00024 .init = us_ticker_init, 00025 .read = us_ticker_read, 00026 .disable_interrupt = us_ticker_disable_interrupt, 00027 .clear_interrupt = us_ticker_clear_interrupt, 00028 .set_interrupt = us_ticker_set_interrupt, 00029 .fire_interrupt = us_ticker_fire_interrupt, 00030 .get_info = us_ticker_get_info, 00031 .free = us_ticker_free, 00032 }; 00033 00034 static const ticker_data_t us_data = { 00035 .interface = &us_interface, 00036 .queue = &events 00037 }; 00038 00039 const ticker_data_t *get_us_ticker_data(void) 00040 { 00041 return &us_data; 00042 } 00043 00044 ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler) 00045 { 00046 ticker_irq_handler_type prev_irq_handler = irq_handler; 00047 00048 irq_handler = ticker_irq_handler; 00049 00050 return prev_irq_handler; 00051 } 00052 00053 void us_ticker_irq_handler(void) 00054 { 00055 if (irq_handler) { 00056 irq_handler(&us_data); 00057 } 00058 }
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2