Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Aug 4, 2022
1 parent 7706293 commit cea631c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dynalib/inc/dynalib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ \
Expand Down
6 changes: 3 additions & 3 deletions hal/shared/demux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion hal/shared/demux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
11 changes: 3 additions & 8 deletions hal/src/trackerm/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ int if_init_platform(void*) {
((PppNcpNetif*)pp3)->setCellularManager(cellularNetworkManager());
((PppNcpNetif*)pp3)->init();
}

/* TODO: wl4 - ESP32 NCP Access Point */
reserve_netif_index();
reserve_netif_index();
(void)wl4;

reserve_netif_index(); // wl4 - NETWORK_INTERFACE_WIFI_STA = 5
reserve_netif_index(); // wl5 - NETWORK_INTERFACE_WIFI_AP = 6

auto m = mallinfo();
const size_t total = m.uordblks + m.fordblks;
LOG(TRACE, "Heap: %lu/%lu Kbytes used", m.uordblks / 1000, total / 1000);
Expand All @@ -211,8 +211,6 @@ struct netif* lwip_hook_ip4_route_src(const ip4_addr_t* src, const ip4_addr_t* d
if (src == nullptr) {
if (en2 && netifCanForwardIpv4(en2->interface())) {
return en2->interface();
} else if (wl3 && netifCanForwardIpv4(wl3->interface())) {
return wl3->interface();
} else if (pp3 && netifCanForwardIpv4(pp3->interface())) {
return pp3->interface();
}
Expand All @@ -236,9 +234,6 @@ unsigned char* rltk_wlan_get_gwmask(int idx) {
void rltk_wlan_set_netif_info(int idx_wlan, void* dev, unsigned char* dev_addr) {
LOG(INFO, "rltk_wlan_set_netif_info: %d, %02x:%02x:%02x:%02x:%02x:%02x", idx_wlan,
dev_addr[0], dev_addr[1], dev_addr[2], dev_addr[3], dev_addr[4], dev_addr[5]);
if (wl3) {
memcpy(wl3->interface()->hwaddr, dev_addr, sizeof(wl3->interface()->hwaddr));
}
}

void netif_rx(int idx, unsigned int len) {
Expand Down
1 change: 1 addition & 0 deletions hal/src/tron/hal_platform_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 2 additions & 6 deletions platform/MCU/rtl872x/inc/platform_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cea631c

Please sign in to comment.