RTEMS 6.1-rc4
Loading...
Searching...
No Matches
fsl_kpp.h
1/*
2 * Copyright 2017, 2019 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7#ifndef _FSL_KPP_H_
8#define _FSL_KPP_H_
9
10#include "fsl_common.h"
11
17/*******************************************************************************
18 * Definitions
19 ******************************************************************************/
20
24#define FSL_KPP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
27#define KPP_KEYPAD_COLUMNNUM_MAX (8U)
28#define KPP_KEYPAD_ROWNUM_MAX (8U)
29
36{
37 kKPP_keyDepressInterrupt = KPP_KPSR_KDIE_MASK,
38 kKPP_keyReleaseInterrupt = KPP_KPSR_KRIE_MASK
40
43{
44 kKPP_ClearKeyDepressSyncChain = KPP_KPSR_KDSC_MASK,
45 kKPP_SetKeyReleasesSyncChain = KPP_KPSR_KRSS_MASK,
47
49typedef struct _kpp_config
50{
51 uint8_t activeRow;
52 uint8_t activeColumn;
53 uint16_t interrupt;
55
56/*******************************************************************************
57 * API
58 ******************************************************************************/
59
60#if defined(__cplusplus)
61extern "C" {
62#endif
63
77void KPP_Init(KPP_Type *base, kpp_config_t *configure);
78
86void KPP_Deinit(KPP_Type *base);
87
88/* @} */
89
102static inline void KPP_EnableInterrupts(KPP_Type *base, uint16_t mask)
103{
104 uint16_t data = (uint16_t)(base->KPSR & ~(KPP_KPSR_KPKR_MASK | KPP_KPSR_KPKD_MASK));
105 base->KPSR = data | mask;
106}
107
115static inline void KPP_DisableInterrupts(KPP_Type *base, uint16_t mask)
116{
117 base->KPSR &= ~(mask | KPP_KPSR_KPKR_MASK | KPP_KPSR_KPKD_MASK);
118}
119
127static inline uint16_t KPP_GetStatusFlag(KPP_Type *base)
128{
129 return (base->KPSR & (KPP_KPSR_KPKR_MASK | KPP_KPSR_KPKD_MASK)) << KPP_KPSR_KDIE_SHIFT;
130}
131
139static inline void KPP_ClearStatusFlag(KPP_Type *base, uint16_t mask)
140{
141 base->KPSR |= (uint16_t)((mask) >> KPP_KPSR_KDIE_SHIFT);
142}
143
151static inline void KPP_SetSynchronizeChain(KPP_Type *base, uint16_t mask)
152{
153 uint16_t data = base->KPSR & (KPP_KPSR_KRSS_MASK | KPP_KPSR_KDSC_MASK | KPP_KPSR_KRIE_MASK | KPP_KPSR_KDIE_MASK);
154 base->KPSR = data | mask;
155}
156
170void KPP_keyPressScanning(KPP_Type *base, uint8_t *data, uint32_t clockSrc_Hz);
171
172/* @} */
173
174#if defined(__cplusplus)
175}
176#endif
177
180#endif /* _FSL_KPP_H_*/
struct _kpp_config kpp_config_t
Lists of KPP status.
enum _kpp_sync_operation kpp_sync_operation_t
Lists of KPP synchronize chain operation.
uint8_t activeRow
Definition: fsl_kpp.h:51
void KPP_keyPressScanning(KPP_Type *base, uint8_t *data, uint32_t clockSrc_Hz)
Keypad press scanning.
Definition: fsl_kpp.c:138
void KPP_Init(KPP_Type *base, kpp_config_t *configure)
KPP initialize. This function ungates the KPP clock and initializes KPP. This function must be called...
Definition: fsl_kpp.c:74
_kpp_interrupt_enable
List of interrupts supported by the peripheral. This enumeration uses one-bot encoding to allow a log...
Definition: fsl_kpp.h:36
void KPP_Deinit(KPP_Type *base)
Deinitializes the KPP module and gates the clock. This function gates the KPP clock....
Definition: fsl_kpp.c:113
enum _kpp_interrupt_enable kpp_interrupt_enable_t
List of interrupts supported by the peripheral. This enumeration uses one-bot encoding to allow a log...
uint16_t interrupt
Definition: fsl_kpp.h:53
uint8_t activeColumn
Definition: fsl_kpp.h:52
_kpp_sync_operation
Lists of KPP synchronize chain operation.
Definition: fsl_kpp.h:43
@ kKPP_keyReleaseInterrupt
Definition: fsl_kpp.h:38
@ kKPP_keyDepressInterrupt
Definition: fsl_kpp.h:37
@ kKPP_SetKeyReleasesSyncChain
Definition: fsl_kpp.h:45
@ kKPP_ClearKeyDepressSyncChain
Definition: fsl_kpp.h:44
Definition: MIMXRT1052.h:27207
Lists of KPP status.
Definition: fsl_kpp.h:50