diff --git a/boards.txt b/boards.txt index c44cf4519..888b076d8 100644 --- a/boards.txt +++ b/boards.txt @@ -584,6 +584,7 @@ nano_matter.menu.link_mode.static.upload.extension=bin-zsk.bin nano_matter.build.zephyr_target=arduino_nano_matter nano_matter.build.zephyr_args= nano_matter.build.zephyr_hals=hal_silabs +nano_matter.build.artifact=zephyr_main nano_matter.build.variant=arduino_nano_matter_mgm240sd22vna nano_matter.build.mcu=cortex-m33 nano_matter.build.fpu=-mfpu=fpv4-sp-d16 diff --git a/libraries/Arduino_LED_Matrix/examples/Reflash_Bootanimation/bootanimation.h b/libraries/Arduino_LED_Matrix/examples/Reflash_Bootanimation/bootanimation.h index 07ba16cf5..4f9e89375 100644 --- a/libraries/Arduino_LED_Matrix/examples/Reflash_Bootanimation/bootanimation.h +++ b/libraries/Arduino_LED_Matrix/examples/Reflash_Bootanimation/bootanimation.h @@ -1,12 +1,12 @@ #include "stdint.h" -__attribute__((packed)) struct bootanimation_user_data { +struct bootanimation_user_data { size_t magic; // must be 0xBA for bootanimation size_t len_loop; size_t len_end; size_t empty; uint8_t *buf_loop; -}; +} __attribute__((packed)); unsigned int bootanimation_end_len = 3120; unsigned int bootanimation_len = 18720; diff --git a/libraries/Arduino_LED_Matrix/library.properties b/libraries/Arduino_LED_Matrix/library.properties index 2673174b0..369769a8b 100644 --- a/libraries/Arduino_LED_Matrix/library.properties +++ b/libraries/Arduino_LED_Matrix/library.properties @@ -7,4 +7,4 @@ paragraph=This library provides a simple interface for controlling the LED matri category=Communication url=https://www.arduino.cc/ architectures=* -depends= +depends=ArduinoGraphics diff --git a/libraries/Arduino_RPClite b/libraries/Arduino_RPClite index 6af013472..a456b874b 160000 --- a/libraries/Arduino_RPClite +++ b/libraries/Arduino_RPClite @@ -1 +1 @@ -Subproject commit 6af013472ca1916083aed46954b98193cb3c39a7 +Subproject commit a456b874b4d8dbd3e781b747864518b78193c51f diff --git a/libraries/Arduino_RouterBridge b/libraries/Arduino_RouterBridge index a5b03a81a..e7d2aee7f 160000 --- a/libraries/Arduino_RouterBridge +++ b/libraries/Arduino_RouterBridge @@ -1 +1 @@ -Subproject commit a5b03a81a6f4684813c3409ca096d8a54e1f7d47 +Subproject commit e7d2aee7ff85db5f489b009cf4669ddf176d5757 diff --git a/libraries/Camera/src/camera.cpp b/libraries/Camera/src/camera.cpp index c8562094c..7288c8b84 100644 --- a/libraries/Camera/src/camera.cpp +++ b/libraries/Camera/src/camera.cpp @@ -31,15 +31,19 @@ uint32_t FrameBuffer::getBufferSize() { if (this->vbuf) { return this->vbuf->bytesused; } + + return 0; } uint8_t *FrameBuffer::getBuffer() { if (this->vbuf) { return this->vbuf->buffer; } + + return NULL; } -Camera::Camera() : vdev(NULL), byte_swap(false), yuv_to_gray(false) { +Camera::Camera() : byte_swap(false), yuv_to_gray(false), vdev(NULL) { for (size_t i = 0; i < ARRAY_SIZE(this->vbuf); i++) { this->vbuf[i] = NULL; } @@ -74,13 +78,13 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt return false; } - for (size_t i = 0; caps.format_caps[i].pixelformat != NULL; i++) { + for (size_t i = 0; caps.format_caps[i].pixelformat != 0; i++) { const struct video_format_cap *fcap = &caps.format_caps[i]; if (fcap->width_min == width && fcap->height_min == height && fcap->pixelformat == pixformat) { break; } - if (caps.format_caps[i + 1].pixelformat == NULL) { + if (caps.format_caps[i + 1].pixelformat == 0) { Serial.println("The specified format is not supported"); return false; } diff --git a/libraries/Ethernet/examples/WebClient/WebClient.ino b/libraries/Ethernet/examples/WebClient/WebClient.ino index 14f47cefc..d62e7d8dd 100644 --- a/libraries/Ethernet/examples/WebClient/WebClient.ino +++ b/libraries/Ethernet/examples/WebClient/WebClient.ino @@ -110,10 +110,10 @@ void loop() { Serial.print("Received "); Serial.print(byteCount); Serial.print(" bytes in "); - float seconds = (float)(endMicros - beginMicros) / 1000000.0; + float seconds = (endMicros - beginMicros) / 1000000.0f; Serial.print(seconds, 4); - float rate = (float)byteCount / seconds / 1000.0; Serial.print(", rate = "); + float rate = byteCount / 1000.0f / seconds; Serial.print(rate); Serial.print(" kbytes/second"); Serial.println(); diff --git a/libraries/SocketWrapper/SocketHelpers.cpp b/libraries/SocketWrapper/SocketHelpers.cpp index da15b3a30..4938e105c 100644 --- a/libraries/SocketWrapper/SocketHelpers.cpp +++ b/libraries/SocketWrapper/SocketHelpers.cpp @@ -10,6 +10,8 @@ void NetworkInterface::event_handler(struct net_mgmt_event_callback *cb, uint64_ struct net_if *iface) { int i = 0; + ARG_UNUSED(cb); + if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) { return; } @@ -38,6 +40,10 @@ void NetworkInterface::option_handler(struct net_dhcpv4_option_callback *cb, siz enum net_dhcpv4_msg_type msg_type, struct net_if *iface) { char buf[NET_IPV4_ADDR_LEN]; + ARG_UNUSED(length); + ARG_UNUSED(msg_type); + ARG_UNUSED(iface); + LOG_INF("DHCP Option %d: %s", cb->option, net_addr_ntop(AF_INET, cb->data, buf, sizeof(buf))); } @@ -58,7 +64,7 @@ int NetworkInterface::dhcp() { return 0; } -void NetworkInterface::enable_dhcpv4_server(struct net_if *netif, char *_netmask) { +void NetworkInterface::enable_dhcpv4_server(struct net_if *netif, const char *_netmask) { static struct in_addr addr; static struct in_addr netmaskAddr; @@ -140,7 +146,7 @@ void NetworkInterface::setMACAddress(const uint8_t *mac) { net_if_up(netif); // Bring the interface back up after changing the MAC address } -int NetworkInterface::begin(bool blocking, uint32_t additional_event_mask) { +int NetworkInterface::begin(bool blocking, uint64_t additional_event_mask) { dhcp(); int ret = net_mgmt_event_wait_on_iface(netif, NET_EVENT_IPV4_ADDR_ADD | additional_event_mask, NULL, NULL, NULL, blocking ? K_FOREVER : K_SECONDS(1)); @@ -157,7 +163,6 @@ void NetworkInterface::config(const IPAddress ip, const IPAddress dns_server, setDnsServerIP(dns_server); setGatewayIP(gateway); setSubnetMask(subnet); - return; } void NetworkInterface::setLocalIP(const IPAddress ip) { @@ -169,13 +174,17 @@ void NetworkInterface::setLocalIP(const IPAddress ip) { return; } LOG_INF("Local IP address set: %s", ip.toString().c_str()); - return; } void NetworkInterface::setSubnetMask(const IPAddress subnet) { struct in_addr netmask_addr; netmask_addr.s_addr = subnet; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + // TODO: store the address that was manually set and replace this call + // with net_if_ipv4_set_netmask_by_addr net_if_ipv4_set_netmask(netif, &netmask_addr); +#pragma GCC diagnostic pop LOG_INF("Subnet mask set: %s", subnet.toString().c_str()); return; } @@ -185,9 +194,9 @@ void NetworkInterface::setGatewayIP(const IPAddress gateway) { gw_addr.s_addr = gateway; net_if_ipv4_set_gw(netif, &gw_addr); LOG_INF("Gateway IP set: %s", gateway.toString().c_str()); - return; } void NetworkInterface::setDnsServerIP(const IPAddress dns_server) { - return; // DNS server dynamic configuration is not supported + // DNS server dynamic configuration is not supported + ARG_UNUSED(dns_server); } diff --git a/libraries/SocketWrapper/SocketHelpers.h b/libraries/SocketWrapper/SocketHelpers.h index 252108484..343b46dbf 100644 --- a/libraries/SocketWrapper/SocketHelpers.h +++ b/libraries/SocketWrapper/SocketHelpers.h @@ -34,7 +34,7 @@ class NetworkInterface { protected: struct net_if *netif = nullptr; int dhcp(); - void enable_dhcpv4_server(struct net_if *netif, char *_netmask = "255.255.255.0"); + void enable_dhcpv4_server(struct net_if *netif, const char *_netmask = "255.255.255.0"); public: NetworkInterface() { @@ -57,7 +57,7 @@ class NetworkInterface { void setGatewayIP(const IPAddress gateway); void setDnsServerIP(const IPAddress dns_server); - int begin(bool blocking = true, uint32_t additional_event_mask = 0); + int begin(bool blocking = true, uint64_t additional_event_mask = 0); bool disconnect(); }; diff --git a/libraries/SocketWrapper/ZephyrServer.h b/libraries/SocketWrapper/ZephyrServer.h index d5385588d..6e957d48a 100644 --- a/libraries/SocketWrapper/ZephyrServer.h +++ b/libraries/SocketWrapper/ZephyrServer.h @@ -40,6 +40,8 @@ class ZephyrServer : public arduino::Server, ZephyrSocketWrapper { } ZephyrClient accept(uint8_t *status = nullptr) { + ARG_UNUSED(status); + ZephyrClient client; int sock = ZephyrSocketWrapper::accept(); client.setSocket(sock); diff --git a/libraries/SocketWrapper/ZephyrUDP.h b/libraries/SocketWrapper/ZephyrUDP.h index 4770290f7..e6b787e96 100644 --- a/libraries/SocketWrapper/ZephyrUDP.h +++ b/libraries/SocketWrapper/ZephyrUDP.h @@ -269,7 +269,7 @@ class ZephyrUDP : public arduino::UDP { IPAddress _send_to_ip; uint16_t _send_to_port; std::vector _tx_data; - int _rx_pkt_list_size = 10; + size_t _rx_pkt_list_size = 10; /* UDP RECEPTION */ class UdpRxPacket { diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index f7a57bd1a..5935d49c8 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -12,6 +12,8 @@ String WiFiClass::firmwareVersion() { int WiFiClass::begin(const char *ssid, const char *passphrase, wl_enc_type security, bool blocking) { + ARG_UNUSED(security); // currently unsupported + sta_iface = net_if_get_wifi_sta(); netif = sta_iface; sta_config.ssid = (const uint8_t *)ssid; @@ -82,6 +84,7 @@ int WiFiClass::status() { int8_t WiFiClass::scanNetworks() { // TODO: borrow code from mbed core for scan results handling + return 0; } char *WiFiClass::SSID() { diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 18ec6140c..c7d97587f 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -10,8 +10,11 @@ // Helper function to get ZephyrI2C instance from config pointer. static arduino::ZephyrI2C *getInstance(struct i2c_target_config *config) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" return reinterpret_cast(reinterpret_cast(config) - offsetof(arduino::ZephyrI2C, i2c_cfg)); +#pragma GCC diagnostic pop } static int i2c_target_stop_cb(struct i2c_target_config *config) { @@ -48,7 +51,7 @@ static struct i2c_target_callbacks target_callbacks = { .stop = i2c_target_stop_cb, }; -arduino::ZephyrI2C::ZephyrI2C(const struct device *i2c) : i2c_dev(i2c), i2c_cfg({0}) { +arduino::ZephyrI2C::ZephyrI2C(const struct device *i2c) : i2c_cfg({0}), i2c_dev(i2c) { ring_buf_init(&txRingBuffer.rb, sizeof(txRingBuffer.buffer), txRingBuffer.buffer); ring_buf_init(&rxRingBuffer.rb, sizeof(rxRingBuffer.buffer), rxRingBuffer.buffer); } @@ -100,6 +103,8 @@ uint8_t arduino::ZephyrI2C::endTransmission(bool stopBit) { size_t max = ring_buf_capacity_get(&txRingBuffer.rb); size_t len = ring_buf_get_claim(&txRingBuffer.rb, &buf, max); + ARG_UNUSED(stopBit); + ret = i2c_write(i2c_dev, buf, len, _address); // Must be called even if 0 bytes claimed. @@ -115,8 +120,11 @@ uint8_t arduino::ZephyrI2C::endTransmission(void) { size_t arduino::ZephyrI2C::requestFrom(uint8_t address, size_t len_in, bool stopBit) { int ret = -EIO; uint8_t *buf = NULL; - size_t len = ring_buf_put_claim(&rxRingBuffer.rb, &buf, len_in); + size_t len; + + ARG_UNUSED(stopBit); + len = ring_buf_put_claim(&rxRingBuffer.rb, &buf, len_in); if (len && buf) { ret = i2c_read(i2c_dev, buf, len, address); } @@ -171,6 +179,8 @@ void arduino::ZephyrI2C::onRequest(voidFuncPtr cb) { } int arduino::ZephyrI2C::writeRequestedCallback(struct i2c_target_config *config) { + ARG_UNUSED(config); + // Reset the buffer on write requests. ring_buf_reset(&rxRingBuffer.rb); return 0; @@ -180,6 +190,8 @@ int arduino::ZephyrI2C::writeReceivedCallback(struct i2c_target_config *config, size_t len = ring_buf_size_get(&rxRingBuffer.rb); size_t max = ring_buf_capacity_get(&rxRingBuffer.rb); + ARG_UNUSED(config); + // If the buffer is about to overflow, invoke the callback // with the current length. if (onReceiveCb && ((len + 1) > max)) { @@ -201,6 +213,8 @@ int arduino::ZephyrI2C::readRequestedCallback(struct i2c_target_config *config, } int arduino::ZephyrI2C::readProcessedCallback(struct i2c_target_config *config, uint8_t *val) { + ARG_UNUSED(config); + *val = 0xFF; ring_buf_get(&txRingBuffer.rb, val, 1); // Returning a negative value here is not handled gracefully and @@ -209,6 +223,8 @@ int arduino::ZephyrI2C::readProcessedCallback(struct i2c_target_config *config, } int arduino::ZephyrI2C::stopCallback(struct i2c_target_config *config) { + ARG_UNUSED(config); + // If the RX buffer is not empty invoke the callback with the // remaining data length. if (onReceiveCb) { diff --git a/libraries/Zephyr_SDRAM/examples/SDRAM_operations/SDRAM_operations.ino b/libraries/Zephyr_SDRAM/examples/SDRAM_operations/SDRAM_operations.ino index c55795ea6..47c4ade68 100644 --- a/libraries/Zephyr_SDRAM/examples/SDRAM_operations/SDRAM_operations.ino +++ b/libraries/Zephyr_SDRAM/examples/SDRAM_operations/SDRAM_operations.ino @@ -36,17 +36,17 @@ void frameBuffer() { // simply initialize the memory as SDRAM.begin(SDRAM_START_ADDRESS + 2 * 1024 * 1024); - // 2MB of contiguous memory available at the beginning + // 2MB of contiguous memory available at the beginning uint32_t* framebuffer = (uint32_t*)SDRAM_START_ADDRESS; - // We can't allocate anymore the huge 7MB array - + // We can't allocate the huge 7MB array anymore uint8_t* myVeryBigArray = (uint8_t*)SDRAM.malloc(7 * 1024 * 1024); if (myVeryBigArray == NULL) { Serial.println("Oops, too big :)"); } + ARG_UNUSED(framebuffer); // suppress unused variable warning } void setup() { @@ -65,4 +65,4 @@ void setup() { void loop() { -} \ No newline at end of file +} diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf index 2a823ebd9..8fb871e57 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf @@ -16,7 +16,7 @@ CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -#CONFIG_ADC=y +CONFIG_ADC=y #CONFIG_PWM=y CONFIG_LLEXT_STORAGE_WRITABLE=n diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay index 47d9bfb22..b9cd0dd2b 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay @@ -30,8 +30,14 @@ builtin-led-gpios = <&gpio0 10 0>; // TODO: fixme: use real i2c led (will need some magic like PureAnalog) + adc-pin-gpios = <&gpio0 2 0>, // 10: A0 (AIN0) + <&gpio0 30 0>; // 11: A1 (AIN6) + + io-channels = <&adc 0>, + <&adc 6>; + serials = <&uart0>; i2cs = <&i2c1>; spis = <&spi1>; }; -}; \ No newline at end of file +};