You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.6 KiB
47 lines
1.6 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2022. All rights reserved.
|
|
* Description: virtualkeypad input
|
|
* Author: App-Dev Group
|
|
* Create: 2020-06-16
|
|
*/
|
|
|
|
#ifndef ANDROID_VIRTUALKEYPAD_H
|
|
#define ANDROID_VIRTUALKEYPAD_H
|
|
|
|
#include <ctime>
|
|
#include <vector>
|
|
#include "LsadcInterface.h"
|
|
#include "GpioPowerInterface.h"
|
|
|
|
namespace android {
|
|
class VirtualKeypad {
|
|
public:
|
|
VirtualKeypad(){}
|
|
~VirtualKeypad(){}
|
|
static const int maxKeypadCh = 4;
|
|
static const td_u32 invalidKey = 0x0;
|
|
// gpio keypad information
|
|
std::vector<KeyPars::KeyArry> boardKpd = {};
|
|
const std::unique_ptr<GpioPowerInterface> gpioPowerInterface = std::make_unique<GpioPowerInterface>();
|
|
const std::unique_ptr<LsadcInterface> lsadcInterface = std::make_unique<LsadcInterface>();
|
|
td_u32 channelMask = -1;
|
|
void ThreadProcess();
|
|
void InitLSADCConfig();
|
|
void ProcessKey(td_u32 key);
|
|
td_u32 MapKeyValue(int keyPadTabIdx, td_u32 origValue) const;
|
|
td_u32 GetKeyPadPowerValue(std::vector<td_u8>& powerKeyCode, td_u32 length) const;
|
|
private:
|
|
static const int maxChNum = 4;
|
|
static const int keyLevelMaxNum = 8;
|
|
static const int keyOffTime = 100; // key off time 100ms
|
|
static const int repeatHoldTime = 405;
|
|
static const int repeatInterval = 67;
|
|
const int channelIdMaxValue = 255;
|
|
void SetChannelMask(td_u32& u32ChannelMask);
|
|
int TimeAfter(const struct timeval& bef, const struct timeval& cur, unsigned int ms) const;
|
|
};
|
|
}
|
|
|
|
|
|
#endif // android_VirtualKeypad_H
|