-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards/arm/stm32/nucleo-f446re: added support for DAC driver
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
- Loading branch information
1 parent
00edeee
commit b83769f
Showing
6 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
# This file is autogenerated: PLEASE DO NOT EDIT IT. | ||
# | ||
# You can use "make menuconfig" to make any modifications to the installed .config file. | ||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your | ||
# modifications. | ||
# | ||
# CONFIG_ARCH_FPU is not set | ||
# CONFIG_NSH_ARGCAT is not set | ||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set | ||
# CONFIG_NSH_CMDPARMS is not set | ||
# CONFIG_NSH_DISABLE_IFCONFIG is not set | ||
# CONFIG_NSH_DISABLE_PS is not set | ||
# CONFIG_STM32_FLASH_PREFETCH is not set | ||
CONFIG_ANALOG=y | ||
CONFIG_ARCH="arm" | ||
CONFIG_ARCH_BOARD="nucleo-f446re" | ||
CONFIG_ARCH_BOARD_NUCLEO_F446RE=y | ||
CONFIG_ARCH_BUTTONS=y | ||
CONFIG_ARCH_CHIP="stm32" | ||
CONFIG_ARCH_CHIP_STM32=y | ||
CONFIG_ARCH_CHIP_STM32F446R=y | ||
CONFIG_ARCH_INTERRUPTSTACK=2048 | ||
CONFIG_ARCH_STACKDUMP=y | ||
CONFIG_BOARD_LATE_INITIALIZE=y | ||
CONFIG_BOARD_LOOPSPERMSEC=8499 | ||
CONFIG_BUILTIN=y | ||
CONFIG_DAC=y | ||
CONFIG_EXAMPLES_DAC=y | ||
CONFIG_HAVE_CXX=y | ||
CONFIG_HAVE_CXXINITIALIZE=y | ||
CONFIG_INTELHEX_BINARY=y | ||
CONFIG_MAX_TASKS=16 | ||
CONFIG_NSH_BUILTIN_APPS=y | ||
CONFIG_NSH_FILEIOSIZE=512 | ||
CONFIG_NSH_LINELEN=64 | ||
CONFIG_NSH_READLINE=y | ||
CONFIG_PREALLOC_TIMERS=4 | ||
CONFIG_RAM_SIZE=131072 | ||
CONFIG_RAM_START=0x20000000 | ||
CONFIG_RAW_BINARY=y | ||
CONFIG_RR_INTERVAL=200 | ||
CONFIG_SCHED_WAITPID=y | ||
CONFIG_SDCLONE_DISABLE=y | ||
CONFIG_SPI=y | ||
CONFIG_START_DAY=14 | ||
CONFIG_START_MONTH=10 | ||
CONFIG_START_YEAR=2014 | ||
CONFIG_STM32_CRC=y | ||
CONFIG_STM32_DAC1=y | ||
CONFIG_STM32_DAC1CH1=y | ||
CONFIG_STM32_JTAG_SW_ENABLE=y | ||
CONFIG_STM32_OTGFS=y | ||
CONFIG_STM32_PWR=y | ||
CONFIG_STM32_USART2=y | ||
CONFIG_SYSTEM_NSH=y | ||
CONFIG_TASK_NAME_SIZE=0 | ||
CONFIG_TESTING_OSTEST=y | ||
CONFIG_USART2_SERIAL_CONSOLE=y | ||
CONFIG_USER_ENTRYPOINT="nsh_main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/**************************************************************************** | ||
* boards/arm/stm32/nucleo-f446re/src/stm32_dac.c | ||
* | ||
* 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. | ||
* | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Included Files | ||
****************************************************************************/ | ||
|
||
#include <nuttx/config.h> | ||
#include <errno.h> | ||
#include <debug.h> | ||
|
||
#include <nuttx/analog/dac.h> | ||
#include <arch/board/board.h> | ||
|
||
#include "stm32_dac.h" | ||
#include "nucleo-f446re.h" | ||
|
||
#ifdef CONFIG_DAC | ||
|
||
/**************************************************************************** | ||
* Private Data | ||
****************************************************************************/ | ||
|
||
#ifdef CONFIG_STM32_DAC1CH1 | ||
static struct dac_dev_s *g_dac1; | ||
#endif | ||
|
||
#ifdef CONFIG_STM32_DAC1CH2 | ||
static struct dac_dev_s *g_dac2; | ||
#endif | ||
|
||
/**************************************************************************** | ||
* Public Functions | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Name: stm32_dac_setup | ||
* | ||
* Description: | ||
* Initialize and register the DAC driver. | ||
* | ||
* Input parameters: | ||
* devpath - The full path to the driver to register. E.g., "/dev/dac0" | ||
* | ||
* Returned Value: | ||
* Zero (OK) on success; a negated errno value on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
int stm32_dac_setup(void) | ||
{ | ||
int ret; | ||
#ifdef CONFIG_STM32_DAC1CH1 | ||
g_dac1 = stm32_dacinitialize(1); | ||
if (g_dac1 == NULL) | ||
{ | ||
aerr("ERROR: Failed to get DAC interface\n"); | ||
return -ENODEV; | ||
} | ||
|
||
/* Register the DAC driver at "/dev/dac0" */ | ||
|
||
ret = dac_register("/dev/dac0", g_dac1); | ||
if (ret < 0) | ||
{ | ||
aerr("ERROR: dac_register() failed: %d\n", ret); | ||
return ret; | ||
} | ||
|
||
#endif | ||
#ifdef CONFIG_STM32_DAC1CH2 | ||
g_dac2 = stm32_dacinitialize(2); | ||
if (g_dac2 == NULL) | ||
{ | ||
aerr("ERROR: Failed to get DAC interface\n"); | ||
return -ENODEV; | ||
} | ||
|
||
/* Register the DAC driver at "/dev/dac1" */ | ||
|
||
ret = dac_register("/dev/dac1", g_dac2); | ||
if (ret < 0) | ||
{ | ||
aerr("ERROR: dac_register() failed: %d\n", ret); | ||
return ret; | ||
} | ||
#endif | ||
|
||
UNUSED(ret); | ||
return OK; | ||
} | ||
|
||
#endif /* CONFIG_DAC */ |