-
Notifications
You must be signed in to change notification settings - Fork 3k
Pinmap extensions #9449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Pinmap extensions #9449
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4818f88
Add HAL API for analog in pinmap
c1728p9 3bd3aca
Add HAL API for analog out pinmap
c1728p9 7e8695a
Add HAL API for can pinmap
c1728p9 22a8977
Add HAL API for i2c pinmap
c1728p9 be492fe
Add HAL API for pwmout pinmap
c1728p9 2ed1dc2
Add HAL API for qspi pinmap
c1728p9 34c1766
Add HAL API for serial pinmap
c1728p9 8669417
Add HAL API for spi pinmap
c1728p9 0dee05a
Add pinmap utility functions
c1728p9 7071513
Add form factor pinmap support
c1728p9 8d205ab
Add testing pinmaps to NRF5X devices
c1728p9 c7a1946
Add pinmaps to Ameba
c1728p9 8007085
Add testing pinmaps to LPC15XX and LPC8XX devices
c1728p9 d5892ce
Add a sanity check test for pinmaps
c1728p9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* mbed Microcontroller Library | ||
* Copyright (c) 2019 ARM Limited | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
#include "utest/utest.h" | ||
#include "unity/unity.h" | ||
#include "greentea-client/test_env.h" | ||
|
||
using namespace utest::v1; | ||
|
||
#include "analogin_api.h" | ||
#include "analogout_api.h" | ||
#include "can_api.h" | ||
#include "i2c_api.h" | ||
#include "pwmout_api.h" | ||
#include "qspi_api.h" | ||
#include "serial_api.h" | ||
#include "spi_api.h" | ||
|
||
#define PINMAP_TEST_ENTRY(function) {function, #function} | ||
|
||
typedef const PinMap *(*get_pinmap_func_t)(void); | ||
typedef struct { | ||
get_pinmap_func_t function; | ||
const char *name; | ||
} pinmap_info_t; | ||
|
||
const pinmap_info_t pinmap_functions[] = { | ||
#if DEVICE_ANALOGIN | ||
PINMAP_TEST_ENTRY(analogin_pinmap), | ||
#endif | ||
#if DEVICE_ANALOGOUT | ||
PINMAP_TEST_ENTRY(analogout_pinmap), | ||
#endif | ||
#if DEVICE_CAN | ||
PINMAP_TEST_ENTRY(can_rd_pinmap), | ||
PINMAP_TEST_ENTRY(can_td_pinmap), | ||
#endif | ||
#if DEVICE_I2C | ||
PINMAP_TEST_ENTRY(i2c_master_sda_pinmap), | ||
PINMAP_TEST_ENTRY(i2c_master_scl_pinmap), | ||
#if DEVICE_I2CSLAVE | ||
PINMAP_TEST_ENTRY(i2c_slave_sda_pinmap), | ||
PINMAP_TEST_ENTRY(i2c_slave_scl_pinmap), | ||
#endif | ||
#endif | ||
#if DEVICE_PWMOUT | ||
PINMAP_TEST_ENTRY(pwmout_pinmap), | ||
#endif | ||
#if DEVICE_QSPI | ||
PINMAP_TEST_ENTRY(qspi_master_sclk_pinmap), | ||
PINMAP_TEST_ENTRY(qspi_master_ssel_pinmap), | ||
PINMAP_TEST_ENTRY(qspi_master_data0_pinmap), | ||
PINMAP_TEST_ENTRY(qspi_master_data1_pinmap), | ||
PINMAP_TEST_ENTRY(qspi_master_data2_pinmap), | ||
PINMAP_TEST_ENTRY(qspi_master_data3_pinmap), | ||
#endif | ||
#if DEVICE_SERIAL | ||
PINMAP_TEST_ENTRY(serial_tx_pinmap), | ||
PINMAP_TEST_ENTRY(serial_rx_pinmap), | ||
#if DEVICE_SERIAL_FC | ||
PINMAP_TEST_ENTRY(serial_cts_pinmap), | ||
c1728p9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PINMAP_TEST_ENTRY(serial_rts_pinmap), | ||
#endif | ||
#endif | ||
#if DEVICE_SPI | ||
PINMAP_TEST_ENTRY(spi_master_mosi_pinmap), | ||
PINMAP_TEST_ENTRY(spi_master_miso_pinmap), | ||
PINMAP_TEST_ENTRY(spi_master_clk_pinmap), | ||
PINMAP_TEST_ENTRY(spi_master_cs_pinmap), | ||
#if DEVICE_SPISLAVE | ||
PINMAP_TEST_ENTRY(spi_slave_mosi_pinmap), | ||
c1728p9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PINMAP_TEST_ENTRY(spi_slave_miso_pinmap), | ||
PINMAP_TEST_ENTRY(spi_slave_clk_pinmap), | ||
PINMAP_TEST_ENTRY(spi_slave_cs_pinmap), | ||
#endif | ||
#endif | ||
{NULL, NULL} | ||
}; | ||
|
||
void pinmap_validation() | ||
{ | ||
for (size_t i = 0; i < sizeof(pinmap_functions) / sizeof(pinmap_functions[0]) - 1; i++) { | ||
printf("Testing pinmap %s\r\n", pinmap_functions[i].name); | ||
|
||
get_pinmap_func_t function = pinmap_functions[i].function; | ||
TEST_ASSERT_NOT_EQUAL(NULL, function); | ||
|
||
const PinMap *map = function(); | ||
TEST_ASSERT_NOT_EQUAL(NULL, map); | ||
|
||
while (map->pin != NC) { | ||
map++; | ||
} | ||
|
||
TEST_ASSERT_EQUAL(NC, map->peripheral); | ||
} | ||
} | ||
|
||
Case cases[] = { | ||
Case("pinmap - validation", pinmap_validation) | ||
}; | ||
|
||
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) | ||
{ | ||
GREENTEA_SETUP(20, "default_auto"); | ||
return greentea_test_setup_handler(number_of_cases); | ||
} | ||
|
||
Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); | ||
|
||
int main() | ||
{ | ||
Harness::run(specification); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.