16#ifndef ZEPHYR_INCLUDE_DRIVERS_KB_SCAN_H_
17#define ZEPHYR_INCLUDE_DRIVERS_KB_SCAN_H_
60typedef int (*kscan_config_t)(
const struct device *dev,
62typedef int (*kscan_disable_callback_t)(
const struct device *dev);
63typedef int (*kscan_enable_callback_t)(
const struct device *dev);
65__subsystem
struct kscan_driver_api {
66 kscan_config_t config;
67 kscan_disable_callback_t disable_callback;
68 kscan_enable_callback_t enable_callback;
88static inline int z_impl_kscan_config(
const struct device *dev,
91 const struct kscan_driver_api *api =
92 (
struct kscan_driver_api *)dev->
api;
94 return api->config(dev, callback);
106static inline int z_impl_kscan_enable_callback(
const struct device *dev)
108 const struct kscan_driver_api *api =
109 (
const struct kscan_driver_api *)dev->
api;
111 if (api->enable_callback == NULL) {
115 return api->enable_callback(dev);
128static inline int z_impl_kscan_disable_callback(
const struct device *dev)
130 const struct kscan_driver_api *api =
131 (
const struct kscan_driver_api *)dev->
api;
133 if (api->disable_callback == NULL) {
137 return api->disable_callback(dev);
148#include <zephyr/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:48
#define ENOSYS
Function not implemented.
Definition errno.h:82
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition device.h:412
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:418