16#ifndef ZEPHYR_INCLUDE_DRIVERS_KB_SCAN_H_
17#define ZEPHYR_INCLUDE_DRIVERS_KB_SCAN_H_
57typedef int (*kscan_config_t)(
const struct device *dev,
59typedef int (*kscan_disable_callback_t)(
const struct device *dev);
60typedef int (*kscan_enable_callback_t)(
const struct device *dev);
62__subsystem
struct kscan_driver_api {
63 kscan_config_t config;
64 kscan_disable_callback_t disable_callback;
65 kscan_enable_callback_t enable_callback;
84static inline int z_impl_kscan_config(
const struct device *dev,
87 const struct kscan_driver_api *api =
88 (
struct kscan_driver_api *)dev->
api;
90 return api->config(dev, callback);
101static inline int z_impl_kscan_enable_callback(
const struct device *dev)
103 const struct kscan_driver_api *api =
104 (
const struct kscan_driver_api *)dev->
api;
106 if (api->enable_callback == NULL) {
110 return api->enable_callback(dev);
122static inline int z_impl_kscan_disable_callback(
const struct device *dev)
124 const struct kscan_driver_api *api =
125 (
const struct kscan_driver_api *)dev->
api;
127 if (api->disable_callback == NULL) {
131 return api->disable_callback(dev);
142#include <syscalls/kscan.h>
int kscan_disable_callback(const struct device *dev)
Disables callback.
int kscan_config(const struct device *dev, kscan_callback_t callback)
Configure a Keyboard scan instance.
int kscan_enable_callback(const struct device *dev)
Enables callback.
void(* kscan_callback_t)(const struct device *dev, uint32_t row, uint32_t column, bool pressed)
Keyboard scan callback called when user press/release a key on a matrix keyboard.
Definition: kscan.h:46
#define ENOSYS
Function not implemented.
Definition: errno.h:83
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:405