Add pinmaps to Ameba

Add testing pinmaps to the Ameba along with fixing build errors.
pull/9449/head
Russ Butler 2019-02-01 14:51:11 -06:00
parent 8d205ab430
commit c7a19461b4
6 changed files with 96 additions and 8 deletions

View File

@ -26,6 +26,8 @@ extern "C" {
// for spi_api.c
extern const PinMap PinMap_SSI_MOSI[];
extern const PinMap PinMap_SSI_MISO[];
extern const PinMap PinMap_SSI_SCLK[];
extern const PinMap PinMap_SSI_SSEL[];
// for serial_api.c
extern const PinMap PinMap_UART_TX[];
@ -38,6 +40,12 @@ extern const PinMap PinMap_PWM[];
extern const PinMap PinMap_I2C_SDA[];
extern const PinMap PinMap_I2C_SCL[];
// for analogin_api.c
extern const PinMap PinMap_ADC[];
// for analogout_api.c
extern const PinMap PinMap_DAC[];
#ifdef __cplusplus
}
#endif

View File

@ -41,6 +41,31 @@ const PinMap PinMap_SSI_MISO[] = {
{NC, NC, 0}
};
// For testing only
const PinMap PinMap_SSI_SCLK[] = {
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
{NC, NC, 0}
};
// For testing only
const PinMap PinMap_SSI_SSEL[] = {
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{NC, NC, 0}
};
// for serial_api.c
const PinMap PinMap_UART_TX[] = {
{PC_3, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
@ -139,3 +164,19 @@ const PinMap PinMap_I2C_SCL[] = {
{NC, NC, 0}
};
// For testing only
const PinMap PinMap_ADC[] = {
{A1, /* Unused */ 0, /* Unused */ 0},
{A2, /* Unused */ 0, /* Unused */ 0},
{NC, NC, 0}
};
// For testing only
const PinMap PinMap_DAC[] = {
{DA_0, /* Unused */ 0, /* Unused */ 0},
{DA_1, /* Unused */ 0, /* Unused */ 0},
{NC, NC, 0}
};

View File

@ -18,6 +18,7 @@
#include "PinNames.h"
#include "hal_adc.h"
#include "analogin_api.h"
#include "PeripheralPins.h"
#ifdef CONFIG_MBED_ENABLED
#include "platform_stdlib.h"

View File

@ -21,6 +21,7 @@
#include "cmsis.h"
#include "pinmap.h"
#include "PeripheralPins.h"
#include <string.h>
#define DAC_POSITIVE_FULL_SCALE 0x7E0

View File

@ -542,11 +542,23 @@ const PinMap *serial_rx_pinmap()
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;
}

View File

@ -67,6 +67,31 @@ static const PinMap PinMap_SSI_MISO[] = {
{PD_3, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
{NC, NC, 0}
};
// For testing only
static const PinMap PinMap_SSI_SCLK[] = {
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
{NC, NC, 0}
};
// For testing only
static const PinMap PinMap_SSI_SSEL[] = {
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
{NC, NC, 0}
};
#endif
void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
@ -375,41 +400,41 @@ void spi_rx_done_callback(VOID *obj)
const PinMap *spi_master_mosi_pinmap()
{
return PinMap_SPI_MOSI;
return PinMap_SSI_MOSI;
}
const PinMap *spi_master_miso_pinmap()
{
return PinMap_SPI_MISO;
return PinMap_SSI_MISO;
}
const PinMap *spi_master_clk_pinmap()
{
return PinMap_SPI_SCLK;
return PinMap_SSI_SCLK;
}
const PinMap *spi_master_cs_pinmap()
{
return PinMap_SPI_SSEL;
return PinMap_SSI_SSEL;
}
const PinMap *spi_slave_mosi_pinmap()
{
return PinMap_SPI_MOSI;
return PinMap_SSI_MOSI;
}
const PinMap *spi_slave_miso_pinmap()
{
return PinMap_SPI_MISO;
return PinMap_SSI_MISO;
}
const PinMap *spi_slave_clk_pinmap()
{
return PinMap_SPI_SCLK;
return PinMap_SSI_SCLK;
}
const PinMap *spi_slave_cs_pinmap()
{
return PinMap_SPI_SSEL;
return PinMap_SSI_SSEL;
}