Skip to content

Commit c7a1946

Browse files
committed
Add pinmaps to Ameba
Add testing pinmaps to the Ameba along with fixing build errors.
1 parent 8d205ab commit c7a1946

File tree

6 files changed

+96
-8
lines changed

6 files changed

+96
-8
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/PeripheralPins.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ extern "C" {
2626
// for spi_api.c
2727
extern const PinMap PinMap_SSI_MOSI[];
2828
extern const PinMap PinMap_SSI_MISO[];
29+
extern const PinMap PinMap_SSI_SCLK[];
30+
extern const PinMap PinMap_SSI_SSEL[];
2931

3032
// for serial_api.c
3133
extern const PinMap PinMap_UART_TX[];
@@ -38,6 +40,12 @@ extern const PinMap PinMap_PWM[];
3840
extern const PinMap PinMap_I2C_SDA[];
3941
extern const PinMap PinMap_I2C_SCL[];
4042

43+
// for analogin_api.c
44+
extern const PinMap PinMap_ADC[];
45+
46+
// for analogout_api.c
47+
extern const PinMap PinMap_DAC[];
48+
4149
#ifdef __cplusplus
4250
}
4351
#endif

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/TARGET_RTL8195A/PeripheralPins.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,31 @@ const PinMap PinMap_SSI_MISO[] = {
4141
{NC, NC, 0}
4242
};
4343

44+
// For testing only
45+
const PinMap PinMap_SSI_SCLK[] = {
46+
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
47+
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
48+
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
49+
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
50+
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
51+
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
52+
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
53+
54+
{NC, NC, 0}
55+
};
56+
57+
// For testing only
58+
const PinMap PinMap_SSI_SSEL[] = {
59+
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
60+
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
61+
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
62+
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
63+
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
64+
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
65+
66+
{NC, NC, 0}
67+
};
68+
4469
// for serial_api.c
4570
const PinMap PinMap_UART_TX[] = {
4671
{PC_3, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
@@ -139,3 +164,19 @@ const PinMap PinMap_I2C_SCL[] = {
139164

140165
{NC, NC, 0}
141166
};
167+
168+
// For testing only
169+
const PinMap PinMap_ADC[] = {
170+
{A1, /* Unused */ 0, /* Unused */ 0},
171+
{A2, /* Unused */ 0, /* Unused */ 0},
172+
173+
{NC, NC, 0}
174+
};
175+
176+
// For testing only
177+
const PinMap PinMap_DAC[] = {
178+
{DA_0, /* Unused */ 0, /* Unused */ 0},
179+
{DA_1, /* Unused */ 0, /* Unused */ 0},
180+
181+
{NC, NC, 0}
182+
};

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/analogin_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PinNames.h"
1919
#include "hal_adc.h"
2020
#include "analogin_api.h"
21+
#include "PeripheralPins.h"
2122

2223
#ifdef CONFIG_MBED_ENABLED
2324
#include "platform_stdlib.h"

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/analogout_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "cmsis.h"
2323
#include "pinmap.h"
24+
#include "PeripheralPins.h"
2425
#include <string.h>
2526

2627
#define DAC_POSITIVE_FULL_SCALE 0x7E0

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/serial_api.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,23 @@ const PinMap *serial_rx_pinmap()
542542

543543
const PinMap *serial_cts_pinmap()
544544
{
545+
#if !DEVICE_SERIAL_FC
546+
static const PinMap PinMap_UART_CTS[] = {
547+
{NC, NC, 0}
548+
};
549+
#endif
550+
545551
return PinMap_UART_CTS;
546552
}
547553

548554
const PinMap *serial_rts_pinmap()
549555
{
556+
#if !DEVICE_SERIAL_FC
557+
static const PinMap PinMap_UART_RTS[] = {
558+
{NC, NC, 0}
559+
};
560+
#endif
561+
550562
return PinMap_UART_RTS;
551563
}
552564

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/spi_api.c

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,31 @@ static const PinMap PinMap_SSI_MISO[] = {
6767
{PD_3, RTL_PIN_PERI(SPI2, 2, S2), RTL_PIN_FUNC(SPI2, S2)},
6868
{NC, NC, 0}
6969
};
70+
71+
// For testing only
72+
static const PinMap PinMap_SSI_SCLK[] = {
73+
{PC_1, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
74+
{PA_2, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
75+
{PA_2, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
76+
{PA_2, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
77+
{PD_5, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
78+
{PD_5, RTL_PIN_PERI(SPI1, 1, S1), /* Unused */ 0},
79+
{PD_5, RTL_PIN_PERI(SPI1, 1, S2), /* Unused */ 0},
80+
81+
{NC, NC, 0}
82+
};
83+
84+
// For testing only
85+
static const PinMap PinMap_SSI_SSEL[] = {
86+
{PE_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
87+
{PC_5, RTL_PIN_PERI(SPI0, 0, S2), /* Unused */ 0},
88+
{PC_4, RTL_PIN_PERI(SPI0, 0, S1), /* Unused */ 0},
89+
{PC_0, RTL_PIN_PERI(SPI0, 0, S0), /* Unused */ 0},
90+
{PA_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
91+
{PD_4, RTL_PIN_PERI(SPI1, 1, S0), /* Unused */ 0},
92+
93+
{NC, NC, 0}
94+
};
7095
#endif
7196

7297
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)
375400

376401
const PinMap *spi_master_mosi_pinmap()
377402
{
378-
return PinMap_SPI_MOSI;
403+
return PinMap_SSI_MOSI;
379404
}
380405

381406
const PinMap *spi_master_miso_pinmap()
382407
{
383-
return PinMap_SPI_MISO;
408+
return PinMap_SSI_MISO;
384409
}
385410

386411
const PinMap *spi_master_clk_pinmap()
387412
{
388-
return PinMap_SPI_SCLK;
413+
return PinMap_SSI_SCLK;
389414
}
390415

391416
const PinMap *spi_master_cs_pinmap()
392417
{
393-
return PinMap_SPI_SSEL;
418+
return PinMap_SSI_SSEL;
394419
}
395420

396421
const PinMap *spi_slave_mosi_pinmap()
397422
{
398-
return PinMap_SPI_MOSI;
423+
return PinMap_SSI_MOSI;
399424
}
400425

401426
const PinMap *spi_slave_miso_pinmap()
402427
{
403-
return PinMap_SPI_MISO;
428+
return PinMap_SSI_MISO;
404429
}
405430

406431
const PinMap *spi_slave_clk_pinmap()
407432
{
408-
return PinMap_SPI_SCLK;
433+
return PinMap_SSI_SCLK;
409434
}
410435

411436
const PinMap *spi_slave_cs_pinmap()
412437
{
413-
return PinMap_SPI_SSEL;
438+
return PinMap_SSI_SSEL;
414439
}
415440

0 commit comments

Comments
 (0)