mirror of
https://github.com/apache/nuttx.git
synced 2026-05-13 10:38:40 +08:00
drivers/lcd: Add support to use APA102 LED Matrix as LCD Display
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
463f321316
commit
b3daaf765b
@@ -100,6 +100,30 @@ config LCD_MAXPOWER
|
||||
|
||||
comment "Graphic LCD Devices"
|
||||
|
||||
config LCD_APA102
|
||||
bool "APA102 RGB LED MATRIX as LCD"
|
||||
depends on SPI
|
||||
default n
|
||||
|
||||
if LCD_APA102
|
||||
config LCD_APA102_XRES
|
||||
int "APA102 X Resolution"
|
||||
default 16
|
||||
---help---
|
||||
Specifies the X resolution of the LCD.
|
||||
|
||||
config LCD_APA102_YRES
|
||||
int "APA102 Y Resolution"
|
||||
default 16
|
||||
---help---
|
||||
Specifies the Y resolution of the LCD.
|
||||
|
||||
config LCD_APA102_FREQUENCY
|
||||
int "SPI Frequency"
|
||||
default 1000000
|
||||
|
||||
endif # LCD_APA102
|
||||
|
||||
config LCD_P14201
|
||||
bool "Rit P1402 series display"
|
||||
default n
|
||||
|
||||
@@ -45,6 +45,10 @@ ifeq ($(CONFIG_LCD_LPM013M091A),y)
|
||||
CSRCS += lpm013m091a.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_APA102),y)
|
||||
CSRCS += apa102.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_P14201),y)
|
||||
CSRCS += p14201.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/lcd/apa102.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_LCD_APA102_H
|
||||
#define __INCLUDE_NUTTX_LCD_APA102_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
/* Configuration
|
||||
* CONFIG_SPI - Enables support for SPI drivers
|
||||
* CONFIG_LCD_APA102 - Enables support for the APA102 driver
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_LCD_APA102)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Some important "colors" */
|
||||
|
||||
#define APA102_BLACK 0
|
||||
#define APA102_WHITE 1
|
||||
|
||||
/* Only two power settings are supported: */
|
||||
|
||||
#define APA102_POWER_OFF 0
|
||||
#define APA102_POWER_ON 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: apa102_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the APA102 device as a LCD interface.
|
||||
*
|
||||
* Input Parameters:
|
||||
* spi - An instance of the SPI interface to use to communicate
|
||||
* with the APA102.
|
||||
* devno - Device number to identify current display.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct lcd_dev_s *apa102_initialize(FAR struct spi_dev_s *spi,
|
||||
unsigned int devno);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_APA102 */
|
||||
#endif /* __INCLUDE_NUTTX_LCD_APA102_H */
|
||||
@@ -32,8 +32,6 @@
|
||||
* CONFIG_LEDS_APA102 - Enables support for the APA102 driver
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_LEDS_APA102)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -95,5 +93,4 @@ int apa102_register(FAR const char *devpath, FAR struct spi_dev_s *spi);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SPI && CONFIG_LEDS_APA102 */
|
||||
#endif /* __INCLUDE_NUTTX_LEDS_APA102_H */
|
||||
|
||||
Reference in New Issue
Block a user