mirror of
https://github.com/ETLCPP/etl.git
synced 2026-07-30 16:26:17 +08:00
Various fixes and cleanup (#1507)
* Fix histogram test Use different Start index so skipped start_index copy would not get unnoticed in the test. * Fix several test_vector_* for valid data Instead of comparing the moved-from data which is invalid, compare with the valid initial_data. * Fix test_vector to check for the correct iterator position after erase This was done before, but a recent change dropped it. * Fix bit_stream: Guard nbits > 0 to prevent division by zero * Cleanup --------- Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
parent
22686f869e
commit
08b9c371a0
@ -188,7 +188,7 @@ A nested class that is sent to the user defined callback function.
|
||||
notification()
|
||||
```
|
||||
**Description**
|
||||
Default contructor.
|
||||
Default constructor.
|
||||
Initialises to a default constructed descriptor and a count of zero.
|
||||
|
||||
---
|
||||
|
||||
@ -39,7 +39,7 @@ type: hextra-home
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="https://etlcpp.github.io/etl/"><img src="https://github.com/ETLCPP/etl/actions/workflows/coverage.yml/badge.svg" alt="coverage"">
|
||||
<a href="https://etlcpp.github.io/etl/"><img src="https://github.com/ETLCPP/etl/actions/workflows/coverage.yml/badge.svg" alt="coverage"></a>
|
||||
<a href="https://www.codacy.com/manual/jwellbelove/etl"><img src="https://api.codacy.com/project/badge/Grade/3c14cd918ccf40008d0bcd7b083d5946" alt="Codacy"></a>
|
||||
</div>
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ This means you can find intersection points relative to a fixed reference line.
|
||||
|
||||

|
||||
|
||||
## Refection
|
||||
## Reflection
|
||||
|
||||
This describes reflecting a point across a reference line.
|
||||
It uses the intersection method described above.
|
||||
|
||||
@ -18,7 +18,7 @@ This may be used to implement a platform abstraction layer that allows an embedd
|
||||
| Template | Description |
|
||||
| ----------------- | ------------------------------------------------------------------------- |
|
||||
| etl::function | Callbacks to free or member functions taking zero or one parameter.<br/>Function pointer at runtime. |
|
||||
| etl::function_fv | Callback to a free function taking no parameters. (Functiion Void).<br/>Function pointer at compile time. |
|
||||
| etl::function_fv | Callback to a free function taking no parameters. (Function Void).<br/>Function pointer at compile time. |
|
||||
| etl::function_fp | Callback to a free function taking one parameter. (Function Parameter).<br/> Function pointer at compile time.
|
||||
| etl::function_mv | Callback to a member function taking no parameters. (Member Void).<br/>Function pointer at compile time. |
|
||||
| etl::function_imv | Callback to a member function taking no parameters. (Instance Member Void ).<br/>Instance reference and function pointer at compile time. |
|
||||
|
||||
@ -15,7 +15,7 @@ template <typename TFunction, size_t Size, typename TSlot = etl::delegate<TFunct
|
||||
class signal
|
||||
```
|
||||
`TFunction` The callback function signature.
|
||||
`Size` The maximum numbr of slots for the signal.
|
||||
`Size` The maximum number of slots for the signal.
|
||||
`TSlot` The callback slot type. Default = `etl::delegate<TFunction>`
|
||||
|
||||
## Types
|
||||
|
||||
@ -112,7 +112,7 @@ ETL_CONSTEXPR14
|
||||
etl::chrono::duration<TRep, TPeriod> operator =(const etl::chrono::duration<TRep2, TPeriod2>& other) ETL_NOEXCEPT
|
||||
```
|
||||
|
||||
### Convertion
|
||||
### Conversion
|
||||
```cpp
|
||||
ETL_CONSTEXPR14
|
||||
TRep count() const
|
||||
|
||||
@ -20,7 +20,7 @@ class month_weekday
|
||||
ETL_CONSTEXPR
|
||||
month_weekday()
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Default constructor.
|
||||
|
||||
---
|
||||
@ -31,7 +31,7 @@ month_weekday(const etl::chrono::month& m,
|
||||
const etl::chrono::weekday_indexed& wd)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Construct from month and weekday_indexed.
|
||||
|
||||
## Access
|
||||
@ -75,7 +75,7 @@ bool operator ==(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Equality operator.
|
||||
|
||||
---
|
||||
@ -86,7 +86,7 @@ bool operator !=(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Inequality operator.
|
||||
|
||||
---
|
||||
@ -97,7 +97,7 @@ bool operator <(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Less-than operator.
|
||||
|
||||
---
|
||||
@ -108,7 +108,7 @@ bool operator <=(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Less-than-equal operator.
|
||||
|
||||
---
|
||||
@ -119,7 +119,7 @@ bool operator <(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Greater-than operator.
|
||||
|
||||
---
|
||||
@ -130,7 +130,7 @@ bool operator <=(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Greater-than-equal operator.
|
||||
|
||||
---
|
||||
@ -141,7 +141,7 @@ auto operator <=>(const etl::chrono::month_weekday& lhs,
|
||||
const etl::chrono::month_weekday& rhs)
|
||||
ETL_NOEXCEPT
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Spaceship operator.
|
||||
C++20
|
||||
|
||||
@ -151,6 +151,6 @@ C++20
|
||||
template <typename TRep, typename TPeriod>
|
||||
struct hash<etl::chrono::month_weekday>
|
||||
```
|
||||
**Decription**
|
||||
**Description**
|
||||
Hash function for `etl::chrono::month_weekday`.
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ The year.
|
||||
|
||||
---
|
||||
|
||||
```coo
|
||||
```cpp
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
etl::chrono::month month() const
|
||||
|
||||
@ -356,7 +356,7 @@ bool equal(const etl::span<T1, N1>& lhs, const etl::span<T2, N2>& rhs)
|
||||
```
|
||||
**Description**
|
||||
Equality function.
|
||||
Performs a comparision of the range values.
|
||||
Performs a comparison of the range values.
|
||||
Returns `true` if one of the following are `true`
|
||||
1. Both spans are empty.
|
||||
2. They both point to the same range of data.
|
||||
|
||||
@ -72,7 +72,7 @@ generic_pool_ext(char* buffer, size_t size)
|
||||
```
|
||||
**Description**
|
||||
For `etl::generic_pool_ext`.
|
||||
Constructs a generic_pool from an external bufffer.
|
||||
Constructs a generic_pool from an external buffer.
|
||||
No elements are constructed.
|
||||
|
||||
## Operations
|
||||
|
||||
@ -94,7 +94,7 @@ pool_ext(char* buffer, size_t size)
|
||||
```
|
||||
**Description**
|
||||
For `etl::pool_ext`.
|
||||
Constructs a pool from an external bufffer.
|
||||
Constructs a pool from an external buffer.
|
||||
No elements are constructed.
|
||||
|
||||
## Operations
|
||||
|
||||
@ -17,7 +17,7 @@ Uses `etl::less` as the default key comparison method.
|
||||
etl::const_multiset<typename TKey, size_t Size, TKeyCompare = etl::less>
|
||||
```
|
||||
|
||||
**Enternal storage**
|
||||
**Internal storage**
|
||||
```cpp
|
||||
etl::const_multiset_ext<typename TKey, TKeyCompare = etl::less>
|
||||
```
|
||||
|
||||
@ -17,7 +17,7 @@ Uses `etl::less` as the default key comparison method.
|
||||
etl::const_set<typename TKey, size_t Size, TKeyCompare = etl::less>
|
||||
```
|
||||
|
||||
**Enternal storage**
|
||||
**Internal storage**
|
||||
```cpp
|
||||
etl::const_set_ext<typename TKey, TKeyCompare = etl::less>
|
||||
```
|
||||
|
||||
@ -3,4 +3,4 @@ title: "Variadics"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
Containers tha accept multiple types.
|
||||
Containers that accept multiple types.
|
||||
@ -22,7 +22,7 @@ etl::packet<typename TBase, size_t SIZE, size_t ALIGNMENT>
|
||||
|
||||
`base_t` = `TBase`
|
||||
|
||||
## Contructors
|
||||
## Constructors
|
||||
|
||||
**C++03**
|
||||
```cpp
|
||||
|
||||
@ -30,7 +30,7 @@ Lower case class and function names, separated by an underscore.
|
||||
`funky_container`
|
||||
`do_something`
|
||||
|
||||
### Nameing convension
|
||||
### Naming convention
|
||||
Use the same naming convention as the STL.
|
||||
If appropriate for the class, a set of `typedef`s should often be present to define types such as...
|
||||
|
||||
@ -159,7 +159,7 @@ class my_new_class
|
||||
```
|
||||
|
||||
### Layout
|
||||
When possible, try to tabluate the initialisation of multiple variables. It's a lot easier to read.
|
||||
When possible, try to tabulate the initialisation of multiple variables. It's a lot easier to read.
|
||||
Don't be too strict about it, if it would result in giant amounts of whitespace.
|
||||
|
||||
```cpp
|
||||
@ -240,4 +240,4 @@ When opening a new pull request, ensure that you include the following informati
|
||||
- Branches should be based on the branch `master`.
|
||||
`development` can change quite frequently, so I will rebase the your PR against it before merging.
|
||||
- For formatting help, you can use `clang-format`, or the convenience wrapper `treefmt`. See also [Source formatting]({{% relref "source-formatting.md" %}}).
|
||||
- Update the relevent documentation markdown file, found in `etl/docs`.
|
||||
- Update the relevant documentation markdown file, found in `etl/docs`.
|
||||
@ -83,19 +83,19 @@ These may be defined in the project settings or the user created `etl_profile.h`
|
||||
| `ETL_NODISCARD` | If `ETL_CPP11_SUPPORTED` is defined as `1` then this macro is defined as `[[nodiscard]]`, otherwise defined as blank.|
|
||||
| `ETL_DEPRECATED` | If `ETL_CPP14_SUPPORTED` is defined as `1` then this macro is defined as `[[deprecated]]`, otherwise defined as blank.|
|
||||
| `ETL_DEPRECATED_REASON(reason)` | If `ETL_CPP14_SUPPORTED` is defined as `1` then this macro is defined as `[[deprecated(reason)]]`, otherwise defined as blank.|
|
||||
| `ETL_FALLTHROUGH` | If `ETL_CPP17_SUPPORTED` is defined as `1` then this macro is defined as `[[falltrough]]`, otherwise defined as blank.|
|
||||
| `ETL_FALLTHROUGH` | If `ETL_CPP17_SUPPORTED` is defined as `1` then this macro is defined as `[[fallthrough]]`, otherwise defined as blank.|
|
||||
| `ETL_NORETURN` | If `ETL_CPP11_SUPPORTED` is defined as `1` then this macro is defined as `[[noreturn]]`, otherwise defined as blank.|
|
||||
| `ETL_OR_STD` | If ETL_NO_STL is defined and ETL_IN_UNIT_TEST is not then `ETL_OR_STD` is defined as `etl`, otherwise it is defined as `std`.|
|
||||
| `ETL_IN_UNIT_TEST` | If defined, then the code is being compiled in the unit tests.<br/>For internal ETL use only.|
|
||||
| `ETL_HAS_ATOMIC` | This is defined as `1` if the compiler supplies an atomic class, otherwise `0`.|
|
||||
| `ETL_INLINE_VAR` | If `ETL_CPP17_SUPPORTED` is defined as `1` then this macro is defined as `inline`, otherwise defined as blank.|
|
||||
| `ETL_USING_STL` | This macro will be defined as `0` & `1` dependant of whether `ETL_NO_STL` is defined or not.|
|
||||
| `ETL_USING_STL` | This macro will be defined as `0` & `1` depending on whether `ETL_NO_STL` is defined or not.|
|
||||
| `ETL_NOT_USING_STL` | Inversion of `ETL_USING_STL`.|
|
||||
| `ETL_USING_STLPORT` | This macro will be defined as `0` & `1` dependant of whether `ETL_STLPORT` is defined or not.|
|
||||
| `ETL_USING_STLPORT` | This macro will be defined as `0` & `1` depending on whether `ETL_STLPORT` is defined or not.|
|
||||
| `ETL_NOT_USING_STLPORT` | Inversion of `ETL_USING_STLPORT`.|
|
||||
| `ETL_USING_8BIT_TYPES` | This macro will be defined as `0` & `1` dependant of whether `CHAR_BIT == 8` or not.|
|
||||
| `ETL_USING_8BIT_TYPES` | This macro will be defined as `0` & `1` depending on whether `CHAR_BIT == 8` or not.|
|
||||
| `ETL_NOT_USING_8BIT_TYPES` | Inversion of `ETL_USING_8BIT_TYPES`.|
|
||||
| `ETL_USING_64BIT_TYPES` | This macro will be defined as `0` & `1` dependant of whether `ETL_NO_64BIT_TYPES` is defined or not.|
|
||||
| `ETL_USING_64BIT_TYPES` | This macro will be defined as `0` & `1` depending on whether `ETL_NO_64BIT_TYPES` is defined or not.|
|
||||
| `ETL_NOT_USING_64BIT_TYPES` | Inversion of `ETL_USING_64BIT_TYPES`.|
|
||||
| `ETL_HAS_ISTRING_REPAIR` | Set to `1` if the repair functionality for `etl::istring` is enabled, otherwise `0`.|
|
||||
| `ETL_HAS_IVECTOR_REPAIR` | Set to `1` if the repair functionality for `etl::ivector` is enabled, otherwise `0`.|
|
||||
@ -103,7 +103,7 @@ These may be defined in the project settings or the user created `etl_profile.h`
|
||||
| `ETL_IS_DEBUG_BUILD` | Set to `1` if in a debug build, otherwise `0`.|
|
||||
| `ETL_HAS_POLYMORPHIC_MESSAGES` | Set to `1` if messages are polymorphic, otherwise `0`.|
|
||||
| `ETL_HAS_ERROR_ON_STRING_TRUNCATION` | Set to `1` if truncated strings are an error, otherwise `0`.|
|
||||
| `ETL_USING_LIBC_WCHAR_H` | These macros will be defined as `0` & `1` dependant of whether `ETL_NO_LIBC_WCHAR_H` is defined or not.|
|
||||
| `ETL_USING_LIBC_WCHAR_H` | These macros will be defined as `0` & `1` depending on whether `ETL_NO_LIBC_WCHAR_H` is defined or not.|
|
||||
| `ETL_NOT_USING_LIBC_WCHAR_H` | Inversion of `ETL_USING_LIBC_WCHAR_H`.|
|
||||
| `ETL_USING_CPP11` | This is defined as `1` if the compiler supports C++11, otherwise `0`.|
|
||||
| `ETL_USING_CPP14` | This is defined as `1` if the compiler supports C++14, otherwise `0`.|
|
||||
|
||||
@ -30,13 +30,13 @@ etl::fixed_iterator(const etl::fixed_iterator&);
|
||||
```cpp
|
||||
Titerator get() const;
|
||||
```
|
||||
**Decscription**
|
||||
**Description**
|
||||
Get the internal iterator.
|
||||
|
||||
```cpp
|
||||
void get(TIterator it);
|
||||
```
|
||||
**Decscription**
|
||||
**Description**
|
||||
Set the iterator.
|
||||
|
||||
## Operators
|
||||
@ -44,7 +44,7 @@ Set the iterator.
|
||||
typename etl::iterator_traits<TIterator>::value_type operator *()
|
||||
const typename etl::iterator_traits<TIterator>::value_type operator *() const
|
||||
```
|
||||
**Decscription**
|
||||
**Description**
|
||||
Dereference operators
|
||||
|
||||
---
|
||||
@ -53,7 +53,7 @@ Dereference operators
|
||||
TIterator operator ->()
|
||||
const TIterator operator ->() const
|
||||
```
|
||||
**Decscription**
|
||||
**Description**
|
||||
Member dereference operators
|
||||
|
||||
---
|
||||
@ -61,7 +61,7 @@ Member dereference operators
|
||||
```cpp
|
||||
operator TIterator() const
|
||||
```
|
||||
**Decscription**
|
||||
**Description**
|
||||
Conversion operator
|
||||
|
||||
## Example
|
||||
|
||||
@ -177,7 +177,7 @@ bus2.subscribe(routerD);
|
||||
bus2.subscribe(routerC);
|
||||
|
||||
// Subscribe routerE to bus3.
|
||||
bus3.subscibe(routerE);
|
||||
bus3.subscribe(routerE);
|
||||
|
||||
// Assume all routers accept the same messages.
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ Click on the links to see the original Github page.
|
||||
[#1432](https://github.com/ETLCPP/etl/pull/1432) Simplify and fix test/run-syntax-checks.sh
|
||||
[#1433](https://github.com/ETLCPP/etl/pull/1433) Fix the case of using STL without pthreads but with mutexes
|
||||
[#1434](https://github.com/ETLCPP/etl/pull/1434) Remove unnecessary includes
|
||||
[#1437](https://github.com/ETLCPP/etl/pull/1437) ranges: Fix confict with Zephyr preprocessor definition
|
||||
[#1437](https://github.com/ETLCPP/etl/pull/1437) ranges: Fix conflict with Zephyr preprocessor definition
|
||||
[#1440](https://github.com/ETLCPP/etl/pull/1440) Make etl::variant capable for ROM placement and optimize runtime size
|
||||
[#1441](https://github.com/ETLCPP/etl/pull/1441) Make etl::variant capable for ROM placement and optimize runtime size
|
||||
[#1442](https://github.com/ETLCPP/etl/pull/1442) Fix format: float zero-padding, nested replacement width, octal alter…
|
||||
@ -152,7 +152,7 @@ Click on the links to see the original Github page.
|
||||
|
||||
**Issues:**
|
||||
[#1184](https://github.com/ETLCPP/etl/issues/1184) Request: Adding a method to check whether a etl::callback_timer_atomic is currently running
|
||||
[#1189](https://github.com/ETLCPP/etl/issues/1189) Request: make useage of osMutexRobust in etl::mutex optional
|
||||
[#1189](https://github.com/ETLCPP/etl/issues/1189) Request: make usage of osMutexRobust in etl::mutex optional
|
||||
[#1207](https://github.com/ETLCPP/etl/issues/1207) Monadic Operations for etl::expected
|
||||
[#1240](https://github.com/ETLCPP/etl/issues/1240) Add redundant semicolon checks to CMakeLists.txt and fix issues
|
||||
[#1241](https://github.com/ETLCPP/etl/issues/1241) Add -pedantic-errors to unit test CMakeLists.txt and fix issues
|
||||
@ -335,7 +335,7 @@ Removed redundant ETL_USING_WIDE_CHARACTERS
|
||||
Fixes:
|
||||
#1126 to_arithmetic-does-not-compile-on-C++98
|
||||
#1128 Request: Make Delegate Methods noexcept
|
||||
#1130 Use of etl::mem_copy for overlaped areas
|
||||
#1130 Use of etl::mem_copy for overlapped areas
|
||||
#1132 Make type_def Methods Noexcept
|
||||
#1143 v20.41.x, risc-v (esp32-c3) "No user defined specialisation of etl::underlying_type for this type"
|
||||
|
||||
@ -510,11 +510,11 @@ Fixes:
|
||||
#942 Warning on pragma c++20-compat
|
||||
#951 Can't get call_if to work because of etl::optional
|
||||
#956 Fix build error (etl::circular_buffer)
|
||||
#957 Support heterogenous lookup for maps
|
||||
#957 Support heterogeneous lookup for maps
|
||||
#959 Treat bitset with size_type
|
||||
#972 Template not allowed warning in parameter pack
|
||||
#979 QueuedMessageRouter does not work : message are not sent to queue
|
||||
#980 Documentation clarification: Add link from endianess to unaligned_type
|
||||
#980 Documentation clarification: Add link from endianness to unaligned_type
|
||||
#982 Added return to etl::optional emplace, fixed typo
|
||||
#984 Update Base64 Documentation
|
||||
#986 Added const iterators to span
|
||||
@ -639,7 +639,7 @@ Pull Requests:
|
||||
#905 Added support for type identity
|
||||
|
||||
Other:
|
||||
Reenabled address sanitizer for VS2022
|
||||
Re-enabled address sanitizer for VS2022
|
||||
|
||||
|
||||
20.38.16
|
||||
|
||||
@ -3,4 +3,4 @@ title: "Timers"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
Classes the implement timer based services.
|
||||
Classes that implement timer-based services.
|
||||
|
||||
@ -196,7 +196,7 @@ Test test;
|
||||
|
||||
//***************************************************************************
|
||||
// The interrupt guard type.
|
||||
// Saves and disables on contruction.
|
||||
// Saves and disables interrupts on construction.
|
||||
// Restores on destruction.
|
||||
//***************************************************************************
|
||||
struct InterruptGuard
|
||||
|
||||
@ -193,7 +193,7 @@ Message3 message3;
|
||||
|
||||
//***************************************************************************
|
||||
// The interrupt guard type.
|
||||
// Saves and disables on contruction.
|
||||
// Saves and disables on construction.
|
||||
// Restores on destruction.
|
||||
//***************************************************************************
|
||||
struct InterruptGuard
|
||||
|
||||
@ -15,7 +15,7 @@ struct timer
|
||||
{
|
||||
// Timer modes.
|
||||
struct mode
|
||||
{
|
||||
{
|
||||
enum
|
||||
{
|
||||
SINGLE_SHOT = false,
|
||||
|
||||
@ -19,7 +19,7 @@ This code demonstrates using the callback service for five example ARM interrupt
|
||||
`Timer3` has no entry in the callback service and will therefore trigger execution of the unhandled handler.
|
||||
|
||||
`USART1` and `USART2` interrupts are handled by instances of Uart.
|
||||
There callbacks are defined withing the class and are initialised in the Uart constructor.
|
||||
Their callbacks are defined within the class and are initialised in the Uart constructor.
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
@ -146,7 +146,7 @@ Uart uart1(0, USART1_IRQ_HANDLER);
|
||||
Uart uart2(1, USART2_IRQ_HANDLER);
|
||||
|
||||
// Declare a global callback for the timer.
|
||||
// Uses the most efficient callback type for a class, as everthing is known at compile time.
|
||||
// Uses the most efficient callback type for a class, as everything is known at compile time.
|
||||
etl::function_imp<Timer, size_t, timer, &Timer::InterruptHandler> timer_member_callback;
|
||||
|
||||
// Declare the callbacks for the free functions.
|
||||
|
||||
@ -13,7 +13,7 @@ This code demonstrates using the delegate service for five example ARM interrupt
|
||||
`Timer3` has no entry in the callback service and will therefore trigger execution of the unhandled handler.
|
||||
|
||||
`USART1` and `USART2` interrupts are handled by instances of `Uart`.
|
||||
There callbacks are defined withing the class and are initialised in the `Uart` constructor.
|
||||
Their callbacks are defined within the class and are initialised in the `Uart` constructor.
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
@ -137,7 +137,7 @@ Uart uart1(0, USART1_IRQ_HANDLER);
|
||||
Uart uart2(1, USART2_IRQ_HANDLER);
|
||||
|
||||
// Declare a global callback for the timer.
|
||||
// Uses the most efficient callback type for a class, as everthing is known at compile time.
|
||||
// Uses the most efficient callback type for a class, as everything is known at compile time.
|
||||
etl::delegate<void(size_t)> timer_member_callback =
|
||||
etl::delegate<void(size_t)>::create<Timer, timer, &Timer::InterruptHandler>();
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ To this end a template alias is defined; `etl::atomic_counted_message`, which us
|
||||
In a muti-threaded or interrupt driven system, a method must be derived to manage access to the pool.
|
||||
|
||||
All reference counted messages have an owner.
|
||||
Owners are obects based on `etl::ireference_counted_message_pool`.
|
||||
Owners are objects based on `etl::ireference_counted_message_pool`.
|
||||
|
||||
A reference counted message pool will allocate reference counted messages. The storage for these are allocated from a supplied memory block allocator.
|
||||
|
||||
@ -256,7 +256,7 @@ private:
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
// A message bus that can accomodate two subscribers.
|
||||
// A message bus that can accommodate two subscribers.
|
||||
//*****************************************************************************
|
||||
struct Bus : public etl::message_bus<2U>
|
||||
{
|
||||
|
||||
@ -248,15 +248,15 @@ namespace etl
|
||||
etl::optional<CustomType> read_unchecked<CustomType>(etl::bit_stream_reader& stream)
|
||||
{
|
||||
char c = stream.read_unchecked<char, 7U>();
|
||||
short s = stream.read_unchecked<short , 11U>();
|
||||
int32_t i = stream.read_unchecked<int32_t, 25U>();
|
||||
short s = stream.read_unchecked<short>(11U);
|
||||
int32_t i = stream.read_unchecked<int32_t>(25U);
|
||||
|
||||
return CustomType { c, s, i };
|
||||
}
|
||||
}
|
||||
|
||||
std::array<char, 100U> storage; // Assume the buffer gets filled with bit stream data.
|
||||
etl::bit_stream_reader bit_stream(storage.data(), storage.size());
|
||||
etl::bit_stream_reader bit_stream(storage.data(), storage.size(), etl::bit_order::msb_first);
|
||||
|
||||
// Read unchecked values from the stream.
|
||||
char c = etl::read_unchecked<char>(bit_stream, 6U);
|
||||
|
||||
@ -328,7 +328,7 @@ Sets the delegate to call after every write.
|
||||
callback_type get_callback() const
|
||||
```
|
||||
**Description**
|
||||
Gets the function to call afer every write.
|
||||
Gets the function to call after every write.
|
||||
|
||||
---
|
||||
|
||||
@ -397,13 +397,13 @@ namespace etl
|
||||
void write_unchecked<CustomType>(etl::bit_stream_reader& stream)
|
||||
{
|
||||
stream.write_unchecked<char, 7U>();
|
||||
stream.write_unchecked<short , 11U>();
|
||||
stream.write_unchecked<short, 11U>();
|
||||
stream.write_unchecked<int32_t, 25U>();
|
||||
}
|
||||
}
|
||||
|
||||
std::array<char, 100U> storage; // Assume the buffer gets filled with bit stream data.
|
||||
etl::bit_stream_reader bit_stream(storage.data(), storage.size());
|
||||
etl::bit_stream_writer bit_stream(storage.data(), storage.size(), etl::bit_order::msb_first);
|
||||
|
||||
// Write unchecked values to the stream.
|
||||
etl::write_unchecked<char>(bit_stream, 6U);
|
||||
|
||||
@ -7,11 +7,11 @@ title: "endian"
|
||||
Since: `TBC`
|
||||
{{< /callout >}}
|
||||
|
||||
Constants & utilities for endianess.
|
||||
Constants & utilities for endianness.
|
||||
|
||||
For endian specific integral types, see `unaligned_type`.
|
||||
|
||||
The values for endianness are dependant on the platform setup.
|
||||
The values for endianness are dependent on the platform setup.
|
||||
|
||||
If `ETL_ENDIAN_NATIVE` is defined by the user, then
|
||||
 `etl::endian::little = 0`
|
||||
|
||||
@ -16,7 +16,7 @@ You have a choice of:
|
||||
- Error log
|
||||
- No error checking
|
||||
|
||||
The type of error handler used is dependant on the compile time macro defined.
|
||||
The type of error handler used is dependent on the compile time macro defined.
|
||||
Note: This are usually set as a project wide definition.
|
||||
|
||||
| Macro | Actions |
|
||||
|
||||
@ -18,7 +18,7 @@ The `initializer_list` template class is a special case in that it *must* have a
|
||||
|
||||
This header will either include the standard `<initializer_list>` header, or attempt to define a `std::initializer_list` template class that is compatible with the current compiler.
|
||||
|
||||
The header will define `ETL_USING_INITIALIZER_LIST` to either `1` or `0` dependant of whether `std::initializer_list` is available or not.
|
||||
The header will define `ETL_USING_INITIALIZER_LIST` to either `1` or `0` dependent on whether `std::initializer_list` is available or not.
|
||||
|
||||
The ETL will select the STL version if you are using the STL and `ETL_FORCE_ETL_INITIALIZER_LIST` is not defined or,
|
||||
`ETL_FORCE_STD_INITIALIZER_LIST` is defined.
|
||||
|
||||
@ -695,7 +695,7 @@ namespace etl
|
||||
template <typename T>
|
||||
typename etl::enable_if<etl::is_integral<T>::value, bool>::type write(T value, uint_least8_t nbits = CHAR_BIT * sizeof(T))
|
||||
{
|
||||
bool success = (available(nbits) > 0U);
|
||||
bool success = (nbits > 0U) && (available(nbits) > 0U);
|
||||
|
||||
if (success)
|
||||
{
|
||||
@ -914,6 +914,7 @@ namespace etl
|
||||
template <typename T>
|
||||
void write_data(T value, uint_least8_t nbits)
|
||||
{
|
||||
ETL_ASSERT(nbits > 0U, ETL_ERROR_GENERIC("bit_stream_writer::write_data: nbits is zero"));
|
||||
ETL_ASSERT(nbits <= (CHAR_BIT * sizeof(T)), ETL_ERROR_GENERIC("bit_stream_writer::write_data: nbits too large"));
|
||||
|
||||
// Apply the byte order (endianness).
|
||||
@ -1305,6 +1306,7 @@ namespace etl
|
||||
template <typename T>
|
||||
T read_value(uint_least8_t nbits, bool is_signed)
|
||||
{
|
||||
ETL_ASSERT(nbits > 0U, ETL_ERROR_GENERIC("bit_stream_reader::read_value: nbits is zero"));
|
||||
ETL_ASSERT(nbits <= (CHAR_BIT * sizeof(T)), ETL_ERROR_GENERIC("bit_stream_reader::read_value: nbits too large"));
|
||||
|
||||
T value = 0;
|
||||
|
||||
@ -536,7 +536,10 @@ namespace etl
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Constructor.
|
||||
/// Sets the count thresholds.
|
||||
///\param valid The count for a valid state.
|
||||
///\param hold The count after valid for a hold state. Default = 0.
|
||||
///\param repeat The count after hold for a key repeat. Default = 0.
|
||||
//*************************************************************************
|
||||
void set(count_t valid, count_t hold = 0, count_t repeat = 0)
|
||||
{
|
||||
|
||||
@ -468,7 +468,7 @@ namespace etl
|
||||
explicit variant(etl::in_place_index_t<Index>, T const& value)
|
||||
: type_id(Index)
|
||||
{
|
||||
ETL_STATIC_ASSERT(Type_Id_Lookup<T>::type_id == Index, "Missmatched type");
|
||||
ETL_STATIC_ASSERT(Type_Id_Lookup<T>::type_id == Index, "Mismatched type");
|
||||
::new (static_cast<T*>(data)) T(value);
|
||||
type_id = Index;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
namespace private_variant
|
||||
{
|
||||
//***************************************************************************
|
||||
// Selects a do_operator inplementation that is configured for the number of
|
||||
// Selects a do_operator implementation that is configured for the number of
|
||||
// types.
|
||||
//***************************************************************************
|
||||
template <size_t NTypes>
|
||||
|
||||
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
namespace private_variant
|
||||
{
|
||||
//***************************************************************************
|
||||
// Selects a do_visitor inplementation that is configured for the number of
|
||||
// Selects a do_visitor implementation that is configured for the number of
|
||||
// types.
|
||||
//***************************************************************************
|
||||
template <size_t NTypes>
|
||||
|
||||
@ -3317,7 +3317,7 @@ namespace etl
|
||||
#else
|
||||
|
||||
//*********************************************
|
||||
// Assume that anything other than arithmetics
|
||||
// Assume that anything other than arithmetic
|
||||
// and pointers return false for the traits.
|
||||
//*********************************************
|
||||
|
||||
|
||||
@ -666,7 +666,7 @@ namespace etl
|
||||
unaligned_type_ext(unaligned_type_ext<T, Endian_Other> && other)
|
||||
: private_unaligned_type::unaligned_type_storage_ext<Size>(other.storage)
|
||||
{
|
||||
// If we're constructing from a different endianess then we need to
|
||||
// If we're constructing from a different endianness then we need to
|
||||
// reverse the data order.
|
||||
if (Endian != Endian_Other)
|
||||
{
|
||||
@ -728,7 +728,7 @@ namespace etl
|
||||
{
|
||||
this->storage = other.storage;
|
||||
|
||||
// If we're assigning from a different endianess then we need to reverse
|
||||
// If we're assigning from a different endianness then we need to reverse
|
||||
// the data order.
|
||||
if (Endian != Endian_Other)
|
||||
{
|
||||
|
||||
@ -270,7 +270,7 @@ namespace
|
||||
{
|
||||
IntRuntimeOffsetHistogram histogram1(Start, input2.begin(), input2.end());
|
||||
|
||||
IntRuntimeOffsetHistogram histogram2(Start);
|
||||
IntRuntimeOffsetHistogram histogram2(Start + 1);
|
||||
histogram2 = histogram1;
|
||||
|
||||
for (int key = Start; key < Start + static_cast<int>(Size); ++key)
|
||||
@ -300,7 +300,7 @@ namespace
|
||||
IntRuntimeOffsetHistogram histogram1(Start, input2.begin(), input2.end());
|
||||
IntRuntimeOffsetHistogram histogram_source(Start, input2.begin(), input2.end());
|
||||
|
||||
IntRuntimeOffsetHistogram histogram2(Start);
|
||||
IntRuntimeOffsetHistogram histogram2(Start + 1);
|
||||
histogram2 = etl::move(histogram_source);
|
||||
|
||||
for (int key = Start; key < Start + static_cast<int>(Size); ++key)
|
||||
|
||||
@ -1143,9 +1143,12 @@ namespace
|
||||
Compare_Data compare_data(initial_data.begin(), initial_data.end());
|
||||
Data data(initial_data.begin(), initial_data.end());
|
||||
|
||||
compare_data.erase(compare_data.begin() + 2, compare_data.begin() + 4);
|
||||
Compare_Data::iterator cdi = compare_data.erase(compare_data.begin() + 2, compare_data.begin() + 4);
|
||||
|
||||
data.erase(data.begin() + 2, data.begin() + 4);
|
||||
Data::iterator di = data.erase(data.begin() + 2, data.begin() + 4);
|
||||
|
||||
CHECK(cdi == compare_data.begin() + 2);
|
||||
CHECK(di == data.begin() + 2);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ namespace
|
||||
CHECK_EQUAL(0U, data.size());
|
||||
CHECK_EQUAL(initial_data.size(), other_data.size());
|
||||
|
||||
bool is_equal = std::equal(data.begin(), data.end(), other_data.begin());
|
||||
bool is_equal = std::equal(initial_data.begin(), initial_data.end(), other_data.begin());
|
||||
CHECK(is_equal);
|
||||
}
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ namespace
|
||||
CHECK_EQUAL(0U, data.size());
|
||||
CHECK_EQUAL(initial_data.size(), other_data.size());
|
||||
|
||||
bool is_equal = std::equal(data.begin(), data.end(), other_data.begin());
|
||||
bool is_equal = std::equal(initial_data.begin(), initial_data.end(), other_data.begin());
|
||||
CHECK(is_equal);
|
||||
}
|
||||
|
||||
|
||||
@ -311,7 +311,7 @@ namespace
|
||||
CHECK_EQUAL(0U, data.size());
|
||||
CHECK_EQUAL(initial_data.size(), other_data.size());
|
||||
|
||||
bool is_equal = std::equal(data.begin(), data.end(), other_data.begin());
|
||||
bool is_equal = std::equal(initial_data.begin(), initial_data.end(), other_data.begin());
|
||||
CHECK(is_equal);
|
||||
}
|
||||
|
||||
|
||||
@ -316,7 +316,7 @@ namespace
|
||||
CHECK_EQUAL(0U, data.size());
|
||||
CHECK_EQUAL(initial_data.size(), other_data.size());
|
||||
|
||||
bool is_equal = std::equal(data.begin(), data.end(), other_data.begin());
|
||||
bool is_equal = std::equal(initial_data.begin(), initial_data.end(), other_data.begin());
|
||||
CHECK(is_equal);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user