1
0
Fork 0
forked from nuttx/nuttx-update

input: Q10 BlackBerry Keyboard from Solder Party

This adds support for the Q10 BlackBerry based keyboard
from Solder Party. https://www.solder.party/docs/keyboard-pmod/

They keyboard device registered at /dev/kbdN is fully compatible
with hidkbd and has been testing with the Keyboard FeatherWing
on the nRF52 platform.

The buttons are added as a standard discrete joystick if
optionally enabled.  The PMOD variant of this does not
include these buttons, but the Keyboard FeatherWing does.
This joystick is usually defined at /dev/djoyN and
can be used with the djoy example application.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
This commit is contained in:
Brennan Ashton 2020-09-20 02:37:33 -07:00 committed by patacongo
parent 366e8afdb1
commit 5498f72fa5
5 changed files with 1240 additions and 0 deletions

View file

@ -514,4 +514,36 @@ config NUNCHUCK_NPOLLWAITERS
endif # INPUT_NUNCHUCK
config INPUT_SPQ10KBD
bool "Solder Party Q10 BlackBerry Keyboard"
default n
select I2C
---help---
Enable the Solder Party Q10 BlackBerry Keyboard support. This
exposes itself as a standard keyboard at /dev/kbdN.
This keyboard exists both as a standalone module and integrated
into the Solder Party Keyboard FeatherWing. Information on this
can be found at https://www.solder.party/docs/keyboard-pmod/
if INPUT_SPQ10KBD
config SPQ10KBD_DJOY
bool "Joystick Interface for Buttons"
select DJOYSTICK
default n
config SPQ10KBD_REGDBG
bool "Keyboard Register Debug"
default n
config SPQ10KBD_BUFSIZE
int "Keyboard Buffer Size"
default 10
config SPQ10KBD_NPOLLWAITERS
int "Max Number of Poll Waiters"
default 2
endif # INPUT_SPQ10KBD
endif # INPUT

View file

@ -99,6 +99,10 @@ ifeq ($(CONFIG_INPUT_NUNCHUCK),y)
CSRCS += nunchuck.c
endif
ifeq ($(CONFIG_INPUT_SPQ10KBD),y)
CSRCS += spq10kbd.c
endif
# Include input device driver build support
DEPPATH += --dep-path input

1074
drivers/input/spq10kbd.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -235,6 +235,12 @@ struct djoy_lowerhalf_s
CODE void (*dl_enable)(FAR const struct djoy_lowerhalf_s *lower,
djoy_buttonset_t press, djoy_buttonset_t release,
djoy_interrupt_t handler, FAR void *arg);
/* Allow for storing implementation specific data to support cases where
* their may be more than one joystick
*/
FAR void *config;
};
/****************************************************************************

View file

@ -0,0 +1,124 @@
/****************************************************************************
* include/nuttx/input/spq10kbd.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The q10 keyboard driver exports a standard character driver interface. By
* convention, the keyboard driver is exposed as /dev/kbd[n] device driver
* path.
*/
#ifndef __INCLUDE_NUTTX_INPUT_SPQ10KBD_H
#define __INCLUDE_NUTTX_INPUT_SPQ10KBD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/i2c/i2c_master.h>
#include <stdbool.h>
#include <nuttx/irq.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* A reference to a structure of this type must be passed to the
* Solder Party Q10 Keyboard driver. This structure provides information
* about the configuration and provides some board-specific hooks.
*/
struct spq10kbd_config_s
{
/* Device characterization */
uint32_t frequency; /* I2C frequency */
uint8_t address; /* I2C 7-bit device address */
/* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the Q10 Keyboard driver from differences in GPIO
* interrupt handling by varying boards and MCUs.
*
* attach - Attach the Q10 kbd interrupt handler to the GPIO interrupt
* enable - Enable or disable the GPIO interrupt
* clear - Acknowledge/clear any pending GPIO interrupt
*/
int (*attach)(FAR const struct spq10kbd_config_s *state, xcpt_t isr,
FAR void *arg);
void (*enable)(FAR const struct spq10kbd_config_s *state, bool enable);
void (*clear)(FAR const struct spq10kbd_config_s *state);
};
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: spq10kbd_register
*
* Description:
* Configure the Solder Party Q10 Keyboard to use the provided I2C device
* instance. This will register the driver as /dev/kbdN where N is the
* minor device number, as well as a joystick at joydevname
*
* Input Parameters:
* i2c - An I2C driver instance
* config - Persistent board configuration data
* kbdminor - The keyboard input device minor number
* joydevname - The name of the joystick device /dev/djoyN
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_SPQ10KBD_DJOY
int spq10kbd_register(FAR struct i2c_master_s *i2c,
FAR const struct spq10kbd_config_s *config,
char kbdminor, char *joydevname);
#else
int spq10kbd_register(FAR struct i2c_master_s *i2c,
FAR const struct spq10kbd_config_s *config,
char kbdminor);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_INPUT_SPQ10KBD_H */