/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2022. All rights reserved. * Description: virtualkeypad input gpio interface * Author: App-Dev Group * Create: 2020-06-15 */ #include "GpioInterface.h" #include "uapi_gpio.h" #include "uapi_version.h" using namespace android; inline int GPIO_NUM(int group, int bit) { // 8 means 8 gpios return (group * 8) + bit; } td_s32 GpioInterface::GpioInit() const { #if (UAPI_VERSION_CODE == UAPI_VERSION(1, 0)) return uapi_gpio_init(); #endif } td_s32 GpioInterface::GpioDeinit() const { #if (UAPI_VERSION_CODE == UAPI_VERSION(1, 0)) return uapi_gpio_deinit(); #endif } td_s32 GpioInterface::GpioSetDirection(td_u32 groupNumber, td_u32 bitNumber, td_bool input) const { #if (UAPI_VERSION_CODE == UAPI_VERSION(1, 0)) return uapi_gpio_set_direction(groupNumber, bitNumber, input); #endif } td_s32 GpioInterface::GpioRead(td_u32 groupNumber, td_u32 bitNumber, td_bool& highVolt) const { #if (UAPI_VERSION_CODE == UAPI_VERSION(1, 0)) return uapi_gpio_read(groupNumber, bitNumber, &highVolt); #endif }