deviceInterface.c (1536B)
1 /** 2 * @file deviceInterface.c 3 * @author Adrian STEINER (steia19@bfh.ch) 4 * @brief device interface to get the current tick to poll events and to 5 * shutdown the device The tick is used to poll in a desired frequency and the 6 * shutdown is needed to move the device in a low energy part. All components 7 * are set to power off before calling this function. 8 * @version 0.1 9 * @date 17-02-2025 10 * 11 * @copyright (C) 2025 Adrian STEINER 12 * This program is free software: you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation, either version 3 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program. If not, see <https: //www.gnu.org/licenses/>. 24 * 25 */ 26 27 #include "deviceInterface.h" 28 #include <stdlib.h> 29 30 uint8_t device_initInterface(deviceInterface *interfaceHandler, 31 deviceGetTickCB getTickCB, 32 deviceShutdownCB shutdownCB) 33 { 34 if (NULL == interfaceHandler || NULL == getTickCB || NULL == shutdownCB) { 35 return EXIT_FAILURE; 36 } 37 interfaceHandler->getTick = getTickCB; 38 interfaceHandler->shutdown = shutdownCB; 39 return EXIT_SUCCESS; 40 }