Commit Graph

5 Commits

Author SHA1 Message Date
Tom Craig
eecf63ba84 pw_sys_io_stm32cube: Extend hardware support
Extends support for more hardware by supporting the following:
- Uarts where tx and rx pins are on different ports.
- Peripherals that are UARTs, not USARTs.

Adds the following new config options which default to
PW_SYS_IO_STM32CUBE_GPIO_PORT for backwards compatibility:
- PW_SYS_IO_STM32CUBE_GPIO_TX_PORT
- PW_SYS_IO_STM32CUBE_GPIO_RX_PORT

Adds the following new config option which default to USART:
- PW_SYS_IO_STM32CUBE_USART_PREFIX

For example, this was useful with the following config on an STM32H7:
  PW_SYS_IO_STM32CUBE_GPIO_AF=8
  PW_SYS_IO_STM32CUBE_USART_NUM=5
  PW_SYS_IO_STM32CUBE_GPIO_TX_PORT=C
  PW_SYS_IO_STM32CUBE_GPIO_TX_PIN=12
  PW_SYS_IO_STM32CUBE_GPIO_RX_PORT=D
  PW_SYS_IO_STM32CUBE_GPIO_RX_PIN=2
  PW_SYS_IO_STM32CUBE_USART_PREFIX=UART

Change-Id: I9cbd2742dd2fc3ff031874f18dc80241e6c7675d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/105540
Reviewed-by: Armando Montanez <amontanez@google.com>
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2022-08-09 21:31:30 +00:00
Wyatt Hepler
6c5df358e6 pw_span: Switch from std::span to pw::span
This changes uses of std::span to pw::span. No changes are made to build
dependencies in this commit.

This change was made with the following shell script:

  #!/bin/bash

  readonly FILES="$(git ls-files '*.rst' '*.md' '*.h' '*.cc' '*.py')"
  readonly PW_NS_FILES="$(git grep -l 'namespace pw\>' | grep -v generate_decoding_test_data.cc)"

  echo "Updating #includes"
  sed -i --follow-symlinks \
      's/#include <span>/#include "pw_span\/span.h"/g' ${FILES}

  for name in span as_bytes as_writable_bytes dynamic_extent; do
    echo Renaming std::$name to pw::$name
    sed -i --follow-symlinks "s/std::$name/pw::$name/g" ${FILES}
    sed -i --follow-symlinks "s/pw::$name/$name/g" ${PW_NS_FILES}
    sed -i --follow-symlinks "s/using $name;//" ${PW_NS_FILES}
  done

  git checkout pw_span

  pw format -b origin/main --fix

Bug: b/235237667
Change-Id: I32edfbcb7cadf3ab39009596fdb7275fcc5ea3f5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98264
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
2022-06-29 00:15:46 +00:00
Tom Craig
1d3fe223ee pw_sys_io_stm32cube: Support STM32G0
Adds a PW_SYS_IO_STM32CUBE_GPIO_AF config.h option to
pw_sys_io_stm32cube to support STM32G0 and any other STM32 family
members that use different alternate functions for uarts.

Change-Id: I7c0677b9ef707051a9d9f3f224b5e7bf171682d0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/90180
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
2022-04-08 23:01:29 +00:00
Armando Montanez
a398cd1084 pw_sys_io_stm32cube: Cleanup
Cleans up pw_sys_io_stm32cube to provide docs, use Pigweed's established
config pattern, and use PW_CONCAT() rather than the one-off concat macro
helper.

Change-Id: Ie822f3b1efa164e4bb1f4310ea8f8d6ed7658da0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/73962
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
2021-12-14 01:39:17 +00:00
Armando Montanez
70045e231c pw_sys_io_stm32cube: Add module
Moves pw_sys_io_stm32cube from experimental to Pigweed core.

Requires: 73181
Change-Id: I36170562671153488f2b54f954aa0970aac09063
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/72961
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2021-12-09 21:31:31 +00:00