Skip to content

Commit

Permalink
Merge pull request #543 from ckormanyos/modernize_syntax
Browse files Browse the repository at this point in the history
Modernize syntax
  • Loading branch information
ckormanyos authored Aug 6, 2024
2 parents c70368d + fc85e0f commit 96d4b02
Show file tree
Hide file tree
Showing 49 changed files with 515 additions and 815 deletions.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ while core 0 enters an endless, idle loop.
Ozone debug files are supplied for this system for those interested.
Reverse engineering of the complicated (and scantly documented)
dual-core startup originated in and have been taken from (with many thanks)
[Chalandi/Blinky_Pico_dual_core_nosdk](https://github.com/Chalandi/Blinky_Pico_dual_core_nosdk).
from the `Blinky_Pico_dual_core_nosdk`
[repo](https://github.com/Chalandi/Blinky_Pico_dual_core_nosdk).

Target `v850es_fx2` uses a classic Renesas(R) V850es/Fx2 core.
The upd703231 microcontroller derivative on an F-Line _Drive_ _It_
Expand Down
1 change: 0 additions & 1 deletion ref_app/ref_app.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,6 @@
<ClInclude Include="src\util\utility\util_alignas.h" />
<ClInclude Include="src\util\utility\util_baselexical_cast.h" />
<ClInclude Include="src\util\utility\util_bit_mask.h" />
<ClInclude Include="src\util\utility\util_circular_buffer.h" />
<ClInclude Include="src\util\utility\util_communication.h" />
<ClInclude Include="src\util\utility\util_constexpr_algorithm_unsafe.h" />
<ClInclude Include="src\util\utility\util_constexpr_cmath_unsafe.h" />
Expand Down
3 changes: 0 additions & 3 deletions ref_app/ref_app.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1206,9 +1206,6 @@
<ClInclude Include="src\util\memory\util_static_allocator.h">
<Filter>src\util\memory</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_circular_buffer.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\mcal\stm32f100\mcal_port.h">
<Filter>src\mcal\stm32f100</Filter>
</ClInclude>
Expand Down
46 changes: 23 additions & 23 deletions ref_app/src/math/functions/math_functions_hypergeometric.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2014 - 2018.
// Copyright Christopher Kormanyos 2014 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H_
#define MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H_
#ifndef MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H
#define MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H

#include <util/memory/util_ring_allocator.h>
#include <util/utility/util_dynamic_array.h>

#include <algorithm>
#include <array>
Expand All @@ -17,17 +20,14 @@
#include <numeric>
#include <vector>

#include <util/memory/util_ring_allocator.h>
#include <util/utility/util_dynamic_array.h>

namespace math
{
namespace functions
{
template<typename T>
T hypergeometric_0f1(T b,
auto hypergeometric_0f1(T b,
T x,
T tolerance = std::numeric_limits<T>::epsilon() * T(10))
T tolerance = std::numeric_limits<T>::epsilon() * T(10)) -> T
{
// Compute the Taylor series representation of hypergeometric_0f1.
// There are no checks on input range or parameter boundaries.
Expand Down Expand Up @@ -70,22 +70,22 @@
}

template<typename T>
T hypergeometric_2f1(T a,
auto hypergeometric_2f1(T a,
T b,
T c,
T x,
T tolerance = std::numeric_limits<T>::epsilon() * T(10))
T tolerance = std::numeric_limits<T>::epsilon() * T(10)) -> T
{
// Compute the Taylor series representation of hypergeometric_2f1.
// There are no checks on input range or parameter boundaries.

T x_pow_n_div_n_fact (x);
T pochhammer_sequence_a(a);
T pochhammer_sequence_b(b);
T pochhammer_sequence_c(c);
T ap (a);
T bp (b);
T cp (c);
T x_pow_n_div_n_fact { x };
T pochhammer_sequence_a { a };
T pochhammer_sequence_b { b };
T pochhammer_sequence_c { c };
T ap { a };
T bp { b };
T cp { c };

T hypergeometric_2f1_result = T(1) + (((pochhammer_sequence_a * pochhammer_sequence_b) / pochhammer_sequence_c) * x_pow_n_div_n_fact);

Expand Down Expand Up @@ -125,12 +125,12 @@
template<typename T,
typename iterator_a_type,
typename iterator_b_type>
T hypergeometric_pfq(iterator_a_type coefficients_a_begin,
auto hypergeometric_pfq(iterator_a_type coefficients_a_begin,
iterator_a_type coefficients_a_end,
iterator_b_type coefficients_b_begin,
iterator_b_type coefficients_b_end,
T x,
T tolerance = std::numeric_limits<T>::epsilon() * T(10))
T tolerance = std::numeric_limits<T>::epsilon() * T(10)) -> T
{
const std::ptrdiff_t count_of_a_terms = std::distance(coefficients_a_begin, coefficients_a_end);
const std::ptrdiff_t count_of_b_terms = std::distance(coefficients_b_begin, coefficients_b_end);
Expand Down Expand Up @@ -161,10 +161,10 @@
T x_pow_n_div_n_fact(x);

// Define an allocator type for use in the containers below.
typedef util::ring_allocator<T> allocator_type;
using allocator_type = util::ring_allocator<T>;

// Define a container type for the upcoming calculation.
typedef util::dynamic_array<T, allocator_type> container_type;
using container_type = util::dynamic_array<T, allocator_type>;

// The pochhammer symbols for the multiplications in the series expansion
// will be stored in non-constant STL vectors.
Expand Down Expand Up @@ -192,7 +192,7 @@

T hypergeometric_pfq_result = my_one + first_term;

std::uint_fast16_t n;
std::uint_fast16_t n { };

// Calculate the maximum number of iterations allowed.
const std::uint_fast16_t max_iteration = static_cast<std::uint_fast16_t>(std::numeric_limits<T>::digits10 * 10);
Expand Down Expand Up @@ -247,4 +247,4 @@
}
} // namespace math::functions

#endif // MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H_
#endif // MATH_FUNCTIONS_HYPERGEOMETRIC_2014_04_29_H
2 changes: 1 addition & 1 deletion ref_app/src/mcal/avr/mcal_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <mcal_port.h>
#include <mcal_wdg.h>

void mcal::cpu::init()
auto mcal::cpu::init() -> void
{
mcal::wdg::init(nullptr);
mcal::port::init(nullptr);
Expand Down
12 changes: 6 additions & 6 deletions ref_app/src/mcal/avr/mcal_cpu.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2020.
// Copyright Christopher Kormanyos 2007 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef MCAL_CPU_2009_02_14_H_
#define MCAL_CPU_2009_02_14_H_
#ifndef MCAL_CPU_2009_02_14_H
#define MCAL_CPU_2009_02_14_H

#include <cstdint>

Expand All @@ -16,10 +16,10 @@
{
void init();

inline void post_init() { }
inline auto post_init() -> void { }

inline void nop() noexcept { asm volatile("nop"); }
inline auto nop() noexcept -> void { asm volatile("nop"); }
}
}

#endif // MCAL_CPU_2009_02_14_H_
#endif // MCAL_CPU_2009_02_14_H
25 changes: 17 additions & 8 deletions ref_app/src/mcal/avr/mcal_eep.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2018 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <mcal_cpu.h>
#include <mcal_eep.h>
#include <mcal_reg.h>

namespace
namespace local
{
bool mcal_eep_is_busy()
auto mcal_eep_is_busy() -> bool;

auto mcal_eep_is_busy() -> bool
{
return (mcal::reg::reg_access_static<std::uint8_t,
std::uint8_t,
mcal::reg::eecr,
UINT8_C(1)>::bit_get() == true);
}
}
} // namespace local

void mcal::eep::init(const config_type*)
auto mcal::eep::init(const config_type*) -> void
{
}

void mcal::eep::write(const address_type addr, const std::uint8_t data)
auto mcal::eep::write(const address_type addr, const std::uint8_t data) -> void
{
while(mcal_eep_is_busy())
while(local::mcal_eep_is_busy())
{
mcal::cpu::nop();
}
Expand All @@ -45,9 +54,9 @@ void mcal::eep::write(const address_type addr, const std::uint8_t data)
UINT8_C(1)>::bit_set();
}

std::uint8_t mcal::eep::read(const address_type addr)
auto mcal::eep::read(const address_type addr) -> std::uint8_t
{
while(mcal_eep_is_busy())
while(local::mcal_eep_is_busy())
{
mcal::cpu::nop();
}
Expand Down
19 changes: 13 additions & 6 deletions ref_app/src/mcal/avr/mcal_eep.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#ifndef MCAL_EEP_2018_12_15_H_
#define MCAL_EEP_2018_12_15_H_
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2018 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef MCAL_EEP_2018_12_15_H
#define MCAL_EEP_2018_12_15_H

#include <cstdint>

Expand All @@ -10,11 +17,11 @@
using config_type = void;
using address_type = std::uint_fast16_t;

void init(const config_type*);
auto init(const config_type*) -> void;

void write(const address_type addr, const std::uint8_t data);
std::uint8_t read (const address_type addr);
auto write(const address_type addr, const std::uint8_t data)-> void;
auto read (const address_type addr) -> std::uint8_t;
}
}

#endif // MCAL_EEP_2018_12_15_H_
#endif // MCAL_EEP_2018_12_15_H
2 changes: 1 addition & 1 deletion ref_app/src/mcal/avr/mcal_gpt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2023.
// Copyright Christopher Kormanyos 2007 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down
4 changes: 2 additions & 2 deletions ref_app/src/mcal/avr/mcal_irq.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2023.
// Copyright Christopher Kormanyos 2007 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <mcal_irq.h>

void mcal::irq::init(const config_type*)
auto mcal::irq::init(const config_type*) -> void
{
mcal::irq::enable_all();
}
14 changes: 7 additions & 7 deletions ref_app/src/mcal/avr/mcal_irq.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2023.
// Copyright Christopher Kormanyos 2007 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef MCAL_IRQ_2010_04_10_H_
#define MCAL_IRQ_2010_04_10_H_
#ifndef MCAL_IRQ_2010_04_10_H
#define MCAL_IRQ_2010_04_10_H

namespace mcal
{
namespace irq
{
typedef void config_type;

void init(const config_type*);
auto init(const config_type*) -> void;

inline void enable_all () noexcept { asm volatile("sei"); }
inline void disable_all() noexcept { asm volatile("cli"); }
inline auto enable_all () noexcept -> void { asm volatile("sei"); }
inline auto disable_all() noexcept -> void { asm volatile("cli"); }
}
}

#endif // MCAL_IRQ_2010_04_10_H_
#endif // MCAL_IRQ_2010_04_10_H
4 changes: 2 additions & 2 deletions ref_app/src/mcal/avr/mcal_led.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2020.
// Copyright Christopher Kormanyos 2007 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -8,7 +8,7 @@
#include <mcal_led.h>
#include <mcal_led/mcal_led_port.h>

mcal::led::led_base& mcal::led::led0()
auto mcal::led::led0() -> mcal::led::led_base&
{
using led0_port_type = mcal::port::port_pin<std::uint8_t,
std::uint8_t,
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/avr/mcal_led.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
namespace led
{
led_base& led0();
auto led0() -> led_base&;
}
}

Expand Down
8 changes: 4 additions & 4 deletions ref_app/src/mcal/avr/mcal_memory_progmem.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2019 - 2023.
// Copyright Christopher Kormanyos 2019 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef MCAL_MEMORY_PROGMEM_2019_08_17_H_
#define MCAL_MEMORY_PROGMEM_2019_08_17_H_
#ifndef MCAL_MEMORY_PROGMEM_2019_08_17_H
#define MCAL_MEMORY_PROGMEM_2019_08_17_H

#include <stddef.h>

Expand Down Expand Up @@ -59,4 +59,4 @@
}
#endif

#endif // MCAL_MEMORY_PROGMEM_2019_08_17_H_
#endif // MCAL_MEMORY_PROGMEM_2019_08_17_H
Loading

0 comments on commit 96d4b02

Please sign in to comment.