diff --git a/Arduino_package/hardware/libraries/SPI/src/SPI.cpp b/Arduino_package/hardware/libraries/SPI/src/SPI.cpp index 2e6c5f46..87f04832 100644 --- a/Arduino_package/hardware/libraries/SPI/src/SPI.cpp +++ b/Arduino_package/hardware/libraries/SPI/src/SPI.cpp @@ -44,7 +44,7 @@ SPIClass::SPIClass(void *pSpiObj, int mosi, int miso, int clk, int ss) pinUserSS = -1; initStatus = false; dataBits = 8; // default databits is 8 bits - dataMode = SPI_MODE0; // default datamode is mode 0 + dataMode = SPI_DATA_MODE0; // default datamode is mode 0 #if defined(BOARD_RTL8721DM) defaultFrequency = 2000000; @@ -52,7 +52,7 @@ SPIClass::SPIClass(void *pSpiObj, int mosi, int miso, int clk, int ss) defaultFrequency = 20000000; #endif - SPI_Mode = 'master'; + SPI_Mode = SPI_MODE_MASTER; } void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) { @@ -132,11 +132,11 @@ void SPIClass::begin(int ss) { initStatus = true; } -void begin(char mode) { +void SPIClass::begin(char mode) { SPI_Mode = mode; - if (SPI_Mode == 'master') { + if (SPI_Mode == SPI_MODE_MASTER) { begin(); - } else if (SPI_Mode == 'slave') { + } else if (SPI_Mode == SPI_MODE_SLAVE) { if (pinMOSI == PA_16 || pinMOSI == PB_18) { ((spi_t *)pSpiMaster)->spi_idx = MBED_SPI0; } else if (pinMOSI == PA_12 || pinMOSI == PB_4) { @@ -166,11 +166,11 @@ void begin(char mode) { } } -void begin(int ss, char mode) { +void SPIClass::begin(int ss, char mode) { SPI_Mode = mode; - if (SPI_Mode == 'master') { + if (SPI_Mode == SPI_MODE_MASTER) { begin(ss); - } else if (SPI_Mode == 'slave') { + } else if (SPI_Mode == SPI_MODE_SLAVE) { pinSS = (PinName)g_APinDescription[ss].pinname; if (pinMOSI == PA_16 || pinMOSI == PB_18) { diff --git a/Arduino_package/hardware/libraries/SPI/src/SPI.h b/Arduino_package/hardware/libraries/SPI/src/SPI.h index af85d7dc..9a14c7d8 100644 --- a/Arduino_package/hardware/libraries/SPI/src/SPI.h +++ b/Arduino_package/hardware/libraries/SPI/src/SPI.h @@ -34,10 +34,13 @@ // - beginTransaction(pin, SPISettings settings) (if transactions are available) #define SPI_HAS_EXTENDED_CS_PIN_HANDLING 1 -#define SPI_MODE0 0x00 -#define SPI_MODE1 0x01 -#define SPI_MODE2 0x02 -#define SPI_MODE3 0x03 +#define SPI_DATA_MODE0 0x00 +#define SPI_DATA_MODE1 0x01 +#define SPI_DATA_MODE2 0x02 +#define SPI_DATA_MODE3 0x03 + +#define SPI_MODE_MASTER 'M' +#define SPI_MODE_SLAVE 'S' enum SPITransferMode { SPI_CONTINUE, @@ -52,7 +55,7 @@ class SPISettings { _dataMode = dataMode; } SPISettings() { - SPISettings(4000000, MSBFIRST, SPI_MODE0); + SPISettings(4000000, MSBFIRST, SPI_DATA_MODE0); } private: diff --git a/Arduino_package/package_realtek.com_amebad_early_index.json b/Arduino_package/package_realtek.com_amebad_early_index.json index 507cfd79..96636f37 100644 --- a/Arduino_package/package_realtek.com_amebad_early_index.json +++ b/Arduino_package/package_realtek.com_amebad_early_index.json @@ -13,6 +13,42 @@ { "name": "Realtek Ameba Boards (32-bits ARM Cortex-M33 @200MHz)", "architecture": "AmebaD", + "version": "3.1.7-build20230801", + "category": "Contributed", + "help": { + "online": "https://www.amebaiot.com/" + }, + "url": "https://github.com/ambiot/ambd_arduino/raw/dev/Arduino_package/release/ameba_d-3.1.7-build20230801.tar.gz", + "archiveFileName": "ameba_d-3.1.7-build20230801.tar.gz", + "checksum": "SHA-256:2d22b2b78e1963265c5c8a0925224991d39409d682039ee8e4042b9fc155defe", + "size": "15534859", + "boards": [ + {"name": "AMB21 (RTL8722DM)"}, + {"name": "AMB22 (RTL8722CSM)"}, + {"name": "AMB23 (RTL8722DM)"}, + {"name": "BW16 (RTL8720DN)"}, + {"name": "BW16-TypeC (RTL8720DN)"}, + {"name": "AW-CU488 Thing Plus (RTL8721DM)"}, + {"name": "AMB25 (RTL8720DF)"}, + {"name": "AMB26 (RTL8720DF)"}, + {"name": "NORA-W30 (RTL8720DF)"} + ], + "toolsDependencies": [ + { + "packager": "realtek", + "name": "ameba_d_asdk_toolchain", + "version": "1.0.1" + }, + { + "packager": "realtek", + "name": "ameba_d_tools", + "version": "1.1.3" + } + ] + }, + { + "name": "Realtek Ameba Boards (32-bits ARM Cortex-M33 @200MHz)", + "architecture": "AmebaD", "version": "3.1.7-build20230731", "category": "Contributed", "help": { diff --git a/Arduino_package/release/ameba_d-3.1.7-build20230801.tar.gz b/Arduino_package/release/ameba_d-3.1.7-build20230801.tar.gz new file mode 100644 index 00000000..0af0d6be Binary files /dev/null and b/Arduino_package/release/ameba_d-3.1.7-build20230801.tar.gz differ