mirror of https://github.com/ARMmbed/mbed-os.git
commit
8f932a476f
|
@ -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),
|
||||
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),
|
||||
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);
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_ANALOGIN_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
|
||||
#if DEVICE_ANALOGIN
|
||||
|
||||
|
@ -59,6 +60,15 @@ float analogin_read(analogin_t *obj);
|
|||
*/
|
||||
uint16_t analogin_read_u16(analogin_t *obj);
|
||||
|
||||
/** Get the pins that support analogin
|
||||
*
|
||||
* Return a PinMap array of pins that support analogin. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *analogin_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_ANALOGOUT_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
|
||||
#if DEVICE_ANALOGOUT
|
||||
|
||||
|
@ -81,6 +82,15 @@ float analogout_read(dac_t *obj);
|
|||
*/
|
||||
uint16_t analogout_read_u16(dac_t *obj);
|
||||
|
||||
/** Get the pins that support analogout
|
||||
*
|
||||
* Return a PinMap array of pins that support analogout. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *analogout_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_CAN_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
|
||||
#if DEVICE_CAN
|
||||
|
||||
|
@ -76,6 +77,24 @@ unsigned char can_rderror(can_t *obj);
|
|||
unsigned char can_tderror(can_t *obj);
|
||||
void can_monitor(can_t *obj, int silent);
|
||||
|
||||
/** Get the pins that support CAN RD
|
||||
*
|
||||
* Return a PinMap array of pins that support CAN RD. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *can_rd_pinmap(void);
|
||||
|
||||
/** Get the pins that support CAN TD
|
||||
*
|
||||
* Return a PinMap array of pins that support CAN TD. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *can_td_pinmap(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_I2C_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
#include "hal/buffer.h"
|
||||
|
||||
#if DEVICE_I2C_ASYNCH
|
||||
|
@ -146,6 +147,42 @@ int i2c_byte_read(i2c_t *obj, int last);
|
|||
*/
|
||||
int i2c_byte_write(i2c_t *obj, int data);
|
||||
|
||||
/** Get the pins that support I2C SDA
|
||||
*
|
||||
* Return a PinMap array of pins that support I2C SDA in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *i2c_master_sda_pinmap(void);
|
||||
|
||||
/** Get the pins that support I2C SCL
|
||||
*
|
||||
* Return a PinMap array of pins that support I2C SCL in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *i2c_master_scl_pinmap(void);
|
||||
|
||||
/** Get the pins that support I2C SDA
|
||||
*
|
||||
* Return a PinMap array of pins that support I2C SDA in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *i2c_slave_sda_pinmap(void);
|
||||
|
||||
/** Get the pins that support I2C SCL
|
||||
*
|
||||
* Return a PinMap array of pins that support I2C SCL in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *i2c_slave_scl_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
|
|
|
@ -104,3 +104,77 @@ uint32_t pinmap_function(PinName pin, const PinMap *map)
|
|||
}
|
||||
return function;
|
||||
}
|
||||
|
||||
bool pinmap_find_peripheral_pins(const PinList *whitelist, const PinList *blacklist, int per, const PinMap *const *maps, PinName **pins, uint32_t count)
|
||||
{
|
||||
/*
|
||||
* This function uses recursion to find a suitable set of pins which meet the requirements.
|
||||
* Recursion is at max the number of pinmaps passed in - the 'count' parameter. Because of this
|
||||
* there is no risk of a stack overflow due to unbounded recursion.
|
||||
*
|
||||
* Below is a psuedo code example of this function's operation when finding a set of 4 pins.
|
||||
* The recursion depth is indicated by the number in front.
|
||||
*
|
||||
* 1. Given 4 maps and a peripheral find 4 suitable pins
|
||||
* 2. Given 4 maps, a peripheral and 1 pin find 3 suitable pins
|
||||
* 3. Given 4 maps, a peripheral and 2 pins find 2 suitable pins
|
||||
* 4. Given 4 maps, a peripheral and 3 pins find 1 suitable pin
|
||||
* 4. Return success if all pins are found, return failure if there are no suitable pins, otherwise choose the next pin and retry
|
||||
* 3. Return success if all pins are found, return failure if there are no suitable pins, otherwise choose the next pin and retry
|
||||
* 2. Return success if all pins are found, return failure if there are no suitable pins, otherwise choose the next pin and retry
|
||||
* 1. Return success if all pins are found, return failure if there are no suitable pins, otherwise choose the next pin and retry
|
||||
*
|
||||
*/
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
const PinMap *map = maps[i];
|
||||
PinName *pin = pins[i];
|
||||
if (*pin == NC) {
|
||||
for (; map->pin != NC; map++) {
|
||||
if (map->peripheral != per) {
|
||||
continue;
|
||||
}
|
||||
if (!pinmap_list_has_pin(whitelist, map->pin)) {
|
||||
// Not part of this form factor
|
||||
continue;
|
||||
}
|
||||
if (pinmap_list_has_pin(blacklist, map->pin)) {
|
||||
// Restricted pin
|
||||
continue;
|
||||
}
|
||||
bool already_in_use = false;
|
||||
for (uint32_t j = 0; j < count; j++) {
|
||||
if (j == i) {
|
||||
// Don't compare with self
|
||||
continue;
|
||||
}
|
||||
if (map->pin == *pins[j]) {
|
||||
already_in_use = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (already_in_use) {
|
||||
continue;
|
||||
}
|
||||
*pin = map->pin;
|
||||
if (pinmap_find_peripheral_pins(whitelist, blacklist, per, maps, pins, count)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*pin = NC;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pinmap_list_has_pin(const PinList *list, PinName pin)
|
||||
{
|
||||
for (uint32_t i = 0; i < list->count; i++) {
|
||||
if (list->pins[i] == pin) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include "hal/pinmap.h"
|
||||
#include "platform/mbed_toolchain.h"
|
||||
#include "platform/mbed_assert.h"
|
||||
#include "device.h"
|
||||
|
||||
//*** Common form factors ***
|
||||
#ifdef TARGET_FF_ARDUINO
|
||||
|
||||
static const PinName ff_arduino_pins[] = {
|
||||
D0, D1, D2, D3, D4, D5, D6, D7,
|
||||
D8, D9, D10, D11, D12, D13, D14, D15,
|
||||
A0, A1, A2, A3, A4, A5
|
||||
};
|
||||
|
||||
static const char *ff_arduino_names[] = {
|
||||
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
|
||||
"D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15",
|
||||
"A0", "A1", "A2", "A3", "A4", "A5"
|
||||
};
|
||||
|
||||
static const PinList ff_arduino_list = {
|
||||
sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]),
|
||||
ff_arduino_pins
|
||||
};
|
||||
|
||||
MBED_STATIC_ASSERT(sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]) == sizeof(ff_arduino_names) / sizeof(ff_arduino_names[0]),
|
||||
"Arrays must have the same length");
|
||||
|
||||
const PinList *pinmap_ff_arduino_pins()
|
||||
{
|
||||
return &ff_arduino_list;
|
||||
}
|
||||
|
||||
const char *pinmap_ff_arduino_pin_to_string(PinName pin)
|
||||
{
|
||||
if (pin == NC) {
|
||||
return "NC";
|
||||
}
|
||||
for (size_t i = 0; i < ff_arduino_list.count; i++) {
|
||||
if (ff_arduino_list.pins[i] == pin) {
|
||||
return ff_arduino_names[i];
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//*** Default restricted pins ***
|
||||
MBED_WEAK const PinList *pinmap_restricted_pins()
|
||||
{
|
||||
static const PinName pins[] = {
|
||||
USBTX, USBRX
|
||||
};
|
||||
static const PinList pin_list = {
|
||||
sizeof(pins) / sizeof(pins[0]),
|
||||
pins
|
||||
};
|
||||
return &pin_list;
|
||||
}
|
||||
|
153
hal/pinmap.h
153
hal/pinmap.h
|
@ -21,6 +21,7 @@
|
|||
#define MBED_PINMAP_H
|
||||
|
||||
#include "PinNames.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -32,6 +33,11 @@ typedef struct {
|
|||
int function;
|
||||
} PinMap;
|
||||
|
||||
typedef struct {
|
||||
uint32_t count;
|
||||
const PinName *pins;
|
||||
} PinList;
|
||||
|
||||
void pin_function(PinName pin, int function);
|
||||
void pin_mode(PinName pin, PinMode mode);
|
||||
|
||||
|
@ -42,6 +48,153 @@ void pinmap_pinout(PinName pin, const PinMap *map);
|
|||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_find_function(PinName pin, const PinMap *map);
|
||||
|
||||
/**
|
||||
* Find a combination of pins suitable for use given the constraints
|
||||
*
|
||||
* This function finds pins which meet these specific properties:
|
||||
* - The pin is part of the form factor
|
||||
* - The pin is not in the restricted list
|
||||
* - The pin is contained within the respective pinmap
|
||||
* - The pin belongs to the given peripheral
|
||||
* - Each pin found is distinct; in the example below
|
||||
* mosi and miso will never be assigned the same pin
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* #include "mbed.h"
|
||||
* #include "pinmap.h"
|
||||
*
|
||||
* int main()
|
||||
* {
|
||||
* int per = spi_master_cs_pinmap()->peripheral;
|
||||
* const PinList *pins_ff = pinmap_ff_default_pins();
|
||||
* const PinList *pins_avoid = pinmap_restricted_pins();
|
||||
* PinName mosi = NC;
|
||||
* PinName miso = NC;
|
||||
* PinName sclk = NC;
|
||||
* PinName ssel = NC;
|
||||
* const PinMap *maps[] = {
|
||||
* spi_master_mosi_pinmap(),
|
||||
* spi_master_miso_pinmap(),
|
||||
* spi_master_clk_pinmap(),
|
||||
* spi_master_cs_pinmap()
|
||||
* };
|
||||
* PinName *pins[] = {
|
||||
* &mosi,
|
||||
* &miso,
|
||||
* &sclk,
|
||||
* &ssel
|
||||
* };
|
||||
* if (pinmap_find_peripheral_pins(pins_ff, pins_avoid, per, maps, pins, sizeof(maps) / sizeof(maps[0]))) {
|
||||
* printf("Found SPI pins to test instance %i with:\n"
|
||||
* " mosi=%s\n"
|
||||
* " miso=%s\n"
|
||||
* " sclk=%s\n"
|
||||
* " ssel=%s\n", per,
|
||||
* pinmap_ff_default_pin_to_string(mosi),
|
||||
* pinmap_ff_default_pin_to_string(miso),
|
||||
* pinmap_ff_default_pin_to_string(sclk),
|
||||
* pinmap_ff_default_pin_to_string(ssel));
|
||||
* } else {
|
||||
* printf("Could not find SPI combination to test %i\n", per);
|
||||
* }
|
||||
* return 0;
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @param whitelist List of pins to choose from
|
||||
* @param blacklist List of pins which cannot be used
|
||||
* @param per Peripheral to which the pins belong
|
||||
* @param maps An array of pin maps to select from
|
||||
* @param pins An array of pins to find. Pins already set to a value will be
|
||||
* left unchanged. Only pins initialized to NC will be updated by this function
|
||||
* @param count The size of maps and pins
|
||||
* @return true if a suitable combination of pins was found and
|
||||
* written to the pins array, otherwise false
|
||||
*/
|
||||
bool pinmap_find_peripheral_pins(const PinList *whitelist, const PinList *blacklist, int per, const PinMap *const *maps, PinName **pins, uint32_t count);
|
||||
|
||||
/**
|
||||
* Check if the pin is in the list
|
||||
*
|
||||
* @param list pin list to check
|
||||
* @param pin pin to check for in the list
|
||||
* @return true if the pin is in the list, false otherwise
|
||||
*/
|
||||
bool pinmap_list_has_pin(const PinList *list, PinName pin);
|
||||
|
||||
/**
|
||||
* Get the pin list of pins to avoid during testing
|
||||
*
|
||||
* The restricted pin list is used to indicate to testing
|
||||
* that a pin should be skipped due to some caveat about it.
|
||||
* For example, using USBRX and USBTX during tests will interfere
|
||||
* with the test runner and should be avoided.
|
||||
*
|
||||
* Targets should override the weak implementation of this
|
||||
* function if they have additional pins which should be
|
||||
* skipped during testing.
|
||||
*
|
||||
* @return Pointer to a pin list of pins to avoid
|
||||
*/
|
||||
const PinList *pinmap_restricted_pins(void);
|
||||
|
||||
#ifdef TARGET_FF_ARDUINO
|
||||
|
||||
/**
|
||||
* Get the pin list of the Arduino form factor
|
||||
*
|
||||
* @return Pointer to the Arduino pin list
|
||||
*/
|
||||
const PinList *pinmap_ff_arduino_pins(void);
|
||||
|
||||
/**
|
||||
* Get the string representation of a form factor pin
|
||||
*
|
||||
* @param pin Pin to get a string for
|
||||
* @return String representing the form factor pin
|
||||
*/
|
||||
const char *pinmap_ff_arduino_pin_to_string(PinName pin);
|
||||
|
||||
/* Default to arduino form factor if unspecified */
|
||||
#ifndef MBED_CONF_TARGET_DEFAULT_FORM_FACTOR
|
||||
#define MBED_CONF_TARGET_DEFAULT_FORM_FACTOR arduino
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MBED_CONF_TARGET_DEFAULT_FORM_FACTOR
|
||||
|
||||
#define PINMAP_DEFAULT_PINS_(name) pinmap_ff_ ## name ## _pins
|
||||
#define PINMAP_DEFAULT_PIN_TO_STRING_(name) pinmap_ff_ ## name ## _pin_to_string
|
||||
#define PINMAP_DEFAULT_PINS(name) PINMAP_DEFAULT_PINS_(name)
|
||||
#define PINMAP_DEFAULT_PIN_TO_STRING(name) PINMAP_DEFAULT_PIN_TO_STRING_(name)
|
||||
#define pinmap_ff_default_pins PINMAP_DEFAULT_PINS(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
|
||||
#define pinmap_ff_default_pin_to_string PINMAP_DEFAULT_PIN_TO_STRING(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
|
||||
|
||||
/**
|
||||
* Get the pin list of the default form factor
|
||||
*
|
||||
* This is an alias to whichever form factor is set
|
||||
* to be the default.
|
||||
*
|
||||
* @return Pointer to the default pin list
|
||||
*/
|
||||
const PinList *pinmap_ff_default_pins(void);
|
||||
|
||||
/**
|
||||
* Get the string representation of a form factor pin
|
||||
*
|
||||
* This is an alias to whichever form factor is set
|
||||
* to be the default.
|
||||
*
|
||||
* @param pin Pin to get a string for
|
||||
* @return String representing the form factor pin
|
||||
*/
|
||||
const char *pinmap_ff_default_pin_to_string(PinName pin);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_PWMOUT_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
|
||||
#if DEVICE_PWMOUT
|
||||
|
||||
|
@ -108,6 +109,15 @@ void pwmout_pulsewidth_ms(pwmout_t *obj, int ms);
|
|||
*/
|
||||
void pwmout_pulsewidth_us(pwmout_t *obj, int us);
|
||||
|
||||
/** Get the pins that support PWM
|
||||
*
|
||||
* Return a PinMap array of pins that support PWM.
|
||||
* The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *pwmout_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_QSPI_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#if DEVICE_QSPI
|
||||
|
@ -182,6 +183,60 @@ qspi_status_t qspi_command_transfer(qspi_t *obj, const qspi_command_t *command,
|
|||
*/
|
||||
qspi_status_t qspi_read(qspi_t *obj, const qspi_command_t *command, void *data, size_t *length);
|
||||
|
||||
/** Get the pins that support QSPI SCLK
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI SCLK in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_sclk_pinmap(void);
|
||||
|
||||
/** Get the pins that support QSPI SSEL
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI SSEL in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_ssel_pinmap(void);
|
||||
|
||||
/** Get the pins that support QSPI DATA0
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI DATA0 in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_data0_pinmap(void);
|
||||
|
||||
/** Get the pins that support QSPI DATA1
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI DATA1 in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_data1_pinmap(void);
|
||||
|
||||
/** Get the pins that support QSPI DATA2
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI DATA2 in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_data2_pinmap(void);
|
||||
|
||||
/** Get the pins that support QSPI DATA3
|
||||
*
|
||||
* Return a PinMap array of pins that support QSPI DATA3 in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *qspi_master_data3_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_SERIAL_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
#include "hal/buffer.h"
|
||||
#include "hal/dma_api.h"
|
||||
|
||||
|
@ -220,6 +221,42 @@ void serial_pinout_tx(PinName tx);
|
|||
*/
|
||||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
|
||||
|
||||
/** Get the pins that support Serial TX
|
||||
*
|
||||
* Return a PinMap array of pins that support Serial TX. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *serial_tx_pinmap(void);
|
||||
|
||||
/** Get the pins that support Serial RX
|
||||
*
|
||||
* Return a PinMap array of pins that support Serial RX. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *serial_rx_pinmap(void);
|
||||
|
||||
/** Get the pins that support Serial CTS
|
||||
*
|
||||
* Return a PinMap array of pins that support Serial CTS. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *serial_cts_pinmap(void);
|
||||
|
||||
/** Get the pins that support Serial RTS
|
||||
*
|
||||
* Return a PinMap array of pins that support Serial RTS. The
|
||||
* array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *serial_rts_pinmap(void);
|
||||
|
||||
#if DEVICE_SERIAL_ASYNCH
|
||||
|
||||
/**@}*/
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define MBED_SPI_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "pinmap.h"
|
||||
#include "hal/dma_api.h"
|
||||
#include "hal/buffer.h"
|
||||
|
||||
|
@ -173,6 +174,78 @@ int spi_busy(spi_t *obj);
|
|||
*/
|
||||
uint8_t spi_get_module(spi_t *obj);
|
||||
|
||||
/** Get the pins that support SPI MOSI
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI MOSI in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_master_mosi_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI MISO
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI MISO in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_master_miso_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI CLK
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI CLK in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_master_clk_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI CS
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI CS in
|
||||
* master mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_master_cs_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI MOSI
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI MOSI in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_slave_mosi_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI MISO
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI MISO in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_slave_miso_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI CLK
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI CLK in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_slave_clk_pinmap(void);
|
||||
|
||||
/** Get the pins that support SPI CS
|
||||
*
|
||||
* Return a PinMap array of pins that support SPI CS in
|
||||
* slave mode. The array is terminated with {NC, NC, 0}.
|
||||
*
|
||||
* @return PinMap array
|
||||
*/
|
||||
const PinMap *spi_slave_cs_pinmap(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
|
|
|
@ -112,3 +112,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -587,3 +587,23 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
|
|
@ -382,3 +382,34 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
|
|||
{
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -331,3 +331,43 @@ int spi_busy(spi_t *obj)
|
|||
{
|
||||
return ssp_busy(obj);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -145,4 +145,9 @@ float analogin_read(analogin_t *obj)
|
|||
return (float)((result & ADC_RESOLUTION) * 1.0f) / ADC_DIV;
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -506,3 +506,23 @@ int i2c_slave_write(i2c_t *obj, const char *data, int length) {
|
|||
|
||||
void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
|
|
@ -328,3 +328,35 @@ void serial_break_clear(serial_t *obj) {
|
|||
void serial_set_flow_control(serial_t *obj, FlowControl type,
|
||||
PinName rxflow, PinName txflow) {
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -284,3 +284,43 @@ uint8_t spi_get_module(spi_t *obj) {
|
|||
int spi_busy(spi_t *obj) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -151,3 +151,8 @@ float analogin_read(analogin_t *obj)
|
|||
|
||||
return (result * (1. / MAXIMUM_VALUE_12_BITS));
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -271,3 +271,23 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
|
||||
return ack;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
|
|
@ -391,3 +391,34 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow,
|
|||
error("serial_set_flow_control function not supported");
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -263,3 +263,43 @@ int spi_busy(spi_t *obj)
|
|||
int32_t status = spi_pl022_get_status(obj->spi);
|
||||
return (status & SPI_PL022_SSPSR_BSY_MSK);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -108,3 +108,7 @@ uint16_t analogin_read_u16(analogin_t *obj) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -521,3 +521,23 @@ int i2c_byte_read(i2c_t *obj, int last) {
|
|||
int i2c_byte_write(i2c_t *obj, int data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
|
|
@ -365,3 +365,35 @@ void serial_break_clear(serial_t *obj) {
|
|||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) {
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,3 +299,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
int spi_busy(spi_t *obj) {
|
||||
return ssp_busy(obj);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -108,3 +108,7 @@ uint16_t analogin_read_u16(analogin_t *obj) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -531,3 +531,23 @@ int i2c_byte_read(i2c_t *obj, int last) {
|
|||
int i2c_byte_write(i2c_t *obj, int data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
|
|
@ -370,3 +370,35 @@ void serial_break_clear(serial_t *obj) {
|
|||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) {
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,3 +299,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
int spi_busy(spi_t *obj) {
|
||||
return ssp_busy(obj);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -186,6 +186,11 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
return( (uint16_t)( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
||||
/* Retrieve the active channel corresponding to the input pin */
|
||||
static uint32_t adi_pin2channel(PinName pin)
|
||||
{
|
||||
|
|
|
@ -221,4 +221,24 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
#endif // #if DEVICE_I2C
|
||||
|
|
|
@ -292,4 +292,36 @@ void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id)
|
|||
irq_handler = handler;
|
||||
serial_irq_ids[0] = id;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -367,4 +367,44 @@ int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, cha
|
|||
}
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -186,6 +186,11 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
return( (uint16_t)( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
||||
/* Retrieve the active channel corresponding to the input pin */
|
||||
static uint32_t adi_pin2channel(PinName pin)
|
||||
{
|
||||
|
|
|
@ -221,4 +221,24 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
#endif // #if DEVICE_I2C
|
||||
|
|
|
@ -248,4 +248,36 @@ void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id)
|
|||
serial_irq_ids[obj->index] = id;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -342,4 +342,44 @@ int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, cha
|
|||
}
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -108,3 +108,8 @@ uint16_t analogout_read_u16(dac_t *obj)
|
|||
uint32_t data_val = data_reg_read(obj);
|
||||
return (uint16_t)((data_val / (float)MAX_VAL_10BIT) * 0xFFFF); /*Normalization to the value 0xFFFF*/
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
|
|
@ -108,3 +108,8 @@ uint16_t analogout_read_u16(dac_t *obj)
|
|||
uint32_t data_val = data_reg_read(obj);
|
||||
return (uint16_t)((data_val / (float)MAX_VAL_10BIT) * 0xFFFF); /*Normalization to the value 0xFFFF*/
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
|
|
@ -114,3 +114,9 @@ uint16_t analogout_read_u16(dac_t *obj)
|
|||
uint32_t data_val = data_reg_read(obj);
|
||||
return (uint16_t)((data_val / (float)MAX_VAL_12BIT) * 0xFFFF); /*Normalization to the value 0xFFFF*/
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -225,3 +225,7 @@ float analogin_read(analogin_t *obj)
|
|||
return (float)value * (1.0f / (float)0xFFFF);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -573,6 +573,26 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
|
||||
|
|
|
@ -300,3 +300,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
/* This call updates pulse width as well as period */
|
||||
pwmout_write(obj, duty_cycle);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
|
|
@ -823,6 +823,26 @@ int serial_writable(serial_t *obj)
|
|||
return status;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* ASYNCHRONOUS HAL *
|
||||
************************************************************************************/
|
||||
|
|
|
@ -667,6 +667,46 @@ uint8_t spi_get_module(spi_t *obj)
|
|||
return _sercom_get_sercom_inst_index(pSPI_SERCOM(obj));
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SERCOM_PAD;
|
||||
}
|
||||
|
||||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
/**
|
||||
|
|
|
@ -64,3 +64,8 @@ float analogin_read(analogin_t *obj)
|
|||
uint16_t value = analogin_read_u16(obj);
|
||||
return (float)value * (1.0f / (float)0xFFFF);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -425,6 +425,26 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return ACK;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
|
|
|
@ -305,3 +305,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
float new_duty = (us / 1000000.0) * (float)obj->waveconfig.us_frequency;
|
||||
pwmout_write(obj, new_duty);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
|
|
@ -579,6 +579,26 @@ int serial_writable(serial_t *obj)
|
|||
return status;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* ASYNCHRONOUS HAL *
|
||||
************************************************************************************/
|
||||
|
|
|
@ -371,6 +371,46 @@ uint8_t spi_get_module(spi_t *obj)
|
|||
return obj->spi.module_number;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
|
||||
/**@}*/
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
|
|
|
@ -205,5 +205,10 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
return (uint16_t)(result);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
||||
#endif // DEVICE_ANALOGIN
|
||||
|
||||
|
|
|
@ -159,5 +159,10 @@ uint16_t analogout_read_u16(dac_t *obj)
|
|||
return value;
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
||||
#endif // DEVICE_ANALOGIN
|
||||
|
||||
|
|
|
@ -500,6 +500,26 @@ int i2c_byte_write(i2c_t *obj_in, int data)
|
|||
}
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
#if DEVICE_I2C_ASYNCH
|
||||
|
||||
void i2c_transfer_asynch(i2c_t *obj_in,
|
||||
|
|
|
@ -339,3 +339,8 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
|
|||
}
|
||||
pwm_start(obj, obj->period, us);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM_OUT;
|
||||
}
|
||||
|
|
|
@ -695,6 +695,25 @@ void serial_set_flow_control(serial_t *obj_in, FlowControl type, PinName rxflow,
|
|||
serial_init_peripheral(obj);
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#if DEVICE_SERIAL_ASYNCH
|
||||
|
||||
|
|
|
@ -505,6 +505,46 @@ uint8_t spi_get_module(spi_t *obj_in)
|
|||
return (uint8_t) OBJ_P(obj_in)->spi_id;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#if (DEVICE_SPI_ASYNCH)
|
||||
|
||||
void spi_master_transfer(spi_t *obj_in,
|
||||
|
|
|
@ -167,5 +167,10 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
return (uint16_t)(result);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
||||
#endif // DEVICE_ANALOGIN
|
||||
|
||||
|
|
|
@ -146,5 +146,10 @@ uint16_t analogout_read_u16(dac_t *obj)
|
|||
return value;
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
||||
#endif // DEVICE_ANALOGIN
|
||||
|
||||
|
|
|
@ -445,6 +445,26 @@ int i2c_byte_write(i2c_t *obj_in, int data)
|
|||
}
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
#if DEVICE_I2C_ASYNCH
|
||||
|
||||
void i2c_transfer_asynch(i2c_t *obj_in,
|
||||
|
|
|
@ -319,3 +319,8 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
|
|||
}
|
||||
pwm_start(obj, obj->period, us);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM_OUT;
|
||||
}
|
||||
|
|
|
@ -589,6 +589,26 @@ void serial_set_flow_control(serial_t *obj_in, FlowControl type, PinName rxflow,
|
|||
serial_init_flow_pins(obj);
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#if DEVICE_SERIAL_ASYNCH
|
||||
|
||||
void serial_irq_handler(serial_t *obj_in, uart_irq_handler handler, uint32_t id)
|
||||
|
|
|
@ -535,6 +535,46 @@ uint8_t spi_get_module(spi_t *obj_in)
|
|||
return (uint8_t) OBJ_P(obj_in)->spi_id;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
|
||||
void spi_master_transfer(spi_t *obj_in,
|
||||
|
|
|
@ -76,3 +76,8 @@ float analogin_read(analogin_t *obj) {
|
|||
uint16_t value = analogin_read_u16(obj);
|
||||
return (float)value * (1.0f / (float)0xFFFF);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -81,4 +81,9 @@ uint16_t analogout_read_u16(dac_t *obj) {
|
|||
return (value << 4) | ((value >> 8) & 0x003F);
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -285,6 +285,26 @@ int i2c_byte_write(i2c_t *obj, int data) {
|
|||
return !i2c_do_write(obj, (data & 0xFF));
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
void i2c_slave_mode(i2c_t *obj, int enable_slave) {
|
||||
|
|
|
@ -117,3 +117,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
|
|||
*obj->CnV = (uint32_t)(pwm_clock * (float)us);
|
||||
*obj->SYNC |= FTM_SYNC_SWSYNC_MASK;
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
|
|
@ -299,3 +299,35 @@ void serial_break_set(serial_t *obj) {
|
|||
void serial_break_clear(serial_t *obj) {
|
||||
obj->uart->C2 &= ~UART_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -167,3 +167,43 @@ int spi_slave_read(spi_t *obj) {
|
|||
void spi_slave_write(spi_t *obj, int value) {
|
||||
while (!spi_writeable(obj));
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -293,3 +293,34 @@ void serial_break_clear(serial_t *obj) {
|
|||
obj->uart->C2 &= ~UARTLP_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -168,3 +168,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
while (!spi_writeable(obj));
|
||||
obj->spi->D = value;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -303,3 +303,35 @@ void serial_break_set(serial_t *obj) {
|
|||
void serial_break_clear(serial_t *obj) {
|
||||
obj->uart->C2 &= ~UARTLP_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -147,3 +147,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
while (!spi_writeable(obj));
|
||||
obj->spi->D = value;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -303,3 +303,35 @@ void serial_break_set(serial_t *obj) {
|
|||
void serial_break_clear(serial_t *obj) {
|
||||
obj->uart->C2 &= ~UARTLP_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -239,3 +239,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -303,3 +303,35 @@ void serial_break_set(serial_t *obj) {
|
|||
void serial_break_clear(serial_t *obj) {
|
||||
obj->uart->C2 &= ~UARTLP_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
|
|
@ -239,3 +239,43 @@ void spi_slave_write(spi_t *obj, int value) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
|
|
@ -85,3 +85,7 @@ float analogin_read(analogin_t *obj) {
|
|||
return (float)value * (1.0f / (float)0xFFFF);
|
||||
}
|
||||
|
||||
const PinMap *analogin_pinmap()
|
||||
{
|
||||
return PinMap_ADC;
|
||||
}
|
||||
|
|
|
@ -78,3 +78,8 @@ uint16_t analogout_read_u16(dac_t *obj) {
|
|||
uint32_t value = dac_read(obj); // 12-bit
|
||||
return (value << 4) | ((value >> 8) & 0x003F);
|
||||
}
|
||||
|
||||
const PinMap *analogout_pinmap()
|
||||
{
|
||||
return PinMap_DAC;
|
||||
}
|
||||
|
|
|
@ -291,6 +291,26 @@ int i2c_byte_write(i2c_t *obj, int data) {
|
|||
return !i2c_do_write(obj, (data & 0xFF));
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_master_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_sda_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SDA;
|
||||
}
|
||||
|
||||
const PinMap *i2c_slave_scl_pinmap()
|
||||
{
|
||||
return PinMap_I2C_SCL;
|
||||
}
|
||||
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
void i2c_slave_mode(i2c_t *obj, int enable_slave) {
|
||||
|
|
|
@ -123,3 +123,8 @@ void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
|
|||
void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
|
||||
*obj->CnV = (uint32_t)(pwm_clock * (float)us);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
|
|
@ -150,4 +150,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
FTM_SetSoftwareTrigger(base, true);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -320,4 +320,24 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
|
|||
}
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -157,4 +157,44 @@ void spi_slave_write(spi_t *obj, int value)
|
|||
DSPI_SlaveWriteDataBlocking(spi_address[obj->instance], (uint32_t)value);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,4 +150,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
FTM_SetSoftwareTrigger(base, true);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -312,4 +312,24 @@ void serial_break_clear(serial_t *obj)
|
|||
uart_addrs[obj->index]->CTRL &= ~LPUART_CTRL_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -153,4 +153,44 @@ void spi_slave_write(spi_t *obj, int value)
|
|||
DSPI_SlaveWriteDataBlocking(spi_address[obj->instance], (uint32_t)value);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -145,4 +145,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
base->CONTROLS[obj->pwm_name & 0xF].CnV = value;
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -268,4 +268,24 @@ void serial_break_clear(serial_t *obj)
|
|||
uart_addrs[obj->index]->CTRL &= ~LPUART_CTRL_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,4 +152,44 @@ void spi_slave_write(spi_t *obj, int value)
|
|||
SPI_WriteBlocking(spi_address[obj->instance], (uint8_t *)&value, size);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -145,4 +145,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
base->CONTROLS[obj->pwm_name & 0xF].CnV = value;
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -268,4 +268,36 @@ void serial_break_clear(serial_t *obj)
|
|||
uart_addrs[obj->index]->CTRL &= ~LPUART_CTRL_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,4 +152,44 @@ void spi_slave_write(spi_t *obj, int value)
|
|||
SPI_WriteBlocking(spi_address[obj->instance], (uint8_t *)&value, size);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -146,4 +146,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
base->CONTROLS[obj->pwm_name & 0xF].CnV = value;
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -296,4 +296,36 @@ void serial_break_clear(serial_t *obj)
|
|||
uart_addrs[obj->index]->CTRL &= ~LPUART_CTRL_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_CTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
#if !DEVICE_SERIAL_FC
|
||||
static const PinMap PinMap_UART_RTS[] = {
|
||||
{NC, NC, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -152,4 +152,44 @@ void spi_slave_write(spi_t *obj, int value)
|
|||
DSPI_SlaveWriteDataBlocking(spi_address[obj->instance], (uint32_t)value);
|
||||
}
|
||||
|
||||
const PinMap *spi_master_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_master_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_mosi_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MOSI;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_miso_pinmap()
|
||||
{
|
||||
return PinMap_SPI_MISO;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_clk_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SCLK;
|
||||
}
|
||||
|
||||
const PinMap *spi_slave_cs_pinmap()
|
||||
{
|
||||
return PinMap_SPI_SSEL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,4 +150,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
|||
FTM_SetSoftwareTrigger(base, true);
|
||||
}
|
||||
|
||||
const PinMap *pwmout_pinmap()
|
||||
{
|
||||
return PinMap_PWM;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -270,6 +270,26 @@ void serial_break_clear(serial_t *obj)
|
|||
uart_addrs[obj->index]->C2 &= ~UART_C2_SBK_MASK;
|
||||
}
|
||||
|
||||
const PinMap *serial_tx_pinmap()
|
||||
{
|
||||
return PinMap_UART_TX;
|
||||
}
|
||||
|
||||
const PinMap *serial_rx_pinmap()
|
||||
{
|
||||
return PinMap_UART_RX;
|
||||
}
|
||||
|
||||
const PinMap *serial_cts_pinmap()
|
||||
{
|
||||
return PinMap_UART_CTS;
|
||||
}
|
||||
|
||||
const PinMap *serial_rts_pinmap()
|
||||
{
|
||||
return PinMap_UART_RTS;
|
||||
}
|
||||
|
||||
#if DEVICE_SERIAL_FC
|
||||
|
||||
/*
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue