Skip to content

Commit

Permalink
Merge branch 'main' into feature/cucumber
Browse files Browse the repository at this point in the history
  • Loading branch information
richardapeters authored Sep 2, 2024
2 parents e94ef83 + a830ed6 commit 2e97074
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
buildPreset: "host-Debug-WithPackage"
#testPreset: "host"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: hal_st
path: build/host/hal_st-*-Linux.tar.gz
if-no-files-found: error
#- name: Upload test logs
# if: ${{ failure() }}
# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
# uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
# with:
# name: test-logs
# path: build/host/Testing/Temporary/
Expand All @@ -62,7 +62,7 @@ jobs:
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
#- name: Upload test logs
# if: ${{ failure() }}
# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
# uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
# with:
# name: test-logs
# path: build/host/Testing/Temporary/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
if: ${{ success() || failure() }}
with:
sarif_file: megalinter-reports/megalinter-report.sarif
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: ${{ success() || failure() }}
with:
name: linter
Expand Down
20 changes: 15 additions & 5 deletions hal_st/stm32fxxx/DigitalToAnalogPinStm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,44 @@ namespace hal
: dac{ dac }
, channel{ infra::enum_cast(channel) == 1 ? DAC_CHANNEL_1 : DAC_CHANNEL_2 }
, internallyConnected{ true }
{}
{
Configure();
}

DigitalToAnalogPinImplStm::DigitalToAnalogPinImplStm(hal::GpioPinStm& pin, hal::DacStm& dac, External)
: pin{ infra::inPlace, pin }
, dac{ dac }
, channel{ pin.DacChannel(dac.index + 1) == 1 ? DAC_CHANNEL_1 : DAC_CHANNEL_2 }
, internallyConnected{ false }
{}
{
Configure();
}

DigitalToAnalogPinImplStm::DigitalToAnalogPinImplStm(hal::GpioPinStm& pin, hal::DacStm& dac, Both)
: pin{ infra::inPlace, pin }
, dac{ dac }
, channel{ pin.DacChannel(dac.index + 1) == 1 ? DAC_CHANNEL_1 : DAC_CHANNEL_2 }
, internallyConnected{ true }

{}
{
Configure();
}
#else
DigitalToAnalogPinImplStm::DigitalToAnalogPinImplStm(hal::GpioPinStm& pin, hal::DacStm& dac)
: pin{ infra::inPlace, pin }
, dac(dac)
, channel{ pin.DacChannel(dac.index + 1) == 1 ? DAC_CHANNEL_1 : DAC_CHANNEL_2 }
{
Configure();
}
#endif

void DigitalToAnalogPinImplStm::Set(uint16_t value)
{
dac.Set(channel, DAC_ALIGN_12B_R, std::min(static_cast<uint32_t>(value), (infra::Bit<uint32_t>(12) - 1)));
}

void DigitalToAnalogPinImplStm::Configure()
{
DAC_ChannelConfTypeDef sConfig{ 0 };
sConfig.DAC_OutputBuffer = pin ? DAC_OUTPUTBUFFER_ENABLE : DAC_OUTPUTBUFFER_DISABLE;
Expand All @@ -64,8 +76,6 @@ namespace hal

result = HAL_DAC_Start(&dac.handle, channel);
assert(result == HAL_OK);

dac.Set(channel, DAC_ALIGN_12B_R, std::min(static_cast<uint32_t>(value), (infra::Bit<uint32_t>(12) - 1)));
}

DacStm::DacStm(uint8_t oneBasedIndex)
Expand Down
2 changes: 2 additions & 0 deletions hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace hal
void Set(uint16_t value) override;

private:
void Configure();

infra::Optional<AnalogPinStm> pin;
DacStm& dac;
uint32_t channel;
Expand Down
1 change: 0 additions & 1 deletion hal_st/stm32fxxx/UartStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "hal/interfaces/SerialCommunication.hpp"
#include "hal_st/cortex/InterruptCortex.hpp"
#include "hal_st/stm32fxxx/GpioStm.hpp"
#include "infra/util/Optional.hpp"

namespace hal
{
Expand Down
8 changes: 1 addition & 7 deletions hal_st/stm32fxxx/UartStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
#include "hal_st/cortex/InterruptCortex.hpp"
#include "hal_st/stm32fxxx/DmaStm.hpp"
#include "hal_st/stm32fxxx/GpioStm.hpp"
#include "hal_st/stm32fxxx/UartStm.hpp"
#include <cstdint>

#include DEVICE_HEADER

namespace hal
{
#if defined(HAS_PERIPHERAL_LPUART)
struct LpUart
{};

extern const LpUart lpUart;
#endif

namespace detail
{

Expand Down

0 comments on commit 2e97074

Please sign in to comment.