drivers/video/max7456.c: Support for the Maxim MAX7456 on-screen-display chip.

This commit is contained in:
Bill Gatliff 2019-03-24 06:49:34 -06:00 committed by Gregory Nutt
parent 75858219fb
commit 38f2346bdb
5 changed files with 1739 additions and 0 deletions

View file

@ -22,6 +22,14 @@ config FB_OVERLAY_BLIT
depends on FB_OVERLAY
default n
config VIDEO_MAX7456
bool "Maxim 7456 Monochrome OSD"
default n
select SPI
---help---
Support for the Maxim 7456 monochrome on-screen display
multiplexer.
config VIDEO_OV2640
bool "OV2640 camera chip"
default n

View file

@ -51,6 +51,16 @@ endif
endif
# These video drivers depend on SPI support
ifeq ($(CONFIG_SPI),y)
ifeq ($(CONFIG_VIDEO_MAX7456),y)
CSRCS += max7456.c
endif
endif
# Include video driver build support
DEPPATH += --dep-path video

View file

@ -0,0 +1,65 @@
drivers/video/README.max7456
23 March 2019
Bill Gatliff <bgat@billgatliff.com>
The code in max7456.[ch] is a preliminary device driver for the MAX7456 analog
on-screen-display generator. This SPI slave chip is a popular feature in many
embedded devices due its low cost and power requirements. In particular, you
see it a lot on drone flight-management units.
I use the term "preliminary" because at present, only the most rudimentary
capabilities of the chip are supported:
* chip reset and startup
* read and write low-level chip control registers (DEBUG mode only)
* write CA (Character Address) data to the chip's framebuffer memory
Some key missing features are, in no particular order:
* VSYNC and HSYNC synchronization (prevents flicker)
* ability to update NVM (define custom character sets)
If you have a factory-fresh chip, then the datasheet shows you what the factory
character data set looks like. If you've used the chip in other scenarios,
i.e. with Betaflight or similar, then your chip will almost certainly have had
the factory character data replaced with something application-specific.
Either way, you'll probably want to update your character set before long. I
should probably get that working, unless you want to take a look at it
yoruself...
The max7456_register() function starts things rolling. The omnibusf4 target
device provides an example (there may be others by the time you read this).
In normal use, the driver creates a set of interfaces under /dev, i.e.:
/dev/osd0/fb
/dev/osd0/raw (*)
/dev/osd0/vsync (*)
* - not yet implemented
By writing character data to the "fb" interface, you'll see data appear on the
display. NOTE that the data you write is NOT, for example, ASCII text: it is
the addresses of the characters in the chip's onboard character map.
For example, if entry 42 in your onboard character map is a bitmap that looks
like "H", then when you write the ASCII "*" (decimal 42, hex 2a), you'll see
that "H" appear on your screen.
If you build the code with the DEBUG macro defined, you will see a bunch more interfaces:
/dev/osd0/VM0
/dev/osd0/VM1
/dev/osd/DMM
...
...
These are interfaces to the low-level chip registers, which can be read and/or
written to help you figure out what's going on inside the chip. They're
probably more useful for me than you, but there they are in case I'm wrong
about that.
b.g.

1575
drivers/video/max7456.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,81 @@
/****************************************************************************
* include/nuttx/video/max7456.h
*
* Support for the Maxim MAX7456 Single-Channel Monochrome On-Screen
* Display with Integrated EEPROM (datasheet 19-0576; Rev 1; 8/08).
*
* Copyright (C) 2019 Bill Gatliff. All rights reserved.
* Author: Bill Gatliff <bgat@billgatliff.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_MAX7456_H
#define __INCLUDE_NUTTX_VIDEO_MAX7456_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Data
****************************************************************************/
struct spi_dev_s;
struct mx7_config_s
{
int spi_devid;
FAR struct spi_dev_s *spi;
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: max7456_register
*
* Description:
* Registers an max7456 chip, and creates an interface 'devpath'
*
* Input Parameters:
* path - The full path to the interface to register. E.g., "/dev/osd0"
* config - Configuration information
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int max7456_register(FAR const char *path, FAR struct mx7_config_s *config);
#endif /*__INCLUDE_NUTTX_VIDEO_MAX7456_H */