From b6f98a2d467ef447b6eb385567cc37be988d1d76 Mon Sep 17 00:00:00 2001 From: keeramis Date: Thu, 4 Aug 2022 00:10:14 -0500 Subject: [PATCH] Address review comments --- dynalib/inc/dynalib.h | 2 +- hal/shared/demux.cpp | 6 +++--- hal/shared/demux.h | 3 ++- hal/src/tron/hal_platform_config.h | 1 + platform/MCU/rtl872x/inc/platform_config.h | 8 ++------ 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/dynalib/inc/dynalib.h b/dynalib/inc/dynalib.h index 357eb102be..7380c9d7ad 100644 --- a/dynalib/inc/dynalib.h +++ b/dynalib/inc/dynalib.h @@ -125,7 +125,7 @@ constexpr T2* dynalib_checked_cast(T2 *p) { #define __S(x) #x #define __SX(x) __S(x) - #if HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION + #if PLATFORM_ID == 32 || PLATFORM_ID == 28 #define DYNALIB_FN_IMPORT(index, tablename, name, counter) \ DYNALIB_STATIC_ASSERT(index == counter, "Index of the dynamically exported function has changed"); \ const char check_name_##tablename_##name[0]={}; /* this will fail if the name is already defined */ \ diff --git a/hal/shared/demux.cpp b/hal/shared/demux.cpp index 863cbb47e0..5fac3861a6 100644 --- a/hal/shared/demux.cpp +++ b/hal/shared/demux.cpp @@ -64,9 +64,9 @@ int Demux::write(uint8_t pin, uint8_t value) { #if HAL_PLATFORM_NRF52840 nrf_gpio_port_out_set(DEMUX_NRF_PORT, ((uint32_t)pin) << DEMUX_PINS_SHIFT); #elif HAL_PLATFORM_RTL872X - hal_gpio_write(DEMUX_C, pin >> 2); - hal_gpio_write(DEMUX_B, (pin >> 1) & 1); - hal_gpio_write(DEMUX_A, pin & 1); + hal_gpio_write(DEMUX_C, (pin & DEMUX_PIN_2_MASK) ? 1 : 0); + hal_gpio_write(DEMUX_B, (pin & DEMUX_PIN_1_MASK) ? 1 : 0); + hal_gpio_write(DEMUX_A, (pin & DEMUX_PIN_0_MASK) ? 1 : 0); #endif setPinValue(pin, 0); } diff --git a/hal/shared/demux.h b/hal/shared/demux.h index 8ca5687c53..5b180e93a9 100644 --- a/hal/shared/demux.h +++ b/hal/shared/demux.h @@ -33,11 +33,12 @@ #define DEMUX_MAX_PIN_COUNT 8 #if HAL_PLATFORM_NRF52840 #define DEMUX_NRF_PORT (NRF_P1) +#endif #define DEMUX_PIN_0_MASK 0x00000400 #define DEMUX_PIN_1_MASK 0x00000800 #define DEMUX_PIN_2_MASK 0x00001000 #define DEMUX_PINS_SHIFT (10) -#endif + namespace particle { diff --git a/hal/src/tron/hal_platform_config.h b/hal/src/tron/hal_platform_config.h index 5c20d01a3b..3b42735c38 100644 --- a/hal/src/tron/hal_platform_config.h +++ b/hal/src/tron/hal_platform_config.h @@ -15,6 +15,7 @@ #define HAL_PLATFORM_USART_NUM (3) #define HAL_PLATFORM_NCP_COUNT (1) #define HAL_PLATFORM_BROKEN_MTU (1) +#define HAL_PLATFORM_WIFI (1) #define HAL_PLATFORM_WIFI_COMPAT (1) #define HAL_PLATFORM_RADIO_ANTENNA_INTERNAL (1) diff --git a/platform/MCU/rtl872x/inc/platform_config.h b/platform/MCU/rtl872x/inc/platform_config.h index 8ca53d4e1b..2e656c9fef 100644 --- a/platform/MCU/rtl872x/inc/platform_config.h +++ b/platform/MCU/rtl872x/inc/platform_config.h @@ -47,12 +47,8 @@ #define SYSTICK_IRQ_PRIORITY 7 //CORTEX_M33 Systick Interrupt -#if HAL_PLATFORM_RTL872X - #define INTERNAL_FLASH_SIZE (0x800000) -#else - #pragma message "PLATFORM_ID is " PREPSTRING(PLATFORM_ID) - #error "Unknown PLATFORM_ID" -#endif +// Currently works with platforms P2 and TrackerM +#define INTERNAL_FLASH_SIZE (0x800000) //Push Buttons, use interrupt HAL #define BUTTON1_PIN BTN