Apollo3 and artemis code review changes, remvoe dead code, add missing spdx identifiers, fix style

pull/13538/head
Wenn0101 2020-09-09 15:47:23 -06:00
parent 68d59d3781
commit e97ebc033a
8 changed files with 61 additions and 47 deletions

View File

@ -36,12 +36,6 @@
#define PRINT_DEBUG_HCI 0 #define PRINT_DEBUG_HCI 0
#if PRINT_DEBUG_HCI
#include "mbed.h"
DigitalOut debugGPIO(D28, 0);
DigitalOut debugGPIO2(D25, 0);
#endif
using namespace ble; using namespace ble;
#ifndef USE_AMBIQ_DRIVER #ifndef USE_AMBIQ_DRIVER

View File

@ -43,6 +43,7 @@
// This is part of revision 2.3.2 of the AmbiqSuite Development Package. // This is part of revision 2.3.2 of the AmbiqSuite Development Package.
// //
//***************************************************************************** //*****************************************************************************
// SPDX-License-Identifier: BSD-3-Clause
#ifndef HCI_DRV_APOLLO3_H #ifndef HCI_DRV_APOLLO3_H
#define HCI_DRV_APOLLO3_H #define HCI_DRV_APOLLO3_H

View File

@ -1,23 +1,24 @@
/* /*
Copyright (c) 2019 SparkFun Electronics * Copyright (c) 2019-2020 SparkFun Electronics
* SPDX-License-Identifier: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy *
of this software and associated documentation files (the "Software"), to deal * Permission is hereby granted, free of charge, to any person obtaining a copy
in the Software without restriction, including without limitation the rights * of this software and associated documentation files (the "Software"), to deal
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * in the Software without restriction, including without limitation the rights
copies of the Software, and to permit persons to whom the Software is * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
furnished to do so, subject to the following conditions: * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all *
copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
#ifndef MBED_PINNAMES_H #ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H #define MBED_PINNAMES_H

View File

@ -45,7 +45,7 @@ typedef enum
D6 = 6, D6 = 6,
D7 = 7, D7 = 7,
D8 = 8, D8 = 8,
D9 = 9 D9 = 9,
D10 = 10, D10 = 10,
D11 = 11, D11 = 11,
D12 = 12, D12 = 12,
@ -95,10 +95,19 @@ typedef enum
A34 = D34, A34 = D34,
A35 = D35, A35 = D35,
LED1 = D1,
SERIAL_TX = 48,
SERIAL_RX = 49,
USBTX = SERIAL_TX,
USBRX = SERIAL_RX,
// Not connected // Not connected
NC = NC_VAL NC = NC_VAL
} PinName; } PinName;
#define STDIO_UART_TX USBTX
#define STDIO_UART_RX USBRX
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -188,7 +188,4 @@ SECTIONS
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE; __StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop); PROVIDE(__stack = __StackTop);
PROVIDE(_sstack = __StackTop); PROVIDE(_sstack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit*/
/*ASSERT(1, "region RAM overflowed with stack")*/
/* test test test */
} }

View File

@ -66,7 +66,7 @@ void gpio_mode(gpio_t *obj, PinMode mode)
{ {
MBED_ASSERT(gpio_is_connected(obj)); MBED_ASSERT(gpio_is_connected(obj));
MBED_ASSERT(mode < (PinMode)PinModeElements); MBED_ASSERT(mode < (PinMode)PinModeElements);
am_hal_gpio_pincfg_allow_t pinConfigBools; am_hal_gpio_pincfg_allow_t pinConfigBools = {0};
obj->cfg.uFuncSel = AP3_PINCFG_FUNCSEL_GPIO; // gpio obj->cfg.uFuncSel = AP3_PINCFG_FUNCSEL_GPIO; // gpio
@ -164,7 +164,7 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
{ {
MBED_ASSERT(gpio_is_connected(obj)); MBED_ASSERT(gpio_is_connected(obj));
MBED_ASSERT(direction < (PinDirection)PIN_DIR_ELEMENTS); MBED_ASSERT(direction < (PinDirection)PIN_DIR_ELEMENTS);
am_hal_gpio_pincfg_allow_t pinConfigBools; am_hal_gpio_pincfg_allow_t pinConfigBools= {0};
if (direction == (PinDirection)PIN_INPUT) { if (direction == (PinDirection)PIN_INPUT) {
obj->cfg.eGPInput = AM_HAL_GPIO_PIN_INPUT_ENABLE; obj->cfg.eGPInput = AM_HAL_GPIO_PIN_INPUT_ENABLE;

View File

@ -57,10 +57,6 @@ void pinmap_config(PinName pin, const PinMap *map)
void pin_function(PinName pin, int function) void pin_function(PinName pin, int function)
{ {
// am_hal_gpio_pincfg_t cfg = {0};
// cfg.uFuncSel = function;
// am_hal_gpio_pinconfig((uint32_t)(pin), cfg); // apply configuration
#define PADREG_FLD_FNSEL_S 3 #define PADREG_FLD_FNSEL_S 3
uint32_t ui32Padreg; uint32_t ui32Padreg;
@ -95,7 +91,7 @@ void pin_function(PinName pin, int function)
// Get the new values into their rightful bit positions. // Get the new values into their rightful bit positions.
ui32Padreg <<= ui32PadShft; ui32Padreg <<= ui32PadShft;
AM_CRITICAL_BEGIN core_util_critical_section_enter();
GPIO->PADKEY = GPIO_PADKEY_PADKEY_Key; GPIO->PADKEY = GPIO_PADKEY_PADKEY_Key;
@ -103,15 +99,30 @@ void pin_function(PinName pin, int function)
GPIO->PADKEY = 0; GPIO->PADKEY = 0;
AM_CRITICAL_END core_util_critical_section_exit();
} }
//pin_mode should not be utilized by apollo3 hal, but is provided to complete the pinmap API
//Use pinmap_config for apollo3 target insted of pinmap_pinout, this will have better hal verification of settings
//if this function does not provide sufficient functionality, try pinmap_config or gpio_mode
void pin_mode(PinName pin, PinMode mode) void pin_mode(PinName pin, PinMode mode)
{ {
MBED_ASSERT(0); am_hal_gpio_pincfg_t bfGpioCfg = {0};
// gpio_t obj = { am_hal_gpio_pincfg_allow_t sAllowableChanges = {0};
// .pad = (ap3_gpio_pad_t)pin,
// .cfg = {0}, if (mode & (PinMode)PullNone) {
// }; bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
// gpio_mode(gpio_t * obj, PinMode mode) sAllowableChanges.ePullup = true;
}
if (mode & (PinMode)PullUp) {
bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_WEAK;
sAllowableChanges.ePullup = true;
}
if (mode & (PinMode)PullDown) {
bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLDOWN;
sAllowableChanges.ePullup = true;
}
ap3_hal_gpio_pinconfig_partial(pin, bfGpioCfg, sAllowableChanges);
} }

View File

@ -6831,7 +6831,8 @@
"components": [ "components": [
"FLASHIAP" "FLASHIAP"
], ],
"macros": ["CORDIO_ZERO_COPY_HCI", "macros": [
"CORDIO_ZERO_COPY_HCI",
"USE_AMBIQ_DRIVER" "USE_AMBIQ_DRIVER"
] ]
}, },