1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/nucleo-wl55jc : Add arduino interfaces

This commit is contained in:
Akshai M 2021-04-20 19:00:18 +02:00
parent bd8f571895
commit 6b86f8aaf1
4 changed files with 154 additions and 0 deletions

View File

@ -23,6 +23,7 @@ config BOARD_NUCLEO_WL55JC
select HAS_PERIPH_UART
# Put other features for this board (in alphabetical order)
select HAS_ARDUINO
select HAS_RIOTBOOT
source "$(RIOTBOARD)/common/nucleo64/Kconfig"

View File

@ -11,3 +11,6 @@ FEATURES_PROVIDED += periph_uart
# Put other features for this board (in alphabetical order)
FEATURES_PROVIDED += riotboot
# load the common Makefile.features for Nucleo boards
include $(RIOTBOARD)/common/nucleo64/Makefile.features

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2021 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_nucleo-wl55jc
* @{
*
* @file
* @brief Board specific configuration for the Arduino API
*
* @author Akshai M <akshai.m@fu-berlin.de>
*/
#ifndef ARDUINO_BOARD_H
#define ARDUINO_BOARD_H
#include "arduino_pinmap.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Look-up table for the Arduino's digital pins
*/
static const gpio_t arduino_pinmap[] = {
ARDUINO_PIN_0,
ARDUINO_PIN_1,
ARDUINO_PIN_2,
ARDUINO_PIN_3,
ARDUINO_PIN_4,
ARDUINO_PIN_5,
ARDUINO_PIN_6,
ARDUINO_PIN_7,
ARDUINO_PIN_8,
ARDUINO_PIN_9,
ARDUINO_PIN_10,
ARDUINO_PIN_11,
ARDUINO_PIN_12,
ARDUINO_PIN_13,
ARDUINO_PIN_A0,
ARDUINO_PIN_A1,
ARDUINO_PIN_A2,
ARDUINO_PIN_A3,
ARDUINO_PIN_A4,
ARDUINO_PIN_A5,
};
/**
* @brief Look-up table for the Arduino's analog pins
*/
static const adc_t arduino_analog_map[] = {
ARDUINO_A0,
ARDUINO_A1,
ARDUINO_A2,
ARDUINO_A3,
ARDUINO_A4,
ARDUINO_A5,
};
#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_BOARD_H */
/** @} */

View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2021 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_nucleo-wl55jc
* @{
*
* @file
* @brief Mapping from MCU pins to Arduino pins
*
* You can use the defines in this file for simplified interaction with the
* Arduino specific pin numbers.
*
* @author Akshai M <akshai.m@fu-berlin.de>
*
*/
#ifndef ARDUINO_PINMAP_H
#define ARDUINO_PINMAP_H
#include "periph/gpio.h"
#include "periph/adc.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Mapping of MCU pins to Arduino pins
* @{
*/
#define ARDUINO_PIN_0 GPIO_PIN(PORT_B, 7)
#define ARDUINO_PIN_1 GPIO_PIN(PORT_B, 6)
#define ARDUINO_PIN_2 GPIO_PIN(PORT_B, 12)
#define ARDUINO_PIN_3 GPIO_PIN(PORT_B, 3)
#define ARDUINO_PIN_4 GPIO_PIN(PORT_B, 5)
#define ARDUINO_PIN_5 GPIO_PIN(PORT_B, 8)
#define ARDUINO_PIN_6 GPIO_PIN(PORT_B, 10)
#define ARDUINO_PIN_7 GPIO_PIN(PORT_C, 1)
#define ARDUINO_PIN_8 GPIO_PIN(PORT_C, 2)
#define ARDUINO_PIN_9 GPIO_PIN(PORT_A, 9)
#define ARDUINO_PIN_10 GPIO_PIN(PORT_A, 4)
#define ARDUINO_PIN_11 GPIO_PIN(PORT_A, 7)
#define ARDUINO_PIN_12 GPIO_PIN(PORT_A, 6)
#define ARDUINO_PIN_13 GPIO_PIN(PORT_A, 5)
#define ARDUINO_PIN_14 GPIO_PIN(PORT_A, 11)
#define ARDUINO_PIN_15 GPIO_PIN(PORT_A, 12)
#define ARDUINO_PIN_A0 GPIO_PIN(PORT_B, 1)
#define ARDUINO_PIN_A1 GPIO_PIN(PORT_B, 2)
#define ARDUINO_PIN_A2 GPIO_PIN(PORT_A, 10)
#define ARDUINO_PIN_A3 GPIO_PIN(PORT_B, 4)
#define ARDUINO_PIN_A4 GPIO_PIN(PORT_B, 14)
#define ARDUINO_PIN_A5 GPIO_PIN(PORT_B, 13)
/** @ */
/**
* @name Mapping of Arduino analog pins to RIOT ADC lines
* @{
*/
#define ARDUINO_A0 ADC_LINE(0)
#define ARDUINO_A1 ADC_LINE(1)
#define ARDUINO_A2 ADC_LINE(2)
#define ARDUINO_A3 ADC_LINE(3)
#define ARDUINO_A4 ADC_LINE(4)
#define ARDUINO_A5 ADC_LINE(5)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_PINMAP_H */
/** @} */