-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
78 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef INTERFACEPARAMS | ||
#define INTERFACEPARAMS | ||
#include "NativeEthernet.h" | ||
|
||
namespace EthParams | ||
{ | ||
uint8_t default_MCU_MAC_address[6] = | ||
{0x04, 0xe9, 0xe5, 0x10, 0x1f, 0x22}; | ||
|
||
const IPAddress default_MCU_ip(192, 168, 1, 30); | ||
const IPAddress default_TCU_ip(192, 168, 1, 68); | ||
|
||
const uint16_t default_protobuf_send_port = 2001; | ||
const uint16_t default_protobuf_recv_port = 2000; | ||
|
||
const IPAddress default_netmask(255, 255, 255, 0); | ||
const IPAddress default_gateway(192, 168, 0, 1); | ||
|
||
const uint16_t default_buffer_size = 512; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef PARAMETERINTERFACE | ||
#define PARAMETERINTERFACE | ||
#include "MCUStateMachine.h" | ||
#include "ht_eth.pb.h" | ||
#include "default_config.h" | ||
|
||
// yes, i know this is a singleton. im prototyping rn. | ||
// TODO review if I can just give this a pointer to an ethernet port | ||
class ParameterInterface | ||
{ | ||
public: | ||
ParameterInterface(): current_car_state_(CAR_STATE::STARTUP), params_need_sending_(false), config_(DEFAULT_CONFIG) {} | ||
|
||
void update_car_state(const CAR_STATE& state) | ||
{ | ||
current_car_state_ = state; | ||
} | ||
void update_config(const config &config) | ||
{ | ||
if(static_cast<int>(current_car_state_) < 5 ){ | ||
config_ = config; | ||
} | ||
|
||
} | ||
config get_config() | ||
{ | ||
return config_; | ||
} | ||
void set_params_need_sending() | ||
{ | ||
params_need_sending_ = true; | ||
} | ||
void reset_params_need_sending() | ||
{ | ||
params_need_sending_ = false; | ||
} | ||
bool params_need_sending() { return params_need_sending_; } | ||
|
||
private: | ||
CAR_STATE current_car_state_; | ||
bool params_need_sending_ = false; | ||
config config_; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#ifndef PROTOBUFMSGINTERFACE | ||
#define PROTOBUFMSGINTERFACE | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters