Skip to content

Commit

Permalink
Fix pin definition handling and defines
Browse files Browse the repository at this point in the history
  • Loading branch information
d00616 committed Dec 6, 2017
1 parent 2152f91 commit fbba1bc
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 116 deletions.
8 changes: 4 additions & 4 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ MyBoard_nRF52832.build.board=GENERIC
MyBoard_nRF52832.build.core=sandeepmistry:nRF5
MyBoard_nRF52832.build.variant=MyBoardNRF5
MyBoard_nRF52832.build.variant_system_lib=
# -I{build.path} and -DMYNRF5BOARD is only required by MyBoardNRF5
MyBoard_nRF52832.build.extra_flags=-DNRF52 -DMYNRF5BOARD -I{build.path}
# -I{build.path} and -DMYBOARDNRF5 is only required by MyBoardNRF5
MyBoard_nRF52832.build.extra_flags=-DNRF52 -DMYBOARDNRF5 -I{build.path}
MyBoard_nRF52832.build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16
MyBoard_nRF52832.build.ldscript=nrf52_xxaa.ld

Expand Down Expand Up @@ -86,8 +86,8 @@ MyBoard_nRF51822.build.board=GENERIC
MyBoard_nRF51822.build.core=sandeepmistry:nRF5
MyBoard_nRF51822.build.variant=MyBoardNRF5
MyBoard_nRF51822.build.variant_system_lib=
# -I{build.path} and -DMYNRF5BOARD is only required by MyBoardNRF5
MyBoard_nRF51822.build.extra_flags=-DNRF51 -DMYNRF5BOARD -I{build.path}
# -I{build.path} and -DMYBOARDNRF5 is only required by MyBoardNRF5
MyBoard_nRF51822.build.extra_flags=-DNRF51 -DMYBOARDNRF5 -I{build.path}
MyBoard_nRF51822.build.float_flags=
MyBoard_nRF51822.build.ldscript=nrf51_{build.chip}.ld

Expand Down
5 changes: 4 additions & 1 deletion libraries/MyBoardNRF5/examples/MyBoardNRF5/MyBoardNRF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@



#ifdef MYNRF5BOARD
#ifdef MYBOARDNRF5
#include <variant.h>

/*
Expand Down Expand Up @@ -104,4 +104,7 @@ const PinDescription g_APinDescription[]=
{ PORT0, 31, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A7, PWM0, NOT_ON_TIMER}
};

// Don't remove this line
#include <compat_pin_mapping.h>

#endif
4 changes: 2 additions & 2 deletions libraries/MyBoardNRF5/examples/MyBoardNRF5/MyBoardNRF5.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _MYNRF5BOARD_H_
#define _MYNRF5BOARD_H_
#ifndef _MYBOARDNRF5_H_
#define _MYBOARDNRF5_H_

#ifdef __cplusplus
extern "C"
Expand Down
5 changes: 4 additions & 1 deletion libraries/MyBoardNRF5/examples/mass_erase/MyBoardNRF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@



#ifdef MYNRF5BOARD
#ifdef MYBOARDNRF5
#include <variant.h>

/*
Expand Down Expand Up @@ -104,4 +104,7 @@ const PinDescription g_APinDescription[]=
{ PORT0, 31, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A7, PWM0, NOT_ON_TIMER}
};

// Don't remove this line
#include <compat_pin_mapping.h>

#endif
4 changes: 2 additions & 2 deletions libraries/MyBoardNRF5/examples/mass_erase/MyBoardNRF5.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _MYNRF5BOARD_H_
#define _MYNRF5BOARD_H_
#ifndef _MYBOARDNRF5_H_
#define _MYBOARDNRF5_H_

#ifdef __cplusplus
extern "C"
Expand Down
2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

name=MySensors nRF5 Boards
version=0.2.1
version=0.3.0

# Path calculation
##################
Expand Down
121 changes: 121 additions & 0 deletions variants/MyBoardNRF5/compat_pin_mapping.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#pragma once

#ifndef MY_ARDUINO_CORE_NRF5
const uint32_t g_ADigitalPinMap[] = {
#if PINS_COUNT>(0u)
g_APinDescription[0].ulPin
#endif
#if PINS_COUNT>(1u)
,g_APinDescription[1].ulPin
#endif
#if PINS_COUNT>(2u)
,g_APinDescription[2].ulPin
#endif
#if PINS_COUNT>(3u)
,g_APinDescription[3].ulPin
#endif
#if PINS_COUNT>(4u)
,g_APinDescription[4].ulPin
#endif
#if PINS_COUNT>(5u)
,g_APinDescription[5].ulPin
#endif
#if PINS_COUNT>(6u)
,g_APinDescription[6].ulPin
#endif
#if PINS_COUNT>(7u)
,g_APinDescription[7].ulPin
#endif
#if PINS_COUNT>(8u)
,g_APinDescription[8].ulPin
#endif
#if PINS_COUNT>(9u)
,g_APinDescription[9].ulPin
#endif
#if PINS_COUNT>(10u)
,g_APinDescription[10].ulPin
#endif
#if PINS_COUNT>(11u)
,g_APinDescription[11].ulPin
#endif
#if PINS_COUNT>(12u)
,g_APinDescription[12].ulPin
#endif
#if PINS_COUNT>(13u)
,g_APinDescription[13].ulPin
#endif
#if PINS_COUNT>(14u)
,g_APinDescription[14].ulPin
#endif
#if PINS_COUNT>(15u)
,g_APinDescription[15].ulPin
#endif
#if PINS_COUNT>(16u)
,g_APinDescription[16].ulPin
#endif
#if PINS_COUNT>(17u)
,g_APinDescription[17].ulPin
#endif
#if PINS_COUNT>(18u)
,g_APinDescription[18].ulPin
#endif
#if PINS_COUNT>(19u)
,g_APinDescription[19].ulPin
#endif
#if PINS_COUNT>(20u)
,g_APinDescription[20].ulPin
#endif
#if PINS_COUNT>(21u)
,g_APinDescription[21].ulPin
#endif
#if PINS_COUNT>(22u)
,g_APinDescription[22].ulPin
#endif
#if PINS_COUNT>(23u)
,g_APinDescription[23].ulPin
#endif
#if PINS_COUNT>(24u)
,g_APinDescription[24].ulPin
#endif
#if PINS_COUNT>(25u)
,g_APinDescription[25].ulPin
#endif
#if PINS_COUNT>(26u)
,g_APinDescription[26].ulPin
#endif
#if PINS_COUNT>(27u)
,g_APinDescription[27].ulPin
#endif
#if PINS_COUNT>(28u)
,g_APinDescription[28].ulPin
#endif
#if PINS_COUNT>(29u)
,g_APinDescription[29].ulPin
#endif
#if PINS_COUNT>(30u)
,g_APinDescription[30].ulPin
#endif
#if PINS_COUNT>(31u)
,g_APinDescription[31].ulPin
#endif
};
#endif
102 changes: 1 addition & 101 deletions variants/MyBoardNRF5/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,107 +18,7 @@
*/

#include "variant.h"

#ifndef MY_ARDUINO_CORE_NRF5
const uint32_t g_ADigitalPinMap[] = {
#if PINS_COUNT>(0u)
g_APinDescription[0].ulPin
#endif
#if PINS_COUNT>(1u)
,g_APinDescription[1].ulPin
#endif
#if PINS_COUNT>(2u)
,g_APinDescription[2].ulPin
#endif
#if PINS_COUNT>(3u)
,g_APinDescription[3].ulPin
#endif
#if PINS_COUNT>(4u)
,g_APinDescription[4].ulPin
#endif
#if PINS_COUNT>(5u)
,g_APinDescription[5].ulPin
#endif
#if PINS_COUNT>(6u)
,g_APinDescription[6].ulPin
#endif
#if PINS_COUNT>(7u)
,g_APinDescription[7].ulPin
#endif
#if PINS_COUNT>(8u)
,g_APinDescription[8].ulPin
#endif
#if PINS_COUNT>(9u)
,g_APinDescription[9].ulPin
#endif
#if PINS_COUNT>(10u)
,g_APinDescription[10].ulPin
#endif
#if PINS_COUNT>(11u)
,g_APinDescription[11].ulPin
#endif
#if PINS_COUNT>(12u)
,g_APinDescription[12].ulPin
#endif
#if PINS_COUNT>(13u)
,g_APinDescription[13].ulPin
#endif
#if PINS_COUNT>(14u)
,g_APinDescription[14].ulPin
#endif
#if PINS_COUNT>(15u)
,g_APinDescription[15].ulPin
#endif
#if PINS_COUNT>(16u)
,g_APinDescription[16].ulPin
#endif
#if PINS_COUNT>(17u)
,g_APinDescription[17].ulPin
#endif
#if PINS_COUNT>(18u)
,g_APinDescription[18].ulPin
#endif
#if PINS_COUNT>(19u)
,g_APinDescription[19].ulPin
#endif
#if PINS_COUNT>(20u)
,g_APinDescription[20].ulPin
#endif
#if PINS_COUNT>(21u)
,g_APinDescription[21].ulPin
#endif
#if PINS_COUNT>(22u)
,g_APinDescription[22].ulPin
#endif
#if PINS_COUNT>(23u)
,g_APinDescription[23].ulPin
#endif
#if PINS_COUNT>(24u)
,g_APinDescription[24].ulPin
#endif
#if PINS_COUNT>(25u)
,g_APinDescription[25].ulPin
#endif
#if PINS_COUNT>(26u)
,g_APinDescription[26].ulPin
#endif
#if PINS_COUNT>(27u)
,g_APinDescription[27].ulPin
#endif
#if PINS_COUNT>(28u)
,g_APinDescription[28].ulPin
#endif
#if PINS_COUNT>(29u)
,g_APinDescription[29].ulPin
#endif
#if PINS_COUNT>(30u)
,g_APinDescription[30].ulPin
#endif
#if PINS_COUNT>(31u)
,g_APinDescription[31].ulPin
#endif
};
#endif
#include <sketch/MyBoardNRF5.h>

#if defined(MY_ARDUINO_CORE_NRF5) && defined(PIN_SERIAL_RX) && defined(PIN_SERIAL_TX)
Uart Serial(PIN_SERIAL_RX, PIN_SERIAL_TX);
Expand Down
12 changes: 8 additions & 4 deletions variants/MyBoardNRF5/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _VARIANT_MYNRF5BOARD_
#define _VARIANT_MYNRF5BOARD_
#ifndef _VARIANT_MYBOARDNRF5_
#define _VARIANT_MYBOARDNRF5_

/*----------------------------------------------------------------------------
* Headers
Expand All @@ -39,11 +39,15 @@ extern "C"

#ifdef MY_ARDUINO_CORE_NRF5
/**
* Libc porting layers
* Libc porting layers for arduino core variant
*/
#if defined ( __GNUC__ )
# include <syscalls.h> /** RedHat Newlib minimal stub */
#include <syscalls.h> /** RedHat Newlib minimal stub */
#endif
#else
/**
* Compatibility for arduino-nrf5 variant
*/
#endif

/*----------------------------------------------------------------------------
Expand Down

0 comments on commit fbba1bc

Please sign in to comment.