SAMA5: Integrate touchscreen and ADC drivers into the build
This commit is contained in:
parent
55b39463ec
commit
4563ef16b5
@ -42,6 +42,14 @@ config SAMA5_NOR_START
|
|||||||
option: If SAMA5_NOR_START is defined, then it will not wait but
|
option: If SAMA5_NOR_START is defined, then it will not wait but
|
||||||
will, instead, immediately start the program in NOR FLASH.
|
will, instead, immediately start the program in NOR FLASH.
|
||||||
|
|
||||||
|
config SAMA5_TSD_DEVMINOR
|
||||||
|
int "Touchscreen device minor"
|
||||||
|
default 0
|
||||||
|
depends on SAMA5_TSD
|
||||||
|
---help---
|
||||||
|
This touchscreen will be register as /dev/inputN where the value of
|
||||||
|
N is provided by this configuration setting.
|
||||||
|
|
||||||
config SAMA5_AT25_AUTOMOUNT
|
config SAMA5_AT25_AUTOMOUNT
|
||||||
bool "AT25 serial FLASH auto-mount"
|
bool "AT25 serial FLASH auto-mount"
|
||||||
default n
|
default n
|
||||||
|
@ -1836,7 +1836,7 @@ Configurations
|
|||||||
nsh> cat /mnt/at24/atest.txt
|
nsh> cat /mnt/at24/atest.txt
|
||||||
This is a test
|
This is a test
|
||||||
|
|
||||||
13. I2C Tool. NuttX supports an I2C tool at apps/system/i2c that can be
|
14. I2C Tool. NuttX supports an I2C tool at apps/system/i2c that can be
|
||||||
used to peek and poke I2C devices. That tool cal be enabled by
|
used to peek and poke I2C devices. That tool cal be enabled by
|
||||||
setting the following:
|
setting the following:
|
||||||
|
|
||||||
@ -1910,7 +1910,7 @@ Configurations
|
|||||||
Address 0x1a is the WM8904. Address 0x39 is the SIL9022A. I am
|
Address 0x1a is the WM8904. Address 0x39 is the SIL9022A. I am
|
||||||
not sure what is at address 0x3d and 0x60
|
not sure what is at address 0x3d and 0x60
|
||||||
|
|
||||||
14. Networking support via the can be added to NSH be selecting the
|
15. Networking support via the can be added to NSH be selecting the
|
||||||
following configuration options. The SAMA5D3x supports two different
|
following configuration options. The SAMA5D3x supports two different
|
||||||
Ethernet MAC peripherals: (1) The 10/100Base-T EMAC peripheral and
|
Ethernet MAC peripherals: (1) The 10/100Base-T EMAC peripheral and
|
||||||
and (2) the 10/100/1000Base-T GMAC peripheral. Only the SAMA5D31
|
and (2) the 10/100/1000Base-T GMAC peripheral. Only the SAMA5D31
|
||||||
@ -2083,7 +2083,38 @@ Configurations
|
|||||||
This delay will be especially long if the board is not connected to
|
This delay will be especially long if the board is not connected to
|
||||||
a network.
|
a network.
|
||||||
|
|
||||||
|
16. You can enable the touchscreen by modifying the configuration
|
||||||
|
in the following ways:
|
||||||
|
|
||||||
|
System Type:
|
||||||
|
CONFIG_SAMA5_ADC=y : ADC support is required
|
||||||
|
CONFIG_SAMA5_TSD=y : Enabled touchcreen device support
|
||||||
|
SAMA5_TSD_4WIRE=y : 4-Wire interface with pressure
|
||||||
|
|
||||||
|
You might want to tinker with the SWAPXY and THRESHX and THRESHY
|
||||||
|
settings to get the result that you want.
|
||||||
|
|
||||||
|
Drivers:
|
||||||
|
CONFIG_INPUT=y : (automatically selected)
|
||||||
|
|
||||||
|
Board Selection:
|
||||||
|
CONFIG_SAMA5_TSD_DEVMINOR=0 : Register as /dev/input0
|
||||||
|
|
||||||
|
Library Support:
|
||||||
|
CONFIG_SCHED_WORKQUEUE=y : Work queue support required
|
||||||
|
|
||||||
|
These options may also be applied to enable a built-in touchscreen
|
||||||
|
test application:
|
||||||
|
|
||||||
|
Applicaton Configuration:
|
||||||
|
CONFIG_EXAMPLES_TOUCHSCREEN=y : Enable the touchscreen built-int test
|
||||||
|
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 : To match the board selection
|
||||||
|
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
|
||||||
|
|
||||||
|
Defaults should be okay for all related settings.
|
||||||
|
|
||||||
STATUS:
|
STATUS:
|
||||||
|
|
||||||
PCK FREQUENCY
|
PCK FREQUENCY
|
||||||
2013-7-19: This configuration (as do the others) run at 396MHz.
|
2013-7-19: This configuration (as do the others) run at 396MHz.
|
||||||
The SAMA5D3 can run at 536MHz. I still need to figure out the
|
The SAMA5D3 can run at 536MHz. I still need to figure out the
|
||||||
|
@ -43,6 +43,7 @@ CONFIG_RAW_BINARY=y
|
|||||||
# Debug Options
|
# Debug Options
|
||||||
#
|
#
|
||||||
# CONFIG_DEBUG is not set
|
# CONFIG_DEBUG is not set
|
||||||
|
CONFIG_ARCH_HAVE_STACKCHECK=y
|
||||||
# CONFIG_DEBUG_SYMBOLS is not set
|
# CONFIG_DEBUG_SYMBOLS is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -503,7 +504,6 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
#
|
#
|
||||||
# CONFIG_EXAMPLES_BUTTONS is not set
|
# CONFIG_EXAMPLES_BUTTONS is not set
|
||||||
# CONFIG_EXAMPLES_CAN is not set
|
# CONFIG_EXAMPLES_CAN is not set
|
||||||
# CONFIG_SYSTEM_COMPOSITE is not set
|
|
||||||
# CONFIG_EXAMPLES_CXXTEST is not set
|
# CONFIG_EXAMPLES_CXXTEST is not set
|
||||||
# CONFIG_EXAMPLES_DHCPD is not set
|
# CONFIG_EXAMPLES_DHCPD is not set
|
||||||
# CONFIG_EXAMPLES_ELF is not set
|
# CONFIG_EXAMPLES_ELF is not set
|
||||||
@ -551,7 +551,6 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
|||||||
# CONFIG_EXAMPLES_UDP is not set
|
# CONFIG_EXAMPLES_UDP is not set
|
||||||
# CONFIG_EXAMPLES_UIP is not set
|
# CONFIG_EXAMPLES_UIP is not set
|
||||||
# CONFIG_EXAMPLES_USBSERIAL is not set
|
# CONFIG_EXAMPLES_USBSERIAL is not set
|
||||||
# CONFIG_SYSTEM_USBMSC is not set
|
|
||||||
# CONFIG_EXAMPLES_USBTERM is not set
|
# CONFIG_EXAMPLES_USBTERM is not set
|
||||||
# CONFIG_EXAMPLES_WATCHDOG is not set
|
# CONFIG_EXAMPLES_WATCHDOG is not set
|
||||||
|
|
||||||
@ -669,6 +668,14 @@ CONFIG_NSH_CONSOLE=y
|
|||||||
# System NSH Add-Ons
|
# System NSH Add-Ons
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# USB CDC/ACM Device Commands
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# USB Composite Device Commands
|
||||||
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom Free Memory Command
|
# Custom Free Memory Command
|
||||||
#
|
#
|
||||||
@ -722,6 +729,14 @@ CONFIG_READLINE_ECHO=y
|
|||||||
# USB Monitor
|
# USB Monitor
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Stack Monitor
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# USB Mass Storage Device Commands
|
||||||
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Zmodem Commands
|
# Zmodem Commands
|
||||||
#
|
#
|
||||||
|
@ -114,6 +114,10 @@ ifeq ($(CONFIG_ARCH_FPU),y)
|
|||||||
CSRCS += sam_ostest.c
|
CSRCS += sam_ostest.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SAMA5_TSD),y)
|
||||||
|
CSRCS += sam_touchscreen.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
CSRCS += sam_autoleds.c
|
CSRCS += sam_autoleds.c
|
||||||
else
|
else
|
||||||
|
163
configs/sama5d3x-ek/src/sam_touchscreen.c
Normal file
163
configs/sama5d3x-ek/src/sam_touchscreen.c
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/sama5d3-ek/src/sam_touchscreen.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include "sam_adc.h"
|
||||||
|
#include "sam_tsd.h"
|
||||||
|
#include "sama5d3x-ek.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMA5_TSD
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_INPUT
|
||||||
|
# error "Touchscreen support requires CONFIG_INPUT"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SAMA5_TSD_DEVMINOR
|
||||||
|
# define CONFIG_SAMA5_TSD_DEVMINOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arch_tcinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Each board that supports a touchscreen device must provide this
|
||||||
|
* function. This function is called by application-specific, setup logic
|
||||||
|
* to configure the touchscreen device. This function will register the
|
||||||
|
* driver as /dev/inputN where N is the minor device number.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* minor - The input device minor number
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero is returned on success. Otherwise, a negated errno value is
|
||||||
|
* returned to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int arch_tcinitialize(int minor)
|
||||||
|
{
|
||||||
|
struct sam_adc_s *adc;
|
||||||
|
static bool initialized = false;
|
||||||
|
FAR struct spi_dev_s *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
idbg("initialized:%d minor:%d\n", initialized, minor);
|
||||||
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
|
/* Since there is no uninitialized logic, this initialization can be
|
||||||
|
* performed only one time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
/* Initialize the ADC driver */
|
||||||
|
|
||||||
|
adc = sam_adcinitialize();
|
||||||
|
if (!adc)
|
||||||
|
{
|
||||||
|
idbg("ERROR: Failed to initialize the ADC driver\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize and register the SPI touchscreen device */
|
||||||
|
|
||||||
|
ret = sam_tsd_register(adc, CONFIG_SAMA5_TSD_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
idbg("ERROR: Failed to register touchscreen device /dev/input%d: %d\n",
|
||||||
|
CONFIG_SAMA5_TSD_DEVMINOR, ret);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arch_tcuninitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Each board that supports a touchscreen device must provide this function.
|
||||||
|
* This function is called by application-specific, setup logic to
|
||||||
|
* uninitialize the touchscreen device.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void arch_tcuninitialize(void)
|
||||||
|
{
|
||||||
|
/* No support for un-initializing the touchscreen yet */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_INPUT_ADS7843E */
|
Loading…
x
Reference in New Issue
Block a user