Skip to content

Commit 6127ddb

Browse files
authored
Merge pull request #278 from HyperloopUPV-H8/development
v2.5.0
2 parents 9dc221b + 4cbcd50 commit 6127ddb

47 files changed

Lines changed: 283 additions & 208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Inc/C++Utilities/CppUtils.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <memory>
2828
#include <random>
2929
#include <typeinfo>
30-
#include <optional>
3130
#include <forward_list>
3231
#include <ostream>
3332
#include <cstring>
@@ -41,7 +40,6 @@ namespace chrono = std::chrono;
4140
namespace placeholders = std::placeholders;
4241

4342
using std::map;
44-
using std::optional;
4543
using std::array;
4644
using std::span;
4745
using std::pair;
@@ -59,7 +57,6 @@ using std::integral_constant;
5957
using std::snprintf;
6058
using std::make_unique;
6159
using std::unique_ptr;
62-
using std::string;
6360
using std::unordered_map;
6461
using std::vector;
6562
using std::queue;

Inc/HALAL/Services/ADC/ADC.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class ADC {
6464
Instance(Peripheral* peripheral, uint32_t channel);
6565
};
6666

67-
static optional<uint8_t> inscribe(Pin pin);
67+
static uint8_t inscribe(Pin pin);
6868
static void start();
6969
static void turn_on(uint8_t id);
7070
static float get_value(uint8_t id);
71-
static optional<uint16_t> get_int_value(uint8_t id);
71+
static uint16_t get_int_value(uint8_t id);
7272

7373
static Peripheral peripherals[3];
7474

Inc/HALAL/Services/Communication/FDCAN/FDCAN.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class FDCAN{
104104
static FDCAN::Instance instance2;
105105
static FDCAN::Instance instance3;
106106

107-
static optional<uint8_t> inscribe(FDCAN::Peripheral& fdcan);
107+
static uint8_t inscribe(FDCAN::Peripheral& fdcan);
108108

109109
static void start();
110110

Inc/HALAL/Services/Communication/I2C/I2C.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class I2C {
8282
* @param uart I2C peripheral to register.
8383
* @return uint8_t Id of the service.
8484
*/
85-
static optional<uint8_t> inscribe(I2C::Peripheral &i2c);
86-
static optional<uint8_t> inscribe(I2C::Peripheral &i2c, uint8_t address);
85+
static uint8_t inscribe(I2C::Peripheral &i2c);
86+
static uint8_t inscribe(I2C::Peripheral &i2c, uint8_t address);
8787

8888
/**
8989
* @brief This method initializes all registered I2Cs. The peripherals

Inc/HALAL/Services/Communication/SPI/SPI.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class SPI{
9898
* @param spi SPI peripheral to register.
9999
* @return uint8_t Id of the service.
100100
*/
101-
static optional<uint8_t> inscribe(SPI::Peripheral& spi);
101+
static uint8_t inscribe(SPI::Peripheral& spi);
102102

103103
/**
104104
* @brief Method that initializes all enrolled SPI peripherals

Inc/HALAL/Services/Communication/UART/UART.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#pragma once
88

99
#include "C++Utilities/CppUtils.hpp"
10+
#include "ErrorHandler/ErrorHandler.hpp"
1011
#include "PinModel/Pin.hpp"
1112
#include "Packets/RawPacket.hpp"
1213

@@ -106,7 +107,7 @@ class UART{
106107
* @param uart UART peripheral to register.
107108
* @return uint8_t Id of the service.
108109
*/
109-
static optional<uint8_t> inscribe(UART::Peripheral& uart);
110+
static uint8_t inscribe(UART::Peripheral& uart);
110111

111112
/**
112113
* @brief This method initializes all registered UARTs. The peripherals

Inc/HALAL/Services/DigitalInputService/DigitalInputService.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#pragma once
88
#include "PinModel/Pin.hpp"
9+
#include "ErrorHandler/ErrorHandler.hpp"
910

1011
#ifdef HAL_GPIO_MODULE_ENABLED
1112
class DigitalInput{
@@ -14,6 +15,6 @@ class DigitalInput{
1415
static uint8_t id_counter;
1516

1617
static uint8_t inscribe(Pin& pin);
17-
static optional<PinState> read_pin_state(uint8_t id);
18+
static PinState read_pin_state(uint8_t id);
1819
};
1920
#endif

Inc/HALAL/Services/EXTI/EXTI.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class ExternalInterrupt {
3333
static map<uint16_t, Instance> instances;
3434
static uint8_t id_counter;
3535

36-
static optional<uint8_t> inscribe(Pin& pin, function<void()>&& action, TRIGGER trigger=RISING);
36+
static uint8_t inscribe(Pin& pin, function<void()>&& action, TRIGGER trigger=RISING);
3737
static void start();
3838
static void turn_on(uint8_t id);
3939
static void turn_off(uint8_t id);
40-
static optional<bool> get_pin_value(uint8_t id);
40+
static bool get_pin_value(uint8_t id);
4141
};
4242
#endif

Inc/HALAL/Services/Encoder/Encoder.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Encoder {
3131
* @param pin1 First pin of the encoder
3232
* @param pin2 Second pin of the encoder
3333
*
34-
* @retval optional<uint8_t> Id of the service or empty if the pin pair is not valid
34+
* @retval uint8_t Id of the service
3535
*/
36-
static optional<uint8_t> inscribe(Pin& pin1, Pin& pin2);
36+
static uint8_t inscribe(Pin& pin1, Pin& pin2);
3737

3838
static void start();
3939

@@ -62,17 +62,17 @@ class Encoder {
6262
* @brief Get the CNT value of the encoder
6363
*
6464
* @param id Id of the encoder
65-
* @return optional<uint32_t> CNT value if the id is valid, empty if not
65+
* @return uint32_t CNT value if the id is valid
6666
*/
67-
static optional<uint32_t> get_counter(uint8_t id);
67+
static uint32_t get_counter(uint8_t id);
6868

6969
/**
7070
* @brief Get the encoder direction
7171
*
7272
* @param id Id
73-
* @return optional<bool> Encoder direction if id is valid, empty if not
73+
* @return bool Encoder direction if id is valid
7474
*/
75-
static optional<bool> get_direction(uint8_t id);
75+
static bool get_direction(uint8_t id);
7676

7777
static void init(TimerPeripheral* encoder);
7878
};

Inc/HALAL/Services/InputCapture/InputCapture.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ class InputCapture {
3131
static map<Pin, InputCapture::Instance> available_instances;
3232
static uint8_t id_counter;
3333

34-
static optional<uint8_t> inscribe(Pin& pin);
34+
static uint8_t inscribe(Pin& pin);
3535
static void turn_on(uint8_t id);
3636
static void turn_off(uint8_t id);
37-
static optional<uint32_t> read_frequency(uint8_t id);
38-
static optional<uint8_t> read_duty_cycle(uint8_t id);
37+
static uint32_t read_frequency(uint8_t id);
38+
static uint8_t read_duty_cycle(uint8_t id);
3939
static Instance find_instance_by_channel(uint32_t channel);
4040
};
4141

0 commit comments

Comments
 (0)