├── rust-toolchain.toml ├── .vscode └── settings.json ├── .gitignore ├── .cargo └── config.toml ├── LICENSE-MIT ├── Cargo.toml ├── LICENSE-APACHE ├── src └── main.rs └── Cargo.lock /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.checkOnSave.allTargets": false, 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.riscv32imac-unknown-none-elf] 2 | runner = "espflash flash --monitor" 3 | 4 | [build] 5 | rustflags = [ 6 | # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) 7 | # NOTE: May negatively impact performance of produced code 8 | "-C", "force-frame-pointers", 9 | 10 | "-C", "link-arg=-Tesp32c3_rom_functions.x", 11 | "-C", "link-arg=-Tlinkall.x", 12 | ] 13 | target = "riscv32imac-unknown-none-elf" 14 | 15 | [unstable] 16 | build-std = ["core"] 17 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright [year] [fullname] 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "esp_bare_matter" 3 | version = "0.1.0" 4 | authors = ["bjoernQ "] 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | 8 | [dependencies] 9 | esp32c3-hal = "0.4.0" 10 | 11 | esp-backtrace = { version = "0.3.0", features = ["esp32c3", "panic-handler", "print-uart"] } 12 | esp-println = { version = "0.3.0", features= ["log"] } 13 | riscv-rt = { version = "0.10", optional = true } 14 | 15 | esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "4808b31", features = ["esp32c3", "embedded-svc", "wifi"] } 16 | smoltcp = { version = "0.8.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] } 17 | embedded-svc = { version = "0.23.1", default-features = false} 18 | log = "0.4.17" 19 | 20 | bare-matter = { git = "https://github.com/bjoernQ/bare-matter", rev = "6a93d98" } 21 | getrandom = { version = "0.2.8", features = ["custom"] } 22 | hex-literal = "0.3" 23 | heapless = "0.7.16" 24 | rand_core = { version = "0.6.4", default-features = false } 25 | critical-section = "1.1.1" 26 | 27 | [features] 28 | default = ["rt"] 29 | rt = ["riscv-rt"] 30 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::cell::RefCell; 5 | 6 | use bare_matter::interaction_model::InvokeHandlerResponse; 7 | use bare_matter::{ 8 | create_on_off_endpoint, create_root_device, Certificates, MatterContext, MatterServer, 9 | }; 10 | use critical_section::Mutex; 11 | use embedded_svc::ipv4::Interface; 12 | use embedded_svc::wifi::ClientConfiguration; 13 | use embedded_svc::wifi::{Configuration, Wifi}; 14 | use esp32c3_hal::gpio::{Output, PushPull}; 15 | use esp32c3_hal::{ 16 | clock::{ClockControl, CpuClock}, 17 | pac::Peripherals, 18 | prelude::*, 19 | timer::TimerGroup, 20 | Rtc, 21 | }; 22 | use esp32c3_hal::{Rng, IO}; 23 | use esp_backtrace as _; 24 | use esp_println::println; 25 | use esp_wifi::current_millis; 26 | use esp_wifi::wifi_interface::{Network, UdpSocket}; 27 | use esp_wifi::{ 28 | create_network_stack_storage, network_stack_storage, wifi::utils::create_network_interface, 29 | }; 30 | use getrandom::register_custom_getrandom; 31 | use riscv_rt::entry; 32 | use smoltcp::socket::UdpPacketMetadata; 33 | use smoltcp::wire::Ipv4Address; 34 | 35 | const SSID: &str = env!("SSID"); 36 | const PASSWORD: &str = env!("PASSWORD"); 37 | 38 | // From Chip-Test-DAC-FFF1-8000-0007-Key.der 39 | const DEVICE_PRIVATE_KEY: [u8; 32] = 40 | hex_literal::hex!("727F1005CBA47ED7822A9D930943621617CFD3B79D9AF528B801ECF9F1992204"); 41 | 42 | // From Chip-Test-DAC-FFF1-8000-0007-Cert.der 43 | const DEVICE_CERTIFICATE: [u8;492] = hex_literal::hex!("308201e83082018fa0030201020208143c9d1689f498f0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3231303632383134323334335a180f39393939313233313233353935395a304b311d301b06035504030c144d6174746572205465737420444143203030303731143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000462e2b6e1baff8d74a6fd8216c4cb67a3363a31e691492792e61aee610261481396725ef95e142686ba98f339b0ff65bc338bec7b9e8be0bdf3b2774982476220a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ee95ad96983a9ea95bcd2b00dc5e671727690383301f0603551d23041830168014af42b7094debd515ec6ecf33b81115225f325288300a06082a8648ce3d040302034700304402202f51cf53bf7777df7318094b9db595eebf2fa881c8c572847b1e689ece654264022029782708ee6b32c7f08ff63dbe618e9a580bb14c183bc288777adf9e2dcff5e6"); 44 | 45 | // From Chip-Test-PAI-FFF1-8000-Cert.der 46 | const PRODUCT_INTERMEDIATE_CERTIFICATE: [u8;472] = hex_literal::hex!("308201d43082017aa00302010202083e6ce6509ad840cd300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3231303632383134323334335a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000480ddf11b228f3e31f63bcf5798da14623aebbde82ef378eeadbfb18fe1abce31d08ed4b20604b6ccc6d9b5fab64e7de10cb74be017c9ec1516056d70f2cd0b22a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414af42b7094debd515ec6ecf33b81115225f325288301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210096c9c8cf2e01886005d8f5bc72c07b75fd9a57695ac4911131138bea033ce50302202554943be57d53d6c475f7d23ebfcfc2036cd29ba6393ec7efad8714ab718219"); 47 | 48 | // From DeviceAttestationCredsExample.cpp 49 | const CERTIFICATE_DECLARATION: [u8;541] = hex_literal::hex!("3082021906092a864886f70d010702a082020a30820206020103310d300b06096086480165030402013082017106092a864886f70d010701a08201620482015e152400012501f1ff3602050080050180050280050380050480050580050680050780050880050980050a80050b80050c80050d80050e80050f80051080051180051280051380051480051580051680051780051880051980051a80051b80051c80051d80051e80051f80052080052180052280052380052480052580052680052780052880052980052a80052b80052c80052d80052e80052f80053080053180053280053380053480053580053680053780053880053980053a80053b80053c80053d80053e80053f80054080054180054280054380054480054580054680054780054880054980054a80054b80054c80054d80054e80054f80055080055180055280055380055480055580055680055780055880055980055a80055b80055c80055d80055e80055f80056080056180056280056380182403162c04135a494732303134325a423333303030332d32342405002406002507942624080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022024e5d1f47a7d7b0d206a26ef699b7c9757b72d469089de3192e678c745e7f60c022100f8aa2fa711fcb79b97e397ceda667bae464e2bd3ffdfc3cced7aa8ca5f4c1a7c"); 50 | 51 | register_custom_getrandom!(custom_getrandom); 52 | 53 | static LED: Mutex>>>> = 54 | Mutex::new(RefCell::new(None)); 55 | 56 | #[entry] 57 | fn main() -> ! { 58 | esp_println::logger::init_logger(log::LevelFilter::Info); 59 | esp_wifi::init_heap(); 60 | 61 | let peripherals = Peripherals::take().unwrap(); 62 | let system = peripherals.SYSTEM.split(); 63 | let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock160MHz).freeze(); 64 | 65 | // Disable the RTC and TIMG watchdog timers 66 | let mut rtc = Rtc::new(peripherals.RTC_CNTL); 67 | let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); 68 | let mut wdt0 = timer_group0.wdt; 69 | let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks); 70 | let mut wdt1 = timer_group1.wdt; 71 | 72 | rtc.swd.disable(); 73 | rtc.rwdt.disable(); 74 | wdt0.disable(); 75 | wdt1.disable(); 76 | 77 | let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); 78 | let led = io.pins.gpio5.into_push_pull_output(); 79 | critical_section::with(|cs| LED.borrow_ref_mut(cs).replace(led)); 80 | 81 | let mut storage = create_network_stack_storage!(3, 8, 1, 1); 82 | let ethernet = create_network_interface(network_stack_storage!(storage)); 83 | let mut wifi_interface = esp_wifi::wifi_interface::Wifi::new(ethernet); 84 | 85 | use esp32c3_hal::systimer::SystemTimer; 86 | let syst = SystemTimer::new(peripherals.SYSTIMER); 87 | esp_wifi::initialize(syst.alarm0, Rng::new(peripherals.RNG), &clocks).unwrap(); 88 | 89 | let client_config = Configuration::Client(ClientConfiguration { 90 | ssid: SSID.into(), 91 | password: PASSWORD.into(), 92 | ..Default::default() 93 | }); 94 | let res = wifi_interface.set_configuration(&client_config); 95 | println!("set_configuration returned {:?}", res); 96 | let res = wifi_interface.connect(); 97 | println!("wifi_connect returned {:?}", res); 98 | 99 | // wait to get connected 100 | loop { 101 | if let Ok(true) = wifi_interface.is_connected() { 102 | break; 103 | } 104 | } 105 | 106 | let network = Network::new(wifi_interface, current_millis); 107 | 108 | let mut local_ip = [0u8; 4]; 109 | // wait to get connected and have an ip 110 | loop { 111 | network.poll_dhcp().unwrap(); 112 | network.work(); 113 | 114 | if network.is_iface_up() { 115 | println!("got ip {:?}", network.get_ip_info()); 116 | local_ip.copy_from_slice(&network.get_ip_info().unwrap().ip.octets()); 117 | break; 118 | } 119 | } 120 | 121 | println!("Use Android CHIPTOOL app, select PROVISION CHIP DEVICE WITH WI-FI, INPUT DEVICE ADDRESS, enter {}.{}.{}.{} and tap on COMMISSION", 122 | local_ip[0], 123 | local_ip[1], 124 | local_ip[2], 125 | local_ip[3], 126 | ); 127 | println!("If successful you can toggle GPIO 5 via LIGHT ON/OFF & LEVEL CLUSTER"); 128 | 129 | let mut rx_meta1 = [UdpPacketMetadata::EMPTY; 4]; 130 | let mut rx_buffer1 = [0u8; 1536]; 131 | let mut tx_meta1 = [UdpPacketMetadata::EMPTY; 4]; 132 | let mut tx_buffer1 = [0u8; 1536]; 133 | let udp_socket1 = network.get_udp_socket( 134 | &mut rx_meta1, 135 | &mut rx_buffer1, 136 | &mut tx_meta1, 137 | &mut tx_buffer1, 138 | ); 139 | 140 | let mut rx_meta2 = [UdpPacketMetadata::EMPTY; 4]; 141 | let mut rx_buffer2 = [0u8; 1536]; 142 | let mut tx_meta2 = [UdpPacketMetadata::EMPTY; 4]; 143 | let mut tx_buffer2 = [0u8; 1536]; 144 | let udp_socket2 = network.get_udp_socket( 145 | &mut rx_meta2, 146 | &mut rx_buffer2, 147 | &mut tx_meta2, 148 | &mut tx_buffer2, 149 | ); 150 | 151 | // matter stuff 152 | let certificates = Certificates { 153 | device_private_key: DEVICE_PRIVATE_KEY, 154 | device_certificate: heapless::Vec::from_slice(&DEVICE_CERTIFICATE).unwrap(), 155 | product_intermediate_certificate: heapless::Vec::from_slice( 156 | &PRODUCT_INTERMEDIATE_CERTIFICATE, 157 | ) 158 | .unwrap(), 159 | certificate_declaration: heapless::Vec::from_slice(&CERTIFICATE_DECLARATION).unwrap(), 160 | }; 161 | 162 | let context = MatterContext::new(certificates); 163 | 164 | let on_handler = |v, _s: &MatterContext| { 165 | println!("\n\non_handler {:?}\n\n", v); 166 | critical_section::with(|cs| { 167 | let mut led = LED.borrow_ref_mut(cs); 168 | let led = led.as_mut().unwrap(); 169 | 170 | led.set_high().unwrap(); 171 | }); 172 | 173 | InvokeHandlerResponse::Result(0) 174 | }; 175 | let off_handler = |v, _s: &MatterContext| { 176 | println!("\n\noff_handler {:?}\n\n", v); 177 | critical_section::with(|cs| { 178 | let mut led = LED.borrow_ref_mut(cs); 179 | let led = led.as_mut().unwrap(); 180 | 181 | led.set_low().unwrap(); 182 | }); 183 | 184 | InvokeHandlerResponse::Result(0) 185 | }; 186 | let toggle_handler = |v, _ctx: &MatterContext| { 187 | println!("\n\ntoggle_handler {:?}\n\n", v); 188 | critical_section::with(|cs| { 189 | let mut led = LED.borrow_ref_mut(cs); 190 | let led = led.as_mut().unwrap(); 191 | 192 | led.toggle().unwrap(); 193 | }); 194 | 195 | InvokeHandlerResponse::Result(0) 196 | }; 197 | 198 | let endpoints = &[ 199 | create_root_device!(), 200 | create_on_off_endpoint!(on_handler, off_handler, toggle_handler), 201 | ]; 202 | 203 | let mut device = bare_matter::interaction_model::Device::new(endpoints); 204 | 205 | let mut rng = EspRng::new(); 206 | let mut matter_socket = EspUdpSocket::new(udp_socket1); 207 | let mut matter_multicast_socket = EspUdpMulticastSocket::new(udp_socket2); 208 | let mut server = MatterServer::new( 209 | &mut matter_socket, 210 | &mut matter_multicast_socket, 211 | local_ip, 212 | &mut rng, 213 | &mut device, 214 | &context, 215 | ); 216 | 217 | loop { 218 | server.poll(current_millis()); 219 | } 220 | } 221 | 222 | struct EspUdpSocket<'a> { 223 | socket: UdpSocket<'a, 'a>, 224 | } 225 | 226 | impl<'a> EspUdpSocket<'a> { 227 | pub fn new(socket: UdpSocket<'a, 'a>) -> Self { 228 | Self { socket } 229 | } 230 | } 231 | 232 | impl<'a> bare_matter::UdpSocket for EspUdpSocket<'a> { 233 | fn send( 234 | &mut self, 235 | addr: [u8; 4], 236 | port: u16, 237 | buffer: heapless::Vec, 238 | ) -> Result<(), ()> { 239 | let res = self.socket.send( 240 | Ipv4Address::new(addr[0], addr[1], addr[2], addr[3]), 241 | port, 242 | &buffer, 243 | ); 244 | match res { 245 | Ok(_) => Ok(()), 246 | Err(_) => Err(()), 247 | } 248 | } 249 | 250 | fn receive(&mut self) -> Result<(heapless::Vec, [u8; 4], u16), ()> { 251 | let mut buffer = [0u8; 1024]; 252 | let res = self.socket.receive(&mut buffer); 253 | match res { 254 | Ok((len, sender, port)) => Ok(( 255 | heapless::Vec::from_slice(&buffer[..len]).unwrap(), 256 | sender, 257 | port, 258 | )), 259 | Err(_) => Err(()), 260 | } 261 | } 262 | 263 | fn bind(&mut self, port: u16) -> Result<(), ()> { 264 | let res = self.socket.bind(port); 265 | match res { 266 | Ok(_) => Ok(()), 267 | Err(_) => Err(()), 268 | } 269 | } 270 | } 271 | 272 | struct EspUdpMulticastSocket<'a> { 273 | socket: UdpSocket<'a, 'a>, 274 | } 275 | 276 | impl<'a> EspUdpMulticastSocket<'a> { 277 | pub fn new(socket: UdpSocket<'a, 'a>) -> Self { 278 | Self { socket } 279 | } 280 | } 281 | 282 | impl<'a> bare_matter::UdpMulticastSocket for EspUdpMulticastSocket<'a> { 283 | fn send( 284 | &mut self, 285 | addr: [u8; 4], 286 | port: u16, 287 | buffer: heapless::Vec, 288 | ) -> Result<(), ()> { 289 | let res = self.socket.send( 290 | Ipv4Address::new(addr[0], addr[1], addr[2], addr[3]), 291 | port, 292 | &buffer, 293 | ); 294 | match res { 295 | Ok(_) => Ok(()), 296 | Err(_) => Err(()), 297 | } 298 | } 299 | 300 | fn receive(&mut self) -> Result<(heapless::Vec, [u8; 4], u16), ()> { 301 | let mut buffer = [0u8; 2048]; 302 | let res = self.socket.receive(&mut buffer); 303 | match res { 304 | Ok((len, sender, port)) => Ok(( 305 | heapless::Vec::from_slice(&buffer[..len]).unwrap(), 306 | sender, 307 | port, 308 | )), 309 | Err(_) => Err(()), 310 | } 311 | } 312 | 313 | fn bind(&mut self, multiaddr: &[u8; 4], port: u16) -> Result<(), ()> { 314 | let _res = self.socket.join_multicast_group(Ipv4Address::new( 315 | multiaddr[0], 316 | multiaddr[1], 317 | multiaddr[2], 318 | multiaddr[3], 319 | )); 320 | 321 | let res = self.socket.bind(port); 322 | match res { 323 | Ok(_) => Ok(()), 324 | Err(_) => Err(()), 325 | } 326 | } 327 | } 328 | 329 | struct EspRng {} 330 | 331 | impl EspRng { 332 | pub fn new() -> Self { 333 | Self {} 334 | } 335 | } 336 | 337 | impl rand_core::CryptoRng for EspRng {} 338 | 339 | impl rand_core::RngCore for EspRng { 340 | fn next_u32(&mut self) -> u32 { 341 | // todo!() 342 | 42 343 | } 344 | 345 | fn next_u64(&mut self) -> u64 { 346 | // todo!() 347 | 42u64 348 | } 349 | 350 | fn fill_bytes(&mut self, dest: &mut [u8]) { 351 | //todo!() 352 | let not_random = [1, 54, 223, 42, 23, 3, 70, 33, 23, 177, 32, 39]; 353 | let mut idx = 0; 354 | for b in dest { 355 | *b = not_random[idx]; 356 | idx += 1; 357 | if idx >= not_random.len() { 358 | idx = 0; 359 | } 360 | } 361 | } 362 | 363 | fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> { 364 | //todo!() 365 | self.fill_bytes(dest); 366 | Ok(()) 367 | } 368 | } 369 | 370 | pub fn custom_getrandom(buf: &mut [u8]) -> Result<(), getrandom::Error> { 371 | let not_random = [1, 54, 99, 223, 42, 23, 3, 70, 33, 23, 177, 255, 32, 39]; 372 | let mut idx = 0; 373 | for b in buf { 374 | *b = not_random[idx]; 375 | idx += 1; 376 | if idx >= not_random.len() { 377 | idx = 0; 378 | } 379 | } 380 | 381 | Ok(()) 382 | } 383 | 384 | pub fn wait_ms(ms: u32) { 385 | let started = esp_wifi::current_millis() as u32; 386 | while (esp_wifi::current_millis() as u32) < started + ms { 387 | // nothing 388 | } 389 | } 390 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aead" 7 | version = "0.5.1" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" 10 | dependencies = [ 11 | "crypto-common", 12 | "generic-array", 13 | ] 14 | 15 | [[package]] 16 | name = "aes" 17 | version = "0.8.2" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" 20 | dependencies = [ 21 | "cfg-if", 22 | "cipher", 23 | "cpufeatures", 24 | ] 25 | 26 | [[package]] 27 | name = "aho-corasick" 28 | version = "0.7.20" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" 31 | dependencies = [ 32 | "memchr", 33 | ] 34 | 35 | [[package]] 36 | name = "atomic-polyfill" 37 | version = "0.1.11" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" 40 | dependencies = [ 41 | "critical-section", 42 | ] 43 | 44 | [[package]] 45 | name = "atomic-polyfill" 46 | version = "1.0.1" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "d299f547288d6db8d5c3a2916f7b2f66134b15b8c1ac1c4357dd3b8752af7bb2" 49 | dependencies = [ 50 | "critical-section", 51 | ] 52 | 53 | [[package]] 54 | name = "autocfg" 55 | version = "1.1.0" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 58 | 59 | [[package]] 60 | name = "bare-matter" 61 | version = "0.1.0" 62 | source = "git+https://github.com/bjoernQ/bare-matter?rev=6a93d98#6a93d98acafce74dd04172c244654533a3145bde" 63 | dependencies = [ 64 | "aes", 65 | "ccm", 66 | "critical-section", 67 | "crypto-bigint", 68 | "ecdsa", 69 | "elliptic-curve", 70 | "heapless", 71 | "hex-literal", 72 | "hkdf", 73 | "hmac", 74 | "log", 75 | "p256", 76 | "pbkdf2", 77 | "sha2", 78 | ] 79 | 80 | [[package]] 81 | name = "bare-metal" 82 | version = "1.0.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" 85 | 86 | [[package]] 87 | name = "base16ct" 88 | version = "0.1.1" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" 91 | 92 | [[package]] 93 | name = "bit_field" 94 | version = "0.10.1" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" 97 | 98 | [[package]] 99 | name = "bitflags" 100 | version = "1.3.2" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 103 | 104 | [[package]] 105 | name = "block-buffer" 106 | version = "0.10.3" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" 109 | dependencies = [ 110 | "generic-array", 111 | ] 112 | 113 | [[package]] 114 | name = "byteorder" 115 | version = "1.4.3" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 118 | 119 | [[package]] 120 | name = "ccm" 121 | version = "0.5.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" 124 | dependencies = [ 125 | "aead", 126 | "cipher", 127 | "ctr", 128 | "subtle", 129 | ] 130 | 131 | [[package]] 132 | name = "cfg-if" 133 | version = "1.0.0" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 136 | 137 | [[package]] 138 | name = "cipher" 139 | version = "0.4.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" 142 | dependencies = [ 143 | "crypto-common", 144 | "inout", 145 | ] 146 | 147 | [[package]] 148 | name = "const-oid" 149 | version = "0.9.1" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" 152 | 153 | [[package]] 154 | name = "cpufeatures" 155 | version = "0.2.5" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" 158 | dependencies = [ 159 | "libc", 160 | ] 161 | 162 | [[package]] 163 | name = "critical-section" 164 | version = "1.1.1" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" 167 | 168 | [[package]] 169 | name = "crypto-bigint" 170 | version = "0.4.9" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" 173 | dependencies = [ 174 | "generic-array", 175 | "rand_core", 176 | "subtle", 177 | "zeroize", 178 | ] 179 | 180 | [[package]] 181 | name = "crypto-common" 182 | version = "0.1.6" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 185 | dependencies = [ 186 | "generic-array", 187 | "typenum", 188 | ] 189 | 190 | [[package]] 191 | name = "ctr" 192 | version = "0.9.2" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" 195 | dependencies = [ 196 | "cipher", 197 | ] 198 | 199 | [[package]] 200 | name = "darling" 201 | version = "0.14.2" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" 204 | dependencies = [ 205 | "darling_core", 206 | "darling_macro", 207 | ] 208 | 209 | [[package]] 210 | name = "darling_core" 211 | version = "0.14.2" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" 214 | dependencies = [ 215 | "fnv", 216 | "ident_case", 217 | "proc-macro2", 218 | "quote", 219 | "strsim", 220 | "syn", 221 | ] 222 | 223 | [[package]] 224 | name = "darling_macro" 225 | version = "0.14.2" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" 228 | dependencies = [ 229 | "darling_core", 230 | "quote", 231 | "syn", 232 | ] 233 | 234 | [[package]] 235 | name = "der" 236 | version = "0.6.1" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" 239 | dependencies = [ 240 | "const-oid", 241 | ] 242 | 243 | [[package]] 244 | name = "digest" 245 | version = "0.10.6" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" 248 | dependencies = [ 249 | "block-buffer", 250 | "crypto-common", 251 | "subtle", 252 | ] 253 | 254 | [[package]] 255 | name = "ecdsa" 256 | version = "0.14.8" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" 259 | dependencies = [ 260 | "der", 261 | "elliptic-curve", 262 | "rfc6979", 263 | "signature", 264 | ] 265 | 266 | [[package]] 267 | name = "elliptic-curve" 268 | version = "0.12.3" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" 271 | dependencies = [ 272 | "base16ct", 273 | "crypto-bigint", 274 | "der", 275 | "digest", 276 | "ff", 277 | "generic-array", 278 | "group", 279 | "hkdf", 280 | "rand_core", 281 | "sec1", 282 | "subtle", 283 | "zeroize", 284 | ] 285 | 286 | [[package]] 287 | name = "embedded-dma" 288 | version = "0.2.0" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 291 | dependencies = [ 292 | "stable_deref_trait", 293 | ] 294 | 295 | [[package]] 296 | name = "embedded-hal" 297 | version = "0.2.7" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 300 | dependencies = [ 301 | "nb 0.1.3", 302 | "void", 303 | ] 304 | 305 | [[package]] 306 | name = "embedded-io" 307 | version = "0.3.1" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "33dfba9e6c113f2fd8537c943780a7345945e66c86972e356b1152e19481bcf5" 310 | 311 | [[package]] 312 | name = "embedded-svc" 313 | version = "0.23.2" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "25d1ffdfc6c4ca5a8d308a0df8c0e82ca52cdb63c5bd4d8ae6c36889887756b6" 316 | dependencies = [ 317 | "embedded-io", 318 | "enumset", 319 | "heapless", 320 | "no-std-net", 321 | "serde", 322 | ] 323 | 324 | [[package]] 325 | name = "enumset" 326 | version = "1.0.12" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753" 329 | dependencies = [ 330 | "enumset_derive", 331 | ] 332 | 333 | [[package]] 334 | name = "enumset_derive" 335 | version = "0.6.1" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" 338 | dependencies = [ 339 | "darling", 340 | "proc-macro2", 341 | "quote", 342 | "syn", 343 | ] 344 | 345 | [[package]] 346 | name = "esp-backtrace" 347 | version = "0.3.0" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "857b0ab2194767e4354c607b980b00a3f507659a3b793245144a992f3d81673f" 350 | dependencies = [ 351 | "esp-println", 352 | "riscv 0.8.0", 353 | ] 354 | 355 | [[package]] 356 | name = "esp-hal-common" 357 | version = "0.4.0" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "007db8d84050d19fec367bece124cccbdf6837ff0ea8e1a4fc04599148ab5ea1" 360 | dependencies = [ 361 | "cfg-if", 362 | "critical-section", 363 | "embedded-dma", 364 | "embedded-hal", 365 | "esp-hal-procmacros", 366 | "esp32c3", 367 | "fugit", 368 | "nb 1.0.0", 369 | "paste", 370 | "riscv 0.10.0", 371 | "riscv-atomic-emulation-trap", 372 | "void", 373 | ] 374 | 375 | [[package]] 376 | name = "esp-hal-procmacros" 377 | version = "0.1.0" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "7dd1fb5018ef2c57daadf84e9bbff1c9e48c04958d32bc1469f781a96ec82e8e" 380 | dependencies = [ 381 | "darling", 382 | "proc-macro-error", 383 | "proc-macro2", 384 | "quote", 385 | "syn", 386 | ] 387 | 388 | [[package]] 389 | name = "esp-println" 390 | version = "0.3.1" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "adcfe5d532cf2029b11996cab6b4af948f41c24b131c76422115634711549aaa" 393 | dependencies = [ 394 | "log", 395 | ] 396 | 397 | [[package]] 398 | name = "esp-wifi" 399 | version = "0.1.0" 400 | source = "git+https://github.com/esp-rs/esp-wifi?rev=4808b31#4808b31827c7bd70f0d7f6306e1988f897408ca6" 401 | dependencies = [ 402 | "atomic-polyfill 1.0.1", 403 | "critical-section", 404 | "embedded-hal", 405 | "embedded-io", 406 | "embedded-svc", 407 | "enumset", 408 | "esp32c3-hal", 409 | "fugit", 410 | "heapless", 411 | "linked_list_allocator", 412 | "log", 413 | "nb 1.0.0", 414 | "riscv 0.10.0", 415 | "riscv-rt", 416 | "riscv-target", 417 | "smoltcp", 418 | "void", 419 | ] 420 | 421 | [[package]] 422 | name = "esp32c3" 423 | version = "0.8.1" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "677b6cc003e2f7384c5bd02286e5ee04d9ac0adc875abff6c3316175af20eaa8" 426 | dependencies = [ 427 | "critical-section", 428 | "riscv 0.10.0", 429 | "riscv-rt", 430 | "vcell", 431 | ] 432 | 433 | [[package]] 434 | name = "esp32c3-hal" 435 | version = "0.4.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "dccecada61692e6d3fb8349a630c1fc8cfac144cb3cb52763624db8ec1373111" 438 | dependencies = [ 439 | "cfg-if", 440 | "embedded-hal", 441 | "esp-hal-common", 442 | "r0", 443 | "riscv 0.10.0", 444 | "riscv-rt", 445 | ] 446 | 447 | [[package]] 448 | name = "esp_bare_matter" 449 | version = "0.1.0" 450 | dependencies = [ 451 | "bare-matter", 452 | "critical-section", 453 | "embedded-svc", 454 | "esp-backtrace", 455 | "esp-println", 456 | "esp-wifi", 457 | "esp32c3-hal", 458 | "getrandom", 459 | "heapless", 460 | "hex-literal", 461 | "log", 462 | "rand_core", 463 | "riscv-rt", 464 | "smoltcp", 465 | ] 466 | 467 | [[package]] 468 | name = "ff" 469 | version = "0.12.1" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" 472 | dependencies = [ 473 | "rand_core", 474 | "subtle", 475 | ] 476 | 477 | [[package]] 478 | name = "fnv" 479 | version = "1.0.7" 480 | source = "registry+https://github.com/rust-lang/crates.io-index" 481 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 482 | 483 | [[package]] 484 | name = "fugit" 485 | version = "0.3.6" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "7ab17bb279def6720d058cb6c052249938e7f99260ab534879281a95367a87e5" 488 | dependencies = [ 489 | "gcd", 490 | ] 491 | 492 | [[package]] 493 | name = "gcd" 494 | version = "2.2.0" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "a4b1b088ad0a967aa29540456b82fc8903f854775d33f71e9709c4efb3dfbfd2" 497 | 498 | [[package]] 499 | name = "generic-array" 500 | version = "0.14.6" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 503 | dependencies = [ 504 | "typenum", 505 | "version_check", 506 | ] 507 | 508 | [[package]] 509 | name = "getrandom" 510 | version = "0.2.8" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 513 | dependencies = [ 514 | "cfg-if", 515 | "libc", 516 | "wasi", 517 | ] 518 | 519 | [[package]] 520 | name = "group" 521 | version = "0.12.1" 522 | source = "registry+https://github.com/rust-lang/crates.io-index" 523 | checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" 524 | dependencies = [ 525 | "ff", 526 | "rand_core", 527 | "subtle", 528 | ] 529 | 530 | [[package]] 531 | name = "hash32" 532 | version = "0.2.1" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 535 | dependencies = [ 536 | "byteorder", 537 | ] 538 | 539 | [[package]] 540 | name = "heapless" 541 | version = "0.7.16" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 544 | dependencies = [ 545 | "atomic-polyfill 0.1.11", 546 | "hash32", 547 | "rustc_version", 548 | "spin", 549 | "stable_deref_trait", 550 | ] 551 | 552 | [[package]] 553 | name = "hex-literal" 554 | version = "0.3.4" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" 557 | 558 | [[package]] 559 | name = "hkdf" 560 | version = "0.12.3" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" 563 | dependencies = [ 564 | "hmac", 565 | ] 566 | 567 | [[package]] 568 | name = "hmac" 569 | version = "0.12.1" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 572 | dependencies = [ 573 | "digest", 574 | ] 575 | 576 | [[package]] 577 | name = "ident_case" 578 | version = "1.0.1" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 581 | 582 | [[package]] 583 | name = "inout" 584 | version = "0.1.3" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 587 | dependencies = [ 588 | "generic-array", 589 | ] 590 | 591 | [[package]] 592 | name = "lazy_static" 593 | version = "1.4.0" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 596 | 597 | [[package]] 598 | name = "libc" 599 | version = "0.2.139" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 602 | 603 | [[package]] 604 | name = "linked_list_allocator" 605 | version = "0.10.4" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "e322f259d225fbae43a1b053b2dc6a5968a6bdf8b205f5de684dab485b95030e" 608 | 609 | [[package]] 610 | name = "lock_api" 611 | version = "0.4.9" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 614 | dependencies = [ 615 | "autocfg", 616 | "scopeguard", 617 | ] 618 | 619 | [[package]] 620 | name = "log" 621 | version = "0.4.17" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 624 | dependencies = [ 625 | "cfg-if", 626 | ] 627 | 628 | [[package]] 629 | name = "managed" 630 | version = "0.8.0" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" 633 | 634 | [[package]] 635 | name = "memchr" 636 | version = "2.5.0" 637 | source = "registry+https://github.com/rust-lang/crates.io-index" 638 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 639 | 640 | [[package]] 641 | name = "nb" 642 | version = "0.1.3" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 645 | dependencies = [ 646 | "nb 1.0.0", 647 | ] 648 | 649 | [[package]] 650 | name = "nb" 651 | version = "1.0.0" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" 654 | 655 | [[package]] 656 | name = "no-std-net" 657 | version = "0.5.0" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "1bcece43b12349917e096cddfa66107277f123e6c96a5aea78711dc601a47152" 660 | 661 | [[package]] 662 | name = "p256" 663 | version = "0.11.1" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" 666 | dependencies = [ 667 | "ecdsa", 668 | "elliptic-curve", 669 | "sha2", 670 | ] 671 | 672 | [[package]] 673 | name = "paste" 674 | version = "1.0.11" 675 | source = "registry+https://github.com/rust-lang/crates.io-index" 676 | checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" 677 | 678 | [[package]] 679 | name = "pbkdf2" 680 | version = "0.11.0" 681 | source = "registry+https://github.com/rust-lang/crates.io-index" 682 | checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" 683 | dependencies = [ 684 | "digest", 685 | ] 686 | 687 | [[package]] 688 | name = "proc-macro-error" 689 | version = "1.0.4" 690 | source = "registry+https://github.com/rust-lang/crates.io-index" 691 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 692 | dependencies = [ 693 | "proc-macro-error-attr", 694 | "proc-macro2", 695 | "quote", 696 | "syn", 697 | "version_check", 698 | ] 699 | 700 | [[package]] 701 | name = "proc-macro-error-attr" 702 | version = "1.0.4" 703 | source = "registry+https://github.com/rust-lang/crates.io-index" 704 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 705 | dependencies = [ 706 | "proc-macro2", 707 | "quote", 708 | "version_check", 709 | ] 710 | 711 | [[package]] 712 | name = "proc-macro2" 713 | version = "1.0.49" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" 716 | dependencies = [ 717 | "unicode-ident", 718 | ] 719 | 720 | [[package]] 721 | name = "quote" 722 | version = "1.0.23" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" 725 | dependencies = [ 726 | "proc-macro2", 727 | ] 728 | 729 | [[package]] 730 | name = "r0" 731 | version = "1.0.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" 734 | 735 | [[package]] 736 | name = "rand_core" 737 | version = "0.6.4" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 740 | 741 | [[package]] 742 | name = "regex" 743 | version = "1.7.0" 744 | source = "registry+https://github.com/rust-lang/crates.io-index" 745 | checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" 746 | dependencies = [ 747 | "aho-corasick", 748 | "memchr", 749 | "regex-syntax", 750 | ] 751 | 752 | [[package]] 753 | name = "regex-syntax" 754 | version = "0.6.28" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" 757 | 758 | [[package]] 759 | name = "rfc6979" 760 | version = "0.3.1" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" 763 | dependencies = [ 764 | "crypto-bigint", 765 | "hmac", 766 | "zeroize", 767 | ] 768 | 769 | [[package]] 770 | name = "riscv" 771 | version = "0.8.0" 772 | source = "registry+https://github.com/rust-lang/crates.io-index" 773 | checksum = "5e2856a701069e2d262b264750d382407d272d5527f7a51d3777d1805b4e2d3c" 774 | dependencies = [ 775 | "bare-metal", 776 | "bit_field", 777 | "embedded-hal", 778 | ] 779 | 780 | [[package]] 781 | name = "riscv" 782 | version = "0.9.0" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "73fc4bc7113424814738fe79755a5764e392b3d4d1bc757e6aa6f61cede32095" 785 | dependencies = [ 786 | "bare-metal", 787 | "bit_field", 788 | "embedded-hal", 789 | ] 790 | 791 | [[package]] 792 | name = "riscv" 793 | version = "0.10.0" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "169fa82a2be03db484b13863f6a88f7f154a027a332c471cc164775671e81a5a" 796 | dependencies = [ 797 | "bit_field", 798 | "critical-section", 799 | "embedded-hal", 800 | ] 801 | 802 | [[package]] 803 | name = "riscv-atomic-emulation-trap" 804 | version = "0.3.0" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "8149334f67011146f603c58b63f5b370ae71eb9700988fde89a6d5a6cd5987ea" 807 | dependencies = [ 808 | "riscv 0.10.0", 809 | "riscv-rt", 810 | "riscv-target", 811 | ] 812 | 813 | [[package]] 814 | name = "riscv-rt" 815 | version = "0.10.0" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "7818495e5392d1ebb158a6f65da26c23d7f0fe93f7d6affa6395bf5b77035eae" 818 | dependencies = [ 819 | "r0", 820 | "riscv 0.9.0", 821 | "riscv-rt-macros", 822 | "riscv-target", 823 | ] 824 | 825 | [[package]] 826 | name = "riscv-rt-macros" 827 | version = "0.2.0" 828 | source = "registry+https://github.com/rust-lang/crates.io-index" 829 | checksum = "f38509d7b17c2f604ceab3e5ff8ac97bb8cd2f544688c512be75c715edaf4daf" 830 | dependencies = [ 831 | "proc-macro2", 832 | "quote", 833 | "syn", 834 | ] 835 | 836 | [[package]] 837 | name = "riscv-target" 838 | version = "0.1.2" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" 841 | dependencies = [ 842 | "lazy_static", 843 | "regex", 844 | ] 845 | 846 | [[package]] 847 | name = "rustc_version" 848 | version = "0.4.0" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 851 | dependencies = [ 852 | "semver", 853 | ] 854 | 855 | [[package]] 856 | name = "scopeguard" 857 | version = "1.1.0" 858 | source = "registry+https://github.com/rust-lang/crates.io-index" 859 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 860 | 861 | [[package]] 862 | name = "sec1" 863 | version = "0.3.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" 866 | dependencies = [ 867 | "base16ct", 868 | "der", 869 | "generic-array", 870 | "subtle", 871 | "zeroize", 872 | ] 873 | 874 | [[package]] 875 | name = "semver" 876 | version = "1.0.16" 877 | source = "registry+https://github.com/rust-lang/crates.io-index" 878 | checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" 879 | 880 | [[package]] 881 | name = "serde" 882 | version = "1.0.152" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" 885 | dependencies = [ 886 | "serde_derive", 887 | ] 888 | 889 | [[package]] 890 | name = "serde_derive" 891 | version = "1.0.152" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" 894 | dependencies = [ 895 | "proc-macro2", 896 | "quote", 897 | "syn", 898 | ] 899 | 900 | [[package]] 901 | name = "sha2" 902 | version = "0.10.6" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 905 | dependencies = [ 906 | "cfg-if", 907 | "cpufeatures", 908 | "digest", 909 | ] 910 | 911 | [[package]] 912 | name = "signature" 913 | version = "1.6.4" 914 | source = "registry+https://github.com/rust-lang/crates.io-index" 915 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 916 | dependencies = [ 917 | "digest", 918 | "rand_core", 919 | ] 920 | 921 | [[package]] 922 | name = "smoltcp" 923 | version = "0.8.2" 924 | source = "registry+https://github.com/rust-lang/crates.io-index" 925 | checksum = "ee34c1e1bfc7e9206cc0fb8030a90129b4e319ab53856249bb27642cab914fb3" 926 | dependencies = [ 927 | "bitflags", 928 | "byteorder", 929 | "managed", 930 | ] 931 | 932 | [[package]] 933 | name = "spin" 934 | version = "0.9.4" 935 | source = "registry+https://github.com/rust-lang/crates.io-index" 936 | checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" 937 | dependencies = [ 938 | "lock_api", 939 | ] 940 | 941 | [[package]] 942 | name = "stable_deref_trait" 943 | version = "1.2.0" 944 | source = "registry+https://github.com/rust-lang/crates.io-index" 945 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 946 | 947 | [[package]] 948 | name = "strsim" 949 | version = "0.10.0" 950 | source = "registry+https://github.com/rust-lang/crates.io-index" 951 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 952 | 953 | [[package]] 954 | name = "subtle" 955 | version = "2.4.1" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 958 | 959 | [[package]] 960 | name = "syn" 961 | version = "1.0.107" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" 964 | dependencies = [ 965 | "proc-macro2", 966 | "quote", 967 | "unicode-ident", 968 | ] 969 | 970 | [[package]] 971 | name = "typenum" 972 | version = "1.16.0" 973 | source = "registry+https://github.com/rust-lang/crates.io-index" 974 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 975 | 976 | [[package]] 977 | name = "unicode-ident" 978 | version = "1.0.6" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" 981 | 982 | [[package]] 983 | name = "vcell" 984 | version = "0.1.3" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 987 | 988 | [[package]] 989 | name = "version_check" 990 | version = "0.9.4" 991 | source = "registry+https://github.com/rust-lang/crates.io-index" 992 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 993 | 994 | [[package]] 995 | name = "void" 996 | version = "1.0.2" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 999 | 1000 | [[package]] 1001 | name = "wasi" 1002 | version = "0.11.0+wasi-snapshot-preview1" 1003 | source = "registry+https://github.com/rust-lang/crates.io-index" 1004 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1005 | 1006 | [[package]] 1007 | name = "zeroize" 1008 | version = "1.5.7" 1009 | source = "registry+https://github.com/rust-lang/crates.io-index" 1010 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 1011 | --------------------------------------------------------------------------------