Skip to content

Commit

Permalink
⬆️ Support libhal-util/^3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Khalil Estell authored and kammce committed Aug 6, 2023
1 parent 5df4f2d commit 1c5227a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
5 changes: 2 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.files import copy
from conan.tools.build import check_min_cppstd
from conan.errors import ConanInvalidConfiguration
import os


Expand All @@ -27,7 +26,7 @@

class libhal_arm_cortex_conan(ConanFile):
name = "libhal-armcortex"
version = "2.0.2"
version = "2.0.3"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://libhal.github.io/libhal-armcortex"
Expand Down Expand Up @@ -68,7 +67,7 @@ def build_requirements(self):

def requirements(self):
self.requires("libhal/[^2.0.0]")
self.requires("libhal-util/[^2.0.0]")
self.requires("libhal-util/[^3.0.0]")

def layout(self):
cmake_layout(self)
Expand Down
4 changes: 4 additions & 0 deletions include/libhal-armcortex/system_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#pragma once

/**
* @brief libhal drivers for the ARM Cortex-M series of processors
*
*/
namespace hal::cortex_m {
/**
* @brief Enable the floating point unit coprocessor
Expand Down
8 changes: 4 additions & 4 deletions src/systick_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ namespace hal::cortex_m {

void start()
{
hal::bit::modify(sys_tick->control)
hal::bit_modify(sys_tick->control)
.set<systick_control_register::enable_counter>();
}

void stop()
{
hal::bit::modify(sys_tick->control)
hal::bit_modify(sys_tick->control)
.clear<systick_control_register::enable_counter>();
}

Expand All @@ -55,7 +55,7 @@ void systick_timer::register_cpu_frequency(hertz p_frequency,
// reloading of the register and will stop the timer.
sys_tick->current_value = 0;

auto control = hal::bit::value<std::uint32_t>(0);
auto control = hal::bit_value<std::uint32_t>(0);
control.set<systick_control_register::enable_interrupt>();

if (p_source == clock_source::processor) {
Expand All @@ -79,7 +79,7 @@ systick_timer::~systick_timer()
result<systick_timer::is_running_t> systick_timer::driver_is_running()
{
auto running_bit = static_cast<bool>(
hal::bit::extract<systick_control_register::enable_counter>(
hal::bit_extract<systick_control_register::enable_counter>(
sys_tick->control));
return is_running_t{ .is_running = running_bit };
}
Expand Down
10 changes: 5 additions & 5 deletions src/systick_timer_reg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ struct systick_register_t
const volatile uint32_t calib;
};

/// Namespace containing the bitmask objects that are used to manipulate the
/// Namespace containing the bit_mask objects that are used to manipulate the
/// ARM Cortex Mx SysTick Timer.
namespace systick_control_register {
/// When set to 1, takes the contents of the reload counter, writes it to
/// the current_value register and begins counting down to zero. Setting
/// this to zero stops the counter. Restarting the counter will restart the
/// count.
static constexpr auto enable_counter = hal::bit::mask::from<0>();
static constexpr auto enable_counter = hal::bit_mask::from<0>();

/// When SysTick timer's count goes from 1 to 0, if this bit is set, the
/// SysTick interrupt will fire.
static constexpr auto enable_interrupt = hal::bit::mask::from<1>();
static constexpr auto enable_interrupt = hal::bit_mask::from<1>();

/// If set to 0, clock source is external, if set to 1, clock source follows
/// the processor clock.
static constexpr auto clock_source = hal::bit::mask::from<2>();
static constexpr auto clock_source = hal::bit_mask::from<2>();

/// Set to 1 when count falls from 1 to 0. This bit is cleared on the next
/// read of this register.
static constexpr auto count_flag = hal::bit::mask::from<16>();
static constexpr auto count_flag = hal::bit_mask::from<16>();
}; // namespace systick_control_register

/// The address of the sys_tick register
Expand Down

0 comments on commit 1c5227a

Please sign in to comment.