Firmware  0.0.0
Loading...
Searching...
No Matches
config.hpp File Reference

Config. More...

#include <driver/rmt_tx.h>
#include <esp_http_server.h>
#include <esp_task.h>
#include <freertos/message_buffer.h>
#include <freertos/queue.h>
#include <freertos/stream_buffer.h>
#include <hal/gpio_types.h>
#include <static_math/static_math.h>
#include <array>
#include <atomic>
#include <climits>
#include <dcc/dcc.hpp>
#include <magic_enum/magic_enum.hpp>
#include <memory>
#include <string>
#include <ztl/enum.hpp>
#include <ztl/implicit_wrapper.hpp>
#include <ztl/limits.hpp>
Include dependency graph for config.hpp:

Go to the source code of this file.

Classes

struct  analog::AdcTask
 
struct  analog::TempTask
 
struct  analog::VoltagesQueue
 
struct  analog::CurrentsQueue
 
struct  analog::TemperatureQueue
 
struct  dcc::Task
 
struct  decup::Task
 
struct  mdu::Task
 
struct  ota::Task
 
struct  zusi::Task
 
struct  out::RxMessageBuffer
 
struct  out::TxMessageBuffer
 
struct  out::track::RxQueue
 
struct  out::track::RxQueue::value_type
 
struct  out::track::dcc::Task
 
struct  out::track::decup::Task
 
struct  out::track::mdu::Task
 
struct  out::zusi::Task
 
struct  usb::RxTask
 
struct  usb::TxTask
 
struct  usb::RxStreamBuffer
 
struct  usb::TxStreamBuffer
 
struct  usb::ulf_dcc_ein::Task
 
struct  usb::ulf_decup_ein::Task
 
struct  usb::ulf_susiv2::Task
 
struct  wifi::ApRecordsQueue
 
struct  wifi::Task
 
struct  z21::RxTask
 

Namespaces

namespace  analog
 
namespace  dcc
 
namespace  decup
 
namespace  http
 
namespace  http::sta
 
namespace  mdu
 
namespace  ota
 
namespace  zusi
 
namespace  out
 
namespace  out::track
 
namespace  out::track::dcc
 
namespace  out::track::decup
 
namespace  out::track::mdu
 
namespace  out::zusi
 
namespace  udp
 
namespace  usb
 
namespace  usb::ulf_dcc_ein
 
namespace  usb::ulf_decup_ein
 
namespace  usb::ulf_susiv2
 
namespace  wifi
 
namespace  z21
 

Typedefs

using analog::VoltageMeasurement
 
using analog::Voltage
 
using analog::CurrentMeasurement
 
using analog::Current
 

Enumerations

enum class  State : uint16_t {
  Suspended = 0u << 0u , Suspend = !Suspended << 0u , ShortCircuit = Suspend << 1u , DCCOperations = 1u << CHAR_BIT ,
  DCCService = 2u << CHAR_BIT , DECUPZpp = 3u << CHAR_BIT , DECUPZsu = 4u << CHAR_BIT , MDUZpp = 5u << CHAR_BIT ,
  MDUZsu = 6u << CHAR_BIT , ZUSI = 7u << CHAR_BIT , ULF_DCC_EIN = 8u << CHAR_BIT , ULF_DECUP_EIN = 9u << CHAR_BIT ,
  ULF_MDU_EIN = 10u << CHAR_BIT , ULF_SUSIV2 = 11u << CHAR_BIT , OTA = 12u << CHAR_BIT
}
 System state. More...
 
enum class  out::track::CurrentLimit : uint8_t { out::track::_500mA = 0b00u , out::track::_1300mA = 0b01u , out::track::_2700mA = 0b10u , out::track::_4100mA = 0b11u }
 

Functions

std::string wifi::mac_str (2uz *6uz+5uz+sizeof('\n'), '\0')
 

Variables

constexpr auto default_notify_index {tskDEFAULT_INDEX_TO_NOTIFY + 1u}
 Default task notification index.
 
constexpr auto boot_gpio_num {GPIO_NUM_0}
 BOOT pin used to boot into bootloader or resetting WiFi station settings.
 
constexpr auto bug_led_gpio_num {GPIO_NUM_48}
 Bug LED pin used to indicate errors or updates.
 
std::atomic< Statestate {State::Suspended}
 Restricts access to low-level tasks.
 
constexpr auto analog::ol_on_gpio_num {GPIO_NUM_17}
 
constexpr auto analog::voltage_upper_r {14300}
 Voltage divider upper resistor for voltage measurement.
 
constexpr auto analog::voltage_lower_r {470}
 Voltage divider lower resistor for voltage measurement.
 
constexpr auto analog::current_r {180}
 Current sense resistor.
 
constexpr auto analog::current_k {800}
 Current sense ratio.
 
constexpr auto analog::vref {1000}
 
constexpr auto analog::max_measurement
 
constexpr auto analog::voltage_channel {ADC_CHANNEL_2}
 
constexpr auto analog::current_channel {ADC_CHANNEL_9}
 
constexpr auto analog::attenuation {ADC_ATTEN_DB_0}
 
constexpr std::array analog::channels {current_channel, voltage_channel}
 
constexpr auto analog::sample_freq_hz {8'000u}
 Sample frequency [Hz] (sample takes 125µs, conversion frame 20ms)
 
constexpr auto analog::conversion_frame_samples {160uz}
 Number of samples per frame.
 
constexpr auto analog::conversion_frame_time
 Time per frame [ms].
 
constexpr auto analog::conversion_frame_size
 
constexpr auto analog::conversion_frame_samples_per_channel
 
struct analog::AdcTask analog::adc_task
 
struct analog::TempTask analog::temp_task
 
struct analog::VoltagesQueue analog::voltages_queue
 
struct analog::CurrentsQueue analog::currents_queue
 
struct analog::TemperatureQueue analog::temperature_queue
 
constexpr auto dcc::priority_bits {5u}
 
std::shared_ptr< Servicedcc::service
 
struct dcc::Task dcc::task
 
struct decup::Task decup::task
 
httpd_handle_t http::handle {}
 Handle to server instance.
 
constexpr auto http::stack_size {6144uz}
 
std::shared_ptr< Serverhttp::sta::server
 
struct mdu::Task mdu::task
 
constexpr uint8_t ota::ack {0x06u}
 
constexpr uint8_t ota::nak {0x15u}
 
struct ota::Task ota::task
 
struct zusi::Task zusi::task
 
gptimer_handle_t out::gptimer {}
 
struct out::RxMessageBuffer out::rx_message_buffer
 
struct out::TxMessageBuffer out::tx_message_buffer
 
constexpr auto out::track::trans_queue_depth {2uz}
 Continuous transmission requires at least a depth of 2.
 
constexpr auto out::track::p_gpio_num {GPIO_NUM_11}
 
constexpr auto out::track::n_force_low_gpio_num {GPIO_NUM_9}
 
constexpr auto out::track::ack_gpio_num {GPIO_NUM_18}
 
constexpr auto out::track::nsleep_gpio_num {GPIO_NUM_8}
 
constexpr auto out::track::ilim0_gpio_num {GPIO_NUM_15}
 
constexpr auto out::track::ilim1_gpio_num {GPIO_NUM_16}
 
constexpr auto out::track::nfault_gpio_num {GPIO_NUM_46}
 
constexpr auto out::track::enable_gpio_num {GPIO_NUM_12}
 
struct out::track::RxQueue out::track::rx_queue
 
rmt_channel_handle_t out::track::channel {}
 
rmt_encoder_handle_t out::track::encoder {}
 
constexpr auto out::track::dcc::bidi_rx_gpio_num {GPIO_NUM_14}
 
constexpr auto out::track::dcc::bidi_en_gpio_num {GPIO_NUM_13}
 
struct out::track::dcc::Task out::track::dcc::task
 
struct out::track::decup::Task out::track::decup::task
 
struct out::track::mdu::Task out::track::mdu::task
 
constexpr auto out::zusi::enable_gpio_num {GPIO_NUM_4}
 
constexpr auto out::zusi::clock_gpio_num {GPIO_NUM_6}
 
constexpr auto out::zusi::data_gpio_num {GPIO_NUM_5}
 
struct out::zusi::Task out::zusi::task
 
constexpr uint16_t udp::port {21105u}
 
int udp::sock_fd
 
bool volatile usb::rts {}
 
constexpr auto usb::vbus_gpio_num {GPIO_NUM_7}
 
constexpr auto usb::buffer_size {512uz}
 
struct usb::RxTask usb::rx_task
 
struct usb::TxTask usb::tx_task
 
struct usb::RxStreamBuffer usb::rx_stream_buffer
 
struct usb::TxStreamBuffer usb::tx_stream_buffer
 
struct usb::ulf_dcc_ein::Task usb::ulf_dcc_ein::task
 
struct usb::ulf_decup_ein::Task usb::ulf_decup_ein::task
 
struct usb::ulf_susiv2::Task usb::ulf_susiv2::task
 
constexpr auto wifi::led_gpio_num {GPIO_NUM_47}
 
std::string wifi::mdns_str
 
std::string wifi::ip_str
 
std::array< uint8_t, 6uz > wifi::mac
 
struct wifi::ApRecordsQueue wifi::ap_records_queue
 
struct wifi::Task wifi::task
 
struct z21::RxTask z21::task
 
std::shared_ptr< Servicez21::service
 

Detailed Description

Author
Vincent Hamp
Date
09/02/2023

Enumeration Type Documentation

◆ State

enum class State : uint16_t
strong
Enumerator
Suspended 

Idle.

Suspend 

About to be idle.

ShortCircuit 

Short circuit.

DCCOperations 

DCC operation mode.

DCCService 

DCC service mode.

DECUPZpp 

DECUP ZPP update.

DECUPZsu 

DECUP ZSU update.

MDUZpp 

MDU ZPP update.

MDUZsu 

MDU ZSU update.

ZUSI 

ZUSI mode.

ULF_DCC_EIN 
ULF_DECUP_EIN 
ULF_MDU_EIN 
ULF_SUSIV2 
OTA 

Variable Documentation

◆ boot_gpio_num

auto boot_gpio_num {GPIO_NUM_0}
inlineconstexpr

◆ bug_led_gpio_num

auto bug_led_gpio_num {GPIO_NUM_48}
inlineconstexpr

◆ default_notify_index

auto default_notify_index {tskDEFAULT_INDEX_TO_NOTIFY + 1u}
inlineconstexpr

Index 0 is used by the Stream and Message Buffer implementation as indicated by the following warning from the Task Notifications documentation.

Warning
FreeRTOS Stream and Message Buffers use the task notification at array index 0. If you want to maintain the state of a task notification across a call to a Stream or Message Buffer API function then use a task notification at an array index greater than 0.

◆ state

std::atomic<State> state {State::Suspended}
inline