This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b14b8c6db33d66cdb50dca911a449cb71135e955 Author: raiden00pl <[email protected]> AuthorDate: Thu Nov 16 14:14:55 2023 +0100 boards/thingy91: add board specific modem configuration --- boards/arm/nrf91/thingy91/src/CMakeLists.txt | 4 ++ boards/arm/nrf91/thingy91/src/Make.defs | 4 ++ boards/arm/nrf91/thingy91/src/nrf91_modem.c | 70 ++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/boards/arm/nrf91/thingy91/src/CMakeLists.txt b/boards/arm/nrf91/thingy91/src/CMakeLists.txt index 981c0df6c5..7c15b263fc 100644 --- a/boards/arm/nrf91/thingy91/src/CMakeLists.txt +++ b/boards/arm/nrf91/thingy91/src/CMakeLists.txt @@ -28,6 +28,10 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS nrf91_buttons.c) endif() +if(CONFIG_NRF91_MODEM) + list(APPEND SRCS nrf91_modem.c) +endif() + target_sources(board PRIVATE ${SRCS}) if(CONFIG_ARCH_BOARD_COMMON) diff --git a/boards/arm/nrf91/thingy91/src/Make.defs b/boards/arm/nrf91/thingy91/src/Make.defs index 3c723e4bc1..5548c30b9c 100644 --- a/boards/arm/nrf91/thingy91/src/Make.defs +++ b/boards/arm/nrf91/thingy91/src/Make.defs @@ -30,6 +30,10 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += nrf91_buttons.c endif +ifeq ($(CONFIG_NRF91_MODEM),y) +CSRCS += nrf91_modem.c +endif + DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/nrf91/thingy91/src/nrf91_modem.c b/boards/arm/nrf91/thingy91/src/nrf91_modem.c new file mode 100644 index 0000000000..760af9c763 --- /dev/null +++ b/boards/arm/nrf91/thingy91/src/nrf91_modem.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * boards/arm/nrf91/thingy91/src/nrf91_modem.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 <debug.h> + +#include "nrf_modem_at.h" +#include "nrf91_modem.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nrf91_modem_board_init + ****************************************************************************/ + +int nrf91_modem_board_init(void) +{ + int ret; + + /* Configure COEX0 pin - on-board antena */ + + ret = nrf_modem_at_printf("AT%%XCOEX0=1,1,1565,1586"); + if (ret < 0) + { + nerr("AT%%XCOEX0 config failed %d", ret); + goto errout; + } + + /* Configure MAGPIO pins */ + + ret = nrf_modem_at_printf("AT%%XMAGPIO=1,1,1,7,1,746,803,2,698,748," + "2,1710,2200,3,824,894,4,880,960,5,791,849," + "7,1565,1586"); + if (ret < 0) + { + nerr("AT%%XMAGPIO config failed %d", ret); + goto errout; + } + +errout: + return ret; +}
