Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
fhss_configuration_interface.c
00001 /* 00002 * Copyright (c) 2016-2017, Arm Limited and affiliates. 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 "nsconfig.h" 00018 #include <string.h> 00019 #include "ns_types.h" 00020 #include "fhss_api.h " 00021 #include "fhss_config.h " 00022 #include "net_fhss.h" 00023 #include "nsdynmemLIB.h" 00024 #include "Service_Libs/fhss/fhss.h" 00025 #include "Service_Libs/fhss/fhss_mac_interface.h" 00026 #include "ns_trace.h" 00027 00028 #define TRACE_GROUP "fhss" 00029 00030 00031 fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics) 00032 { 00033 fhss_api_t *this = ns_dyn_mem_alloc(sizeof(fhss_api_t)); 00034 if (!this) { 00035 return NULL; 00036 } 00037 // Create FHSS object 00038 int8_t retval = fhss_enable(this, fhss_configuration, fhss_timer, fhss_statistics); 00039 if (retval) { 00040 tr_err("Failed to enable FHSS, return code: %i", retval); 00041 ns_dyn_mem_free(this); 00042 return NULL; 00043 } 00044 this->is_broadcast_channel = &fhss_is_broadcast_channel_cb; 00045 this->use_broadcast_queue = &fhss_use_broadcast_queue_cb; 00046 this->tx_handle = &fhss_tx_handle_cb; 00047 this->check_tx_conditions = &fhss_check_tx_conditions_cb; 00048 this->receive_frame = &fhss_receive_frame_cb; 00049 this->data_tx_done = &fhss_data_tx_done_cb; 00050 this->data_tx_fail = &fhss_data_tx_fail_cb; 00051 this->synch_state_set = &fhss_synch_state_set_cb; 00052 this->read_timestamp = &fhss_read_timestamp_cb; 00053 this->get_retry_period = &fhss_get_retry_period_cb; 00054 this->init_callbacks = &fhss_init_callbacks_cb; 00055 return this; 00056 } 00057 00058 int ns_fhss_delete(fhss_api_t *fhss_api) 00059 { 00060 fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); 00061 if (!fhss_structure) { 00062 return -1; 00063 } 00064 if (fhss_disable(fhss_structure)) { 00065 return -1; 00066 } 00067 ns_dyn_mem_free(fhss_api); 00068 fhss_api = NULL; 00069 return 0; 00070 } 00071 00072 int ns_fhss_configuration_set(fhss_api_t *fhss_api, const fhss_synch_configuration_t *fhss_synch_configuration) 00073 { 00074 fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); 00075 if (!fhss_structure) { 00076 return -1; 00077 } 00078 return fhss_set_synch_configuration(fhss_structure, fhss_synch_configuration); 00079 }
Generated on Fri Jul 22 2022 04:53:48 by
 1.7.2
 1.7.2 
    