taler-xotp_fw

xOTP generator firmware
Log | Files | Refs | Submodules | README

displayInterface.c (2295B)


      1 /**
      2  * @file displayInterface.c
      3  * @author Adrian STEINER (steia19@bfh.ch)
      4  * @brief Display interface to show the menu content on it
      5  * @version 0.1
      6  * @date 17-02-2025
      7  *
      8  * @copyright (C) 2025 Adrian STEINER
      9  * This program is free software: you can redistribute it and/or modify
     10  * it under the terms of the GNU General Public License as published by
     11  * the Free Software Foundation, either version 3 of the License, or
     12  * (at your option) any later version.
     13  *
     14  * This program is distributed in the hope that it will be useful,
     15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  * GNU General Public License for more details.
     18  *
     19  * You should have received a copy of the GNU General Public License
     20  * along with this program.  If not, see <https: //www.gnu.org/licenses/>.
     21  *
     22  */
     23 
     24 #include "displayInterface.h"
     25 #include <stdlib.h>
     26 
     27 uint8_t display_initInterface(displayInterface *interfaceHandler,
     28                               pbm_image *displayImage,
     29                               pbm_font *smallFont,
     30                               pbm_font *bigFont,
     31                               displayPwrCB powerOnCB,
     32                               displayPwrCB powerOffCB,
     33                               displayShowCB showCB,
     34                               uint8_t chargeSymbolIndex,
     35                               uint8_t synchronizeSymbolIndex,
     36                               uint8_t batteryStartIndex,
     37                               pbm_colors theme)
     38 {
     39 
     40   if (NULL == interfaceHandler || NULL == displayImage || NULL == smallFont ||
     41       NULL == bigFont || NULL == powerOnCB || NULL == powerOffCB ||
     42       NULL == showCB) {
     43     return EXIT_FAILURE;
     44   }
     45   /* Image references */
     46   interfaceHandler->image = displayImage;
     47   interfaceHandler->dispFontSmall = smallFont;
     48   interfaceHandler->dispFontBig = bigFont;
     49   /* Callbacks */
     50   interfaceHandler->powerOn = powerOnCB;
     51   interfaceHandler->powerOff = powerOffCB;
     52   interfaceHandler->show = showCB;
     53   /* Symbol indexes */
     54   interfaceHandler->symbolCharge = chargeSymbolIndex;
     55   interfaceHandler->symbolSynchronize = synchronizeSymbolIndex;
     56   interfaceHandler->symbolBatteryStart = batteryStartIndex;
     57   /* Theme */
     58   interfaceHandler->theme = theme;
     59   return EXIT_SUCCESS;
     60 }