Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 69 additions & 27 deletions Core/Inc/BLCU/BLCU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,79 @@

#pragma once

#include "BLCU_Orders/BLCU_Orders.hpp"
#include "BLCU_Orders/BLCU_PrivateFunctions.hpp"
#include "BLCU_Orders/BLCU_PublicFunctions.hpp"
#include "BLCU_Protections/BLCU_Protections.hpp"
#include "BLCU_SetUps/BLCU_SetUps.hpp"
#include "BLCU_Starts/BLCU_Starts.hpp"
#include "BLCU_StateMachine/BLCU_StateMachine.hpp"
#include "ST-LIB.hpp"
#include "FDCBootloader/FDCBootloader.hpp"
#include "FDCBootloader/BootloaderTFTP.hpp"
#include "Comms.hpp"

namespace BLCU{
// Macro for BLCU id
#define BLCU_ID ((uint8_t)1)

void set_up()
{
BLCU::__set_up_peripherals();
BLCU::__set_up_state_machine();
ProtectionManager::link_state_machine(BLCU::general_state_machine, BLCU_ID);
BLCU::__set_up_protections();
}
enum Target {
NOTARGET,
VCU, // 1
HVSCU, // 2
BCU, // 3
BMSL, // 4
LCU, // 5
PCU // 6
};

void start(){
STLIB::start("00:80:e1:00:00:00",ip, mask, gateway, UART::uart2);
BLCU::__tcp_start();
BTFTP::start();
class BLCU {
private:
BLCU() = delete;

// BLCU::__resets_start();
// BLCU::__boots_start();
// BLCU::__leds_start();
}
static constexpr uint16_t max_tcp_connection_timeout = 30000;

static unordered_map<Target, DigitalOutput> resets;
static unordered_map<Target, DigitalOutput> boots;

static uint8_t fdcan;
static DigitalOutput LED_OPERATIONAL;
static DigitalOutput LED_FAULT;
static DigitalOutput LED_CAN;
static DigitalOutput LED_FLASH;
static DigitalOutput LED_SLEEP;

static bool tcp_timeout;
static bool programming_error;


static void finish_write_read_order(bool error_ok);
static void turn_off_all_boards();
static void turn_on_all_boards();
static void send_to_bootmode();
static void stop_booting();

static void setup_state_machine();
static void setup_specific_state_machine();

public:
enum GeneralStates {
INITIAL,
OPERATIONAL,
FAULT,
};

enum SpecificStates {
READY,
BOOTING,
};

static void init();
static void update();
static void abort_booting();
static void reset_all();

static Target current_target;
static bool ready_flag;
static StateMachine general_state_machine;
static StateMachine specific_state_machine;

static constexpr string ip{"192.168.0.27"};
static constexpr string mask{"255.255.0.0"};
static constexpr string gateway{"192.168.1.1"};
static constexpr uint32_t port{50500};
};

void update(){
STLIB::update();
}

}
106 changes: 0 additions & 106 deletions Core/Inc/BLCU/BLCU_Definition/BLCU_Definition.hpp

This file was deleted.

Empty file.
49 changes: 0 additions & 49 deletions Core/Inc/BLCU/BLCU_Orders/BLCU_PrivateFunctions.hpp

This file was deleted.

95 changes: 0 additions & 95 deletions Core/Inc/BLCU/BLCU_Orders/BLCU_PublicFunctions.hpp

This file was deleted.

11 changes: 0 additions & 11 deletions Core/Inc/BLCU/BLCU_Protections/BLCU_Protections.hpp

This file was deleted.

Loading
Loading