Skip to content

Commit e97ebc0

Browse files
committed
Apollo3 and artemis code review changes, remvoe dead code, add missing spdx identifiers, fix style
1 parent 68d59d3 commit e97ebc0

File tree

8 files changed

+61
-47
lines changed

8 files changed

+61
-47
lines changed

connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/AP3CordioHCITransportDriver.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636

3737
#define PRINT_DEBUG_HCI 0
3838

39-
#if PRINT_DEBUG_HCI
40-
#include "mbed.h"
41-
DigitalOut debugGPIO(D28, 0);
42-
DigitalOut debugGPIO2(D25, 0);
43-
#endif
44-
4539
using namespace ble;
4640

4741
#ifndef USE_AMBIQ_DRIVER

connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/hal/apollo3/hci_drv_apollo3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
// This is part of revision 2.3.2 of the AmbiqSuite Development Package.
4444
//
4545
//*****************************************************************************
46+
// SPDX-License-Identifier: BSD-3-Clause
4647
#ifndef HCI_DRV_APOLLO3_H
4748
#define HCI_DRV_APOLLO3_H
4849

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TARGET_SFE_ARTEMIS/PinNames.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
/*
2-
Copyright (c) 2019 SparkFun Electronics
3-
4-
Permission is hereby granted, free of charge, to any person obtaining a copy
5-
of this software and associated documentation files (the "Software"), to deal
6-
in the Software without restriction, including without limitation the rights
7-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
copies of the Software, and to permit persons to whom the Software is
9-
furnished to do so, subject to the following conditions:
10-
11-
The above copyright notice and this permission notice shall be included in all
12-
copies or substantial portions of the Software.
13-
14-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20-
SOFTWARE.
21-
*/
2+
* Copyright (c) 2019-2020 SparkFun Electronics
3+
* SPDX-License-Identifier: MIT
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
2223
#ifndef MBED_PINNAMES_H
2324
#define MBED_PINNAMES_H
2425

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TARGET_SFE_ARTEMIS_MODULE/PinNames.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ typedef enum
4545
D6 = 6,
4646
D7 = 7,
4747
D8 = 8,
48-
D9 = 9
48+
D9 = 9,
4949
D10 = 10,
5050
D11 = 11,
5151
D12 = 12,
@@ -95,10 +95,19 @@ typedef enum
9595
A34 = D34,
9696
A35 = D35,
9797

98+
LED1 = D1,
99+
SERIAL_TX = 48,
100+
SERIAL_RX = 49,
101+
USBTX = SERIAL_TX,
102+
USBRX = SERIAL_RX,
103+
98104
// Not connected
99105
NC = NC_VAL
100106
} PinName;
101107

108+
#define STDIO_UART_TX USBTX
109+
#define STDIO_UART_RX USBRX
110+
102111
#ifdef __cplusplus
103112
}
104113
#endif

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TOOLCHAIN_GCC_ARM/AMA3B1KK.ld

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,4 @@ SECTIONS
188188
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
189189
PROVIDE(__stack = __StackTop);
190190
PROVIDE(_sstack = __StackTop);
191-
/* Check if data + heap + stack exceeds RAM limit*/
192-
/*ASSERT(1, "region RAM overflowed with stack")*/
193-
/* test test test */
194-
}
191+
}

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/gpio_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void gpio_mode(gpio_t *obj, PinMode mode)
6666
{
6767
MBED_ASSERT(gpio_is_connected(obj));
6868
MBED_ASSERT(mode < (PinMode)PinModeElements);
69-
am_hal_gpio_pincfg_allow_t pinConfigBools;
69+
am_hal_gpio_pincfg_allow_t pinConfigBools = {0};
7070

7171
obj->cfg.uFuncSel = AP3_PINCFG_FUNCSEL_GPIO; // gpio
7272

@@ -164,7 +164,7 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
164164
{
165165
MBED_ASSERT(gpio_is_connected(obj));
166166
MBED_ASSERT(direction < (PinDirection)PIN_DIR_ELEMENTS);
167-
am_hal_gpio_pincfg_allow_t pinConfigBools;
167+
am_hal_gpio_pincfg_allow_t pinConfigBools= {0};
168168

169169
if (direction == (PinDirection)PIN_INPUT) {
170170
obj->cfg.eGPInput = AM_HAL_GPIO_PIN_INPUT_ENABLE;

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/pinmap.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ void pinmap_config(PinName pin, const PinMap *map)
5757

5858
void pin_function(PinName pin, int function)
5959
{
60-
// am_hal_gpio_pincfg_t cfg = {0};
61-
// cfg.uFuncSel = function;
62-
// am_hal_gpio_pinconfig((uint32_t)(pin), cfg); // apply configuration
63-
6460
#define PADREG_FLD_FNSEL_S 3
6561

6662
uint32_t ui32Padreg;
@@ -95,23 +91,38 @@ void pin_function(PinName pin, int function)
9591
// Get the new values into their rightful bit positions.
9692
ui32Padreg <<= ui32PadShft;
9793

98-
AM_CRITICAL_BEGIN
94+
core_util_critical_section_enter();
9995

10096
GPIO->PADKEY = GPIO_PADKEY_PADKEY_Key;
10197

10298
AM_REGVAL(ui32PadregAddr) = (AM_REGVAL(ui32PadregAddr) & ui32PadClearMask) | ui32Padreg;
10399

104100
GPIO->PADKEY = 0;
105101

106-
AM_CRITICAL_END
102+
core_util_critical_section_exit();
107103
}
108104

105+
106+
//pin_mode should not be utilized by apollo3 hal, but is provided to complete the pinmap API
107+
//Use pinmap_config for apollo3 target insted of pinmap_pinout, this will have better hal verification of settings
108+
//if this function does not provide sufficient functionality, try pinmap_config or gpio_mode
109109
void pin_mode(PinName pin, PinMode mode)
110110
{
111-
MBED_ASSERT(0);
112-
// gpio_t obj = {
113-
// .pad = (ap3_gpio_pad_t)pin,
114-
// .cfg = {0},
115-
// };
116-
// gpio_mode(gpio_t * obj, PinMode mode)
111+
am_hal_gpio_pincfg_t bfGpioCfg = {0};
112+
am_hal_gpio_pincfg_allow_t sAllowableChanges = {0};
113+
114+
if (mode & (PinMode)PullNone) {
115+
bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
116+
sAllowableChanges.ePullup = true;
117+
}
118+
if (mode & (PinMode)PullUp) {
119+
bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_WEAK;
120+
sAllowableChanges.ePullup = true;
121+
}
122+
if (mode & (PinMode)PullDown) {
123+
bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLDOWN;
124+
sAllowableChanges.ePullup = true;
125+
}
126+
127+
ap3_hal_gpio_pinconfig_partial(pin, bfGpioCfg, sAllowableChanges);
117128
}

targets/targets.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,8 +6831,9 @@
68316831
"components": [
68326832
"FLASHIAP"
68336833
],
6834-
"macros": ["CORDIO_ZERO_COPY_HCI",
6835-
"USE_AMBIQ_DRIVER"
6834+
"macros": [
6835+
"CORDIO_ZERO_COPY_HCI",
6836+
"USE_AMBIQ_DRIVER"
68366837
]
68376838
},
68386839
"AMA3B1KK": {

0 commit comments

Comments
 (0)