pw_channel: Require explicit datagram-to-byte conversions

This commit partially reverts a230ae449576bc3e0933fa567c58da2a33ebde13
and makes additional improvements.

- Since datagrams and bytes are semantically different, remove the
  datagram property. A Channel's DataType (kDatagram or kByte) is
  specified as the first template parameter.
- Introduce IgnoreDatagramBoundaries() function to support using a
  datagram channel as a byte channel.
- Fix SFINAE for implicit channel conversions. A static_assert() cannot
  be used for SFINAE.
- Add channel.as<>() overload that takes just the desired properties as
  template arguments.

Change-Id: I9f74393236163b47874005ebf336d083e1ca32c8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/197650
Reviewed-by: Taylor Cramer <cramertj@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
4 files changed
tree: 4c8d60e86a0f7d36fbfa40208a9256c6429ba61d
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. kudzu/
  7. pw_alignment/
  8. pw_allocator/
  9. pw_analog/
  10. pw_android_toolchain/
  11. pw_arduino_build/
  12. pw_assert/
  13. pw_assert_basic/
  14. pw_assert_log/
  15. pw_assert_tokenized/
  16. pw_assert_zephyr/
  17. pw_async/
  18. pw_async2/
  19. pw_async2_basic/
  20. pw_async_basic/
  21. pw_base64/
  22. pw_bloat/
  23. pw_blob_store/
  24. pw_bluetooth/
  25. pw_bluetooth_hci/
  26. pw_bluetooth_profiles/
  27. pw_bluetooth_sapphire/
  28. pw_boot/
  29. pw_boot_cortex_m/
  30. pw_build/
  31. pw_build_android/
  32. pw_build_info/
  33. pw_build_mcuxpresso/
  34. pw_bytes/
  35. pw_channel/
  36. pw_checksum/
  37. pw_chre/
  38. pw_chrono/
  39. pw_chrono_embos/
  40. pw_chrono_freertos/
  41. pw_chrono_rp2040/
  42. pw_chrono_stl/
  43. pw_chrono_threadx/
  44. pw_chrono_zephyr/
  45. pw_cli/
  46. pw_compilation_testing/
  47. pw_config_loader/
  48. pw_console/
  49. pw_containers/
  50. pw_cpu_exception/
  51. pw_cpu_exception_cortex_m/
  52. pw_crypto/
  53. pw_digital_io/
  54. pw_digital_io_linux/
  55. pw_digital_io_mcuxpresso/
  56. pw_digital_io_rp2040/
  57. pw_docgen/
  58. pw_doctor/
  59. pw_emu/
  60. pw_env_setup/
  61. pw_env_setup_zephyr/
  62. pw_file/
  63. pw_format/
  64. pw_function/
  65. pw_fuzzer/
  66. pw_grpc/
  67. pw_hdlc/
  68. pw_hex_dump/
  69. pw_i2c/
  70. pw_i2c_linux/
  71. pw_i2c_mcuxpresso/
  72. pw_ide/
  73. pw_interrupt/
  74. pw_interrupt_cortex_m/
  75. pw_interrupt_xtensa/
  76. pw_interrupt_zephyr/
  77. pw_intrusive_ptr/
  78. pw_json/
  79. pw_kvs/
  80. pw_libc/
  81. pw_libcxx/
  82. pw_log/
  83. pw_log_android/
  84. pw_log_basic/
  85. pw_log_null/
  86. pw_log_rpc/
  87. pw_log_string/
  88. pw_log_tokenized/
  89. pw_log_zephyr/
  90. pw_malloc/
  91. pw_malloc_freelist/
  92. pw_malloc_freertos/
  93. pw_metric/
  94. pw_minimal_cpp_stdlib/
  95. pw_module/
  96. pw_multibuf/
  97. pw_multisink/
  98. pw_package/
  99. pw_perf_test/
  100. pw_persistent_ram/
  101. pw_polyfill/
  102. pw_preprocessor/
  103. pw_presubmit/
  104. pw_protobuf/
  105. pw_protobuf_compiler/
  106. pw_random/
  107. pw_result/
  108. pw_ring_buffer/
  109. pw_router/
  110. pw_rpc/
  111. pw_rpc_transport/
  112. pw_rust/
  113. pw_snapshot/
  114. pw_software_update/
  115. pw_span/
  116. pw_spi/
  117. pw_spi_mcuxpresso/
  118. pw_spi_rp2040/
  119. pw_status/
  120. pw_stm32cube_build/
  121. pw_stream/
  122. pw_stream_shmem_mcuxpresso/
  123. pw_stream_uart_linux/
  124. pw_stream_uart_mcuxpresso/
  125. pw_string/
  126. pw_symbolizer/
  127. pw_sync/
  128. pw_sync_baremetal/
  129. pw_sync_embos/
  130. pw_sync_freertos/
  131. pw_sync_stl/
  132. pw_sync_threadx/
  133. pw_sync_zephyr/
  134. pw_sys_io/
  135. pw_sys_io_ambiq_sdk/
  136. pw_sys_io_arduino/
  137. pw_sys_io_baremetal_lm3s6965evb/
  138. pw_sys_io_baremetal_stm32f429/
  139. pw_sys_io_emcraft_sf2/
  140. pw_sys_io_mcuxpresso/
  141. pw_sys_io_rp2040/
  142. pw_sys_io_stdio/
  143. pw_sys_io_stm32cube/
  144. pw_sys_io_zephyr/
  145. pw_system/
  146. pw_target_runner/
  147. pw_thread/
  148. pw_thread_embos/
  149. pw_thread_freertos/
  150. pw_thread_stl/
  151. pw_thread_threadx/
  152. pw_thread_zephyr/
  153. pw_tls_client/
  154. pw_tls_client_boringssl/
  155. pw_tls_client_mbedtls/
  156. pw_tokenizer/
  157. pw_toolchain/
  158. pw_toolchain_bazel/
  159. pw_trace/
  160. pw_trace_tokenized/
  161. pw_transfer/
  162. pw_unit_test/
  163. pw_unit_test_zephyr/
  164. pw_varint/
  165. pw_watch/
  166. pw_web/
  167. pw_work_queue/
  168. seed/
  169. targets/
  170. third_party/
  171. ts/
  172. zephyr/
  173. .bazelignore
  174. .bazelrc
  175. .black.toml
  176. .clang-format
  177. .clang-tidy
  178. .eslintrc.cjs
  179. .git-blame-ignore-revs
  180. .gitattributes
  181. .gitignore
  182. .gn
  183. .mypy.ini
  184. .prettierignore
  185. .prettierrc.cjs
  186. .pw_ide.yaml
  187. .pylintrc
  188. activate.bat
  189. Android.bp
  190. AUTHORS
  191. bootstrap.bat
  192. bootstrap.sh
  193. BUILD.bazel
  194. BUILD.gn
  195. BUILDCONFIG.gn
  196. CMakeLists.txt
  197. jest.config.ts
  198. Kconfig.zephyr
  199. LICENSE
  200. modules.gni
  201. OWNERS
  202. package-lock.json
  203. package.json
  204. pigweed.json
  205. PIGWEED_MODULES
  206. README.md
  207. rollup.config.js
  208. tsconfig.json
  209. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links