theCore C++ embedded framework

Namespaces

 fat
 
 fs
 
 gpio_hw
 
 i2s
 I2S specific parameters.
 
 irq
 
 mmio
 
 os
 
 sensor
 
 skel
 
 systmr
 
 this_thread
 

Data Structures

class  adc
 ADC peripheral class. More...
 
struct  adc_cfg
 ADC configuration prototype. More...
 
class  adc_irq_dispatcher
 ADC interrupts helper. More...
 
class  aux
 Base helper class, used internally by shared_ptr. More...
 
class  binary_semaphore
 FreeRTOS-based semaphore. More...
 
struct  channel_group
 Channels grouped together along with an external trigger. More...
 
struct  channel_group_exti_trigger
 Channels grouped together, conversion triggered by EXTI line. More...
 
struct  channel_group_sw_trigger
 Channels grouped together, conversion triggered by software. More...
 
class  console_driver
 
class  console_pipe
 Console pipe (blocking) adapter. More...
 
class  cs43l22
 The CS43L22 codec driver implementation. More...
 
struct  dispatcher_timer
 Container for. More...
 
struct  dma_wrap
 DMA wrapper for STM32F4XX. More...
 
class  dma_wrap_base
 Generic interface of the DMA on STM32 platforms. More...
 
struct  empty_gpio
 Empty GPIO that does nothing. More...
 
struct  explode_chunk_impl
 Explodes substring into exploded_string type. More...
 
struct  explode_chunk_impl< S, B, 0, c... >
 Explodes part of the string into exploded_string type. More...
 
struct  exploded_string
 Exploded string produces unique type for every unique string. More...
 
struct  exti_irq_proxy
 EXTI interrupt proxy. More...
 
class  exti_manager
 External interrupt manager class. More...
 
struct  extractor
 Extracts information of the given channel group. More...
 
class  generic_bus
 Generic bus interface. More...
 
class  gpio
 Encapsulates pin usage. More...
 
struct  gpio_list
 List of test GPIOs used by the test case. More...
 
struct  greeter
 Greeting executor, prints message during static initialization. More...
 
class  hm10_sync
 HM10 synchronous BT driver. More...
 
class  i2c_bus
 I2C bus based on Particle electron drivers. More...
 
struct  i2c_bus_cfg
 Base template class for the I2C configuration. More...
 
struct  i2c_config
 I2C configuration struct. More...
 
class  iostream
 
struct  iostream_initializer
 Static initializer for every translation unit. More...
 
class  istream
 
class  list
 Intrusive, double-linked, circular list head. More...
 
class  list_iter
 Intrusive list's specific, safe iterator. More...
 
class  list_node
 Intrusive, double-linked, circular list node. More...
 
class  mgmt_configurator
 Management configurator class. More...
 
class  mgmt_configurator< dev, adc_mgmt_mode::dma >
 Configurator for ADC DMA mode. More...
 
class  mgmt_configurator< dev, adc_mgmt_mode::irq >
 Configurator for ADC IRQ mode. More...
 
class  mutex
 
class  native_thread
 
class  ostream
 
class  pcd8544
 
class  platform_console
 
class  point
 
class  pool
 Holds given buffer as a pool. More...
 
class  pool_allocator
 Almost stateless pool allocator. More...
 
class  pool_base
 Base class for memory pool. More...
 
struct  safe_storage
 Safe storage wrapper to avoid static initialization fiasco. More...
 
class  sdspi
 SDSPI driver class. More...
 
struct  sdspi_card_info
 SDSPI card information struct. More...
 
struct  sdspi_state
 Struct to hold SDSPI driver state, resulting from SDSPI API calls. More...
 
class  semaphore
 FreeRTOS-based semaphore. More...
 
class  serial
 Serial driver interface. More...
 
struct  shared_allocation_size
 
class  shared_ptr
 Classical shared pointer. More...
 
class  spi
 TM4C driver implementation for SPI. More...
 
struct  spi_cfg
 Base template class for the SPI configuration. More...
 
class  spi_i2s_bus
 Driver implementation for SPI and I2S. More...
 
struct  spi_i2s_cfg
 Base template class for the SPI/I2S configuration. More...
 
struct  spi_irq_proxy
 SPI interrupt proxy. More...
 
class  spinlock
 
class  uart
 UART driver. More...
 
class  uart_bus
 Electron UART bus wrapper. More...
 
struct  uart_irq_proxy
 UART interrupt proxy. More...
 
class  usart_bus
 STM32 USART bus. More...
 
struct  usart_cfg
 Base template class for the usart configuration. More...
 
class  weak_ptr
 

Typedefs

using cin_type = istream< console_driver >
 
using cout_type = ostream< console_driver >
 
using cerr_type = ostream< console_driver >
 
using handler_storage = std::aligned_storage_t< sizeof(irq::handler_type), alignof(irq::handler_type)>
 Storage type for the IRQ handlers. More...
 
using thread_handle = void *
 OS-specific handle. More...
 
template<typename S , size_t B, size_t L>
using explode_chunk = typename explode_chunk_impl< S, B, L >::result
 Syntactical sugar for exploding substring. More...
 
using bus_handler = std::function< void(bus_channel ch, bus_event type, size_t total)>
 Event handler type. More...
 
using irq_num = int
 
using adc_evh = std::function< void(adc_event)>
 ADC event handler. Event code signifies result of a conversion. More...
 
using test_uart = serial_device0
 
using test_gpios = gpio_list< red_led, blue_led, green_led, orange_led >
 Exported list of GPIOs. More...
 

Enumerations

enum  err : int {
  err::ok = 0, err::tobig = -1, err::acces = -2, err::addrinuse = -3,
  err::addrnotavail = -4, err::afnosupport = -5, err::again = -6, err::already = -7,
  err::badf = -8, err::badmsg = -9, err::busy = -10, err::canceled = -11,
  err::child = -12, err::connaborted = -13, err::connrefused = -14, err::connreset = -15,
  err::deadlk = -16, err::destaddrreq = -17, err::dom = -18, err::exist = -19,
  err::fault = -20, err::fbig = -21, err::hostunreach = -22, err::idrm = -23,
  err::ilseq = -24, err::inprogress = -25, err::intr = -26, err::inval = -27,
  err::io = -28, err::isconn = -29, err::isdir = -30, err::loop = -31,
  err::mfile = -32, err::mlink = -33, err::msgsize = -34, err::nametoolong = -35,
  err::netdown = -36, err::netreset = -37, err::netunreach = -38, err::nfile = -39,
  err::nobufs = -40, err::nodata = -41, err::nodev = -42, err::noent = -43,
  err::noexec = -44, err::nolck = -45, err::nolink = -46, err::nomem = -47,
  err::nomsg = -48, err::noprotoopt = -49, err::nospc = -50, err::nosr = -51,
  err::nostr = -52, err::nosys = -53, err::notconn = -54, err::notdir = -55,
  err::notempty = -56, err::notrecoverable = -57, err::notsock = -58, err::notsup = -59,
  err::notty = -60, err::nxio = -61, err::opnotsupp = -62, err::overflow = -63,
  err::ownerdead = -64, err::perm = -65, err::pipe = -66, err::proto = -67,
  err::protonosupport = -68, err::prototype = -69, err::range = -70, err::rofs = -71,
  err::spipe = -72, err::srch = -73, err::time = -74, err::timedout = -75,
  err::txtbsy = -76, err::wouldblock = -77, err::xdev = -78, err::generic = -79
}
 theCore system-wide errors More...
 
enum  adc_event { adc_event::hc, adc_event::eoc, adc_event::ovr }
 ADC events that can occur during coversion. More...
 
enum  bus_channel { bus_channel::rx, bus_channel::tx, bus_channel::meta }
 Channels of a bus. More...
 
enum  bus_event { bus_event::ht, bus_event::tc, bus_event::err }
 Various events. More...
 
enum  async_type { async_type::deferred, async_type::immediate }
 Defines async xfer types. More...
 
enum  i2c_device { i2c_device::bus1, i2c_device::bus2, i2c_device::bus3, i2c_device::wire0 }
 
enum  spi_device {
  spi_device::bus1, spi_device::bus2, spi_device::bus3, spi_device::bus4,
  spi_device::bus5, spi_device::bus6, spi_device::bus7, spi_device::bus8
}
 
enum  i2c_device { i2c_device::bus1, i2c_device::bus2, i2c_device::bus3, i2c_device::wire0 }
 List of I2C devices. More...
 
enum  uart_device {
  uart_device::serial0, uart_device::serial1, uart_device::serial2, uart_device::serial4,
  uart_device::serial5
}
 Represents distinct peripheral devices According to the particle electron wiring and docs, there are no Serial3 device. More...
 
enum  adc_mgmt_mode { adc_mgmt_mode::dma, adc_mgmt_mode::irq }
 ADC management mode. More...
 
enum  adc_trigger {
  adc_trigger::t1_cc1 = ADC_ExternalTrigConv_T1_CC1, adc_trigger::t1_cc2 = ADC_ExternalTrigConv_T1_CC2, adc_trigger::t1_cc3 = ADC_ExternalTrigConv_T1_CC3, adc_trigger::t2_cc2 = ADC_ExternalTrigConv_T2_CC2,
  adc_trigger::t2_cc3 = ADC_ExternalTrigConv_T2_CC3, adc_trigger::t2_cc4 = ADC_ExternalTrigConv_T2_CC4, adc_trigger::t2_trgo = ADC_ExternalTrigConv_T2_TRGO, adc_trigger::t3_cc1 = ADC_ExternalTrigConv_T3_CC1,
  adc_trigger::t3_trgo = ADC_ExternalTrigConv_T3_TRGO, adc_trigger::t4_cc4 = ADC_ExternalTrigConv_T4_CC4, adc_trigger::t5_cc1 = ADC_ExternalTrigConv_T5_CC1, adc_trigger::t5_cc2 = ADC_ExternalTrigConv_T5_CC2,
  adc_trigger::t5_cc3 = ADC_ExternalTrigConv_T5_CC3, adc_trigger::t8_cc1 = ADC_ExternalTrigConv_T8_CC1, adc_trigger::t8_trgo = ADC_ExternalTrigConv_T8_TRGO
}
 The external event used to trigger the start of conversion of a group. More...
 
enum  adc_trigger_edge { adc_trigger_edge::rising = ADC_ExternalTrigConvEdge_Rising, adc_trigger_edge::falling = ADC_ExternalTrigConvEdge_Falling, adc_trigger_edge::both = ADC_ExternalTrigConvEdge_RisingFalling }
 The external trigger edge in case of EXTI line used as a trigger. More...
 
enum  adc_channel {
  adc_channel::ch0 = ADC_Channel_0, adc_channel::ch1 = ADC_Channel_1, adc_channel::ch2 = ADC_Channel_2, adc_channel::ch3 = ADC_Channel_3,
  adc_channel::ch4 = ADC_Channel_4, adc_channel::ch5 = ADC_Channel_5, adc_channel::ch6 = ADC_Channel_6, adc_channel::ch7 = ADC_Channel_7,
  adc_channel::ch8 = ADC_Channel_8, adc_channel::ch9 = ADC_Channel_9, adc_channel::ch10 = ADC_Channel_10, adc_channel::ch11 = ADC_Channel_11,
  adc_channel::ch12 = ADC_Channel_12, adc_channel::ch13 = ADC_Channel_13, adc_channel::ch14 = ADC_Channel_14, adc_channel::ch15 = ADC_Channel_15,
  adc_channel::ch16 = ADC_Channel_16, adc_channel::ch17 = ADC_Channel_17, adc_channel::ch18 = ADC_Channel_18
}
 ADC possible channels. More...
 
enum  i2c_mode { i2c_mode::POLL, i2c_mode::IRQ }
 Mode of event handling. More...
 
enum  spi_bus_type { spi_bus_type::spi, spi_bus_type::i2s }
 Defines type of the bus. More...
 
enum  usart_device {
  usart_device::dev1, usart_device::dev2, usart_device::dev3, usart_device::dev4,
  usart_device::dev5, usart_device::dev6, usart_device::dev7, usart_device::dev8
}
 Represents distinct peripheral devices. More...
 
enum  gpio_num {
  gpio_num::pin0, gpio_num::pin1, gpio_num::pin2, gpio_num::pin3,
  gpio_num::pin4, gpio_num::pin5, gpio_num::pin6, gpio_num::pin7,
  gpio_num::pin8, gpio_num::pin9, gpio_num::pin10, gpio_num::pin11,
  gpio_num::pin12, gpio_num::pin13, gpio_num::pin14, gpio_num::pin15
}
 GPIO numbers. More...
 
enum  gpio_port {
  gpio_port::a, gpio_port::b, gpio_port::c, gpio_port::d,
  gpio_port::e, gpio_port::f, gpio_port::g, gpio_port::h,
  gpio_port::i, gpio_port::j, gpio_port::k
}
 GPIO ports. More...
 
enum  dma_data_sz { dma_data_sz::byte, dma_data_sz::word, dma_data_sz::hword }
 Common data sizes of the DMA transaction, defined by STM32 SPL. More...
 
enum  dma_mode { dma_mode::normal = DMA_Mode_Normal, dma_mode::circular = DMA_Mode_Circular }
 Common DMA modes, defined by STM32 SPL. More...
 
enum  adc_dev { adc_dev::dev1 = ADC1_BASE, adc_dev::dev2 = ADC2_BASE, adc_dev::dev3 = ADC3_BASE }
 Present ADC devices in the MCU. More...
 
enum  dma_stream {
  dma_stream::dma1_0 = 0x100, dma_stream::dma1_1 = 0x101, dma_stream::dma1_2 = 0x102, dma_stream::dma1_3 = 0x103,
  dma_stream::dma1_4 = 0x104, dma_stream::dma1_5 = 0x105, dma_stream::dma1_6 = 0x106, dma_stream::dma1_7 = 0x107,
  dma_stream::dma2_0 = 0x200, dma_stream::dma2_1 = 0x201, dma_stream::dma2_2 = 0x202, dma_stream::dma2_3 = 0x203,
  dma_stream::dma2_4 = 0x204, dma_stream::dma2_5 = 0x205, dma_stream::dma2_6 = 0x206, dma_stream::dma2_7 = 0x207
}
 DMA streams present, according to the RM. More...
 
enum  dma_channel {
  dma_channel::ch0 = DMA_Channel_0, dma_channel::ch1 = DMA_Channel_1, dma_channel::ch2 = DMA_Channel_2, dma_channel::ch3 = DMA_Channel_3,
  dma_channel::ch4 = DMA_Channel_4, dma_channel::ch5 = DMA_Channel_5, dma_channel::ch6 = DMA_Channel_6, dma_channel::ch7 = DMA_Channel_7,
  dma_channel::dma1_1 = 0x101, dma_channel::dma1_2 = 0x102, dma_channel::dma1_3 = 0x103, dma_channel::dma1_4 = 0x104,
  dma_channel::dma1_5 = 0x105, dma_channel::dma1_6 = 0x106, dma_channel::dma1_7 = 0x107, dma_channel::dma2_1 = 0x201,
  dma_channel::dma2_2 = 0x202, dma_channel::dma2_3 = 0x203, dma_channel::dma2_4 = 0x204, dma_channel::dma2_5 = 0x205
}
 
enum  dma_channel {
  dma_channel::ch0 = DMA_Channel_0, dma_channel::ch1 = DMA_Channel_1, dma_channel::ch2 = DMA_Channel_2, dma_channel::ch3 = DMA_Channel_3,
  dma_channel::ch4 = DMA_Channel_4, dma_channel::ch5 = DMA_Channel_5, dma_channel::ch6 = DMA_Channel_6, dma_channel::ch7 = DMA_Channel_7,
  dma_channel::dma1_1 = 0x101, dma_channel::dma1_2 = 0x102, dma_channel::dma1_3 = 0x103, dma_channel::dma1_4 = 0x104,
  dma_channel::dma1_5 = 0x105, dma_channel::dma1_6 = 0x106, dma_channel::dma1_7 = 0x107, dma_channel::dma2_1 = 0x201,
  dma_channel::dma2_2 = 0x202, dma_channel::dma2_3 = 0x203, dma_channel::dma2_4 = 0x204, dma_channel::dma2_5 = 0x205
}
 DMA channels present, according to the RM. More...
 
enum  spi_channel { spi_channel::ch0 = SSI0_BASE, spi_channel::ch1 = SSI1_BASE, spi_channel::ch2 = SSI2_BASE, spi_channel::ch3 = SSI3_BASE }
 List of avaliable SPI channels. More...
 
enum  spi_type { spi_type::master }
 SPI master/slave selection. More...
 
enum  spi_cpol { spi_cpol::low, spi_cpol::high }
 SPI clock polarity. More...
 
enum  spi_cpha { spi_cpha::low, spi_cpha::high }
 SPI clock phase. More...
 
enum  uart_channel {
  uart_channel::ch0 = UART0_BASE, uart_channel::ch1 = UART1_BASE, uart_channel::ch2 = UART2_BASE, uart_channel::ch3 = UART3_BASE,
  uart_channel::ch4 = UART4_BASE, uart_channel::ch5 = UART5_BASE, uart_channel::ch6 = UART6_BASE, uart_channel::ch7 = UART7_BASE
}
 Represents distinct UART peripheral devices (channels) More...
 

Functions

static void default_handler ()
 Unhandled interrupt must cause the abort. More...
 
static auto extract_handlers ()
 Effectively casts IRQ storage. More...
 
 __attribute__ ((used)) void core_isr()
 Handles IRQ and visible to the startup code. More...
 
template<class I2C_Dev >
static void dispatch ()
 Real dispatch function that operates over given I2C theCore driver. More...
 
void i2c_dispatch ()
 
void serial_tx_dispatch ()
 
template<uart_device dev>
void serial_rx_dispatch ()
 
static Timer dev_tmr (1000, &dispatcher_timer::check_xfer, dispatcher_obj)
 Soft-IRQ dispatcher timer. More...
 
void notify_xfer_start ()
 Notifies main loop about pending transactions. More...
 
void bypass_console_init ()
 
void bypass_putc (char c)
 Bypasses console drivers and puts data directly to the UART. More...
 
 __attribute__ ((noreturn)) static inline void abort()
 Aborts execution of currently running code. Never return. More...
 
static void wfi ()
 Waits for interrupts. More...
 
static void wfe ()
 Waits for events. More...
 
static void arch_spin_wait (uint32_t ms)
 Performs a dummy busy wait for specified amount of milliseconds. More...
 
template<typename stream >
stream & noskipws (stream &ios)
 
template<typename stream >
stream & skipws (stream &ios)
 
template<typename T , class Alloc , class... Args>
shared_ptr< T > allocate_shared (const Alloc &alloc, Args... args)
 
template<typename T >
bool operator== (const shared_ptr< T > &shr, std::nullptr_t nullp)
 
template<typename T >
bool operator!= (const shared_ptr< T > &shr, std::nullptr_t nullp)
 
template<typename T >
bool operator== (const shared_ptr< T > &shr1, const shared_ptr< T > &shr2)
 
template<typename T >
bool operator!= (const shared_ptr< T > &shr1, const shared_ptr< T > &shr2)
 
template<typename T >
bool operator! (const shared_ptr< T > &shr)
 
template<typename stream >
stream & endl (stream &ios)
 
static bool is_error (err error)
 
static bool is_ok (err error)
 
const char * err_to_str (err error)
 
template<typename Integer >
Integer LE (Integer in)
 
static uint16_t BE (uint16_t in)
 
static int16_t BE (int16_t in)
 
static uint32_t BE (uint32_t in)
 
static int32_t BE (int32_t in)
 
static uint64_t BE (uint64_t in)
 
static int64_t BE (int64_t in)
 
template<class FuncT , class TupleT , size_t ... Is>
void for_each_impl (TupleT &tuple, FuncT func, std::index_sequence< Is... >)
 
template<class FuncT , class ... Tp>
void for_each (std::tuple< Tp... > &tuple, FuncT func)
 
template<template< typename > class Callable, class ... Tp>
void for_each ()
 For-each for types only. More...
 
template<typename T1 , typename T2 >
constexpr size_t offset_of (T1 T2::*member)
 Obtains offset of the given member within given type. More...
 
template<typename Enum >
constexpr auto extract_value (Enum val)
 Extracts value from enumerator element of given type. More...
 
template<int N>
constexpr auto strlen_constexpr (const char(&str)[N])
 Calculates string length in compile time, if possible. More...
 
constexpr auto strlen_constexpr (const char *str)
 Calculates string length in compile time, if possible. More...
 
constexpr int strchri_constexpr (const char *str, char ch)
 Returns an index to the first occurrence of the character in the string. More...
 
static const char * version ()
 Returns constant version string of theCore. More...
 
static const char * git_commit ()
 Returns string with SHA of git commit. More...
 
static const char * git_branch ()
 Returns git branch. More...
 
static const char * git_url ()
 Returns remote URL of theCore. More...
 
static void bypass_puts (const char *str)
 Bypasses console drivers and puts string directly to the UART. More...
 
static void bypass_greeting ()
 Puts a greeting to a theCore console. More...
 
template<class Predicate >
static bool wait_for (uint32_t ms, Predicate pred)
 Waits conditionally not less than given amount of milliseconds. More...
 
static void wait_for (uint32_t ms)
 Waits in loop for a given amount of milliseconds. More...
 
template<class Rep , class Period >
static void wait_for (const std::chrono::duration< Rep, Period > &wait_duration)
 Waits in loop for given amount of time, expressed using std::chrono library. More...
 
static void abort ()
 Aborts execution of currently running code. Never return. More...
 
static void spin_wait (unsigned ms)
 Performs a dummy busy wait for specified amount of milliseconds. More...
 
static void spin_wait (unsigned ms)
 Waits not less than given amount of milliseconds. More...
 
static void bypass_init ()
 Initializes bypass console. More...
 
static void spin_wait (uint32_t ms)
 Performs a dummy busy wait for specified amount of milliseconds. More...
 
template<uint32_t SplExti>
constexpr auto direct_exti ()
 Checks if given EXTI line is direct. More...
 
template<uint32_t SplExti>
constexpr auto grouped_exti ()
 Checks if given EXTI line is grouped. More...
 
template<uint32_t SplExti>
constexpr auto get_exti_idx ()
 Gets EXTI index suitable for arranging EXTI handlers in an array. More...
 
static constexpr auto adcs_count ()
 Gets amount of present ADC devices. More...
 
static constexpr auto get_adc_idx (adc_dev dev)
 Maps ADC to index in the ADC array. More...
 
static void wfi ()
 Waits for interrupts. More...
 
static void wfe ()
 Waits for events. More...
 
static void spin_wait (uint32_t ms)
 Performs a dummy busy wait for specified amount of milliseconds. More...
 

Variables

static int nifty_counter
 Tracks initialization and destruction. More...
 
static std::aligned_storage< sizeof(console_driver), alignof(console_driver) >::type console_obj_buf
 Memory for the console device driver. More...
 
static std::aligned_storage< sizeof(cin_type), alignof(cin_type) >::type cin_obj_buf
 Memory for the cin object. More...
 
static std::aligned_storage< sizeof(cout_type), alignof(cout_type) >::type cout_obj_buf
 Memory for the cout object. More...
 
static std::aligned_storage< sizeof(cerr_type), alignof(cerr_type) >::type cerr_obj_buf
 Memory for the cerr object. More...
 
istream< console_driver >::device_type & console_device = reinterpret_cast< console_driver& >(console_obj_buf)
 
cin_typecin = reinterpret_cast< cin_type& >(cin_obj_buf)
 
cout_typecout = reinterpret_cast< cout_type& >(cout_obj_buf)
 
cerr_typecerr = reinterpret_cast< cerr_type& >(cerr_obj_buf)
 
const char * ver_str = "@PROJECT_NAME@ v@PROJECT_VERSION@ " "@PROJECT_GIT_SHORT@" DIRTY
 
const char * ver_commit = "@PROJECT_GIT_COMMIT@"
 
const char * ver_branch = "@PROJECT_GIT_BRANCH@"
 
const char * ver_url = "@PROJECT_GIT_URL@"
 
static handler_storage storage [IRQ_COUNT]
 IRQ storage itself. More...
 
static struct ecl::greeter greeter_obj
 
static struct ecl::dispatcher_timer dispatcher_obj
 
static struct ecl::iostream_initializer stream_initializer
 
static constexpr auto adc_irqn = ADC_IRQn
 ADC IRQ channel. More...
 
static constexpr adc_dev adcs [] = { adc_dev::dev1, adc_dev::dev2, adc_dev::dev3 }
 Possible ADCs/. More...
 
static constexpr std::pair< size_t, IRQn > exti_irq_idx_direct_mapping []
 Maps direct EXTI IRQs into appropriate EXTI index. More...
 
static constexpr std::pair< size_t, IRQn > exti_irq_idx_grouped_mapping []
 Maps grouped EXTI IRQs into appropriate EXTI index. More...
 
static constexpr std::pair< size_t, IRQn > exti_irq_idx_direct_mapping []
 Maps direct EXTI IRQs into appropriate EXTI index. More...
 
static constexpr std::pair< size_t, IRQn > exti_irq_idx_grouped_mapping []
 Maps grouped EXTI IRQs into appropriate EXTI index. More...
 

Typedef Documentation

◆ cin_type

◆ cout_type

◆ cerr_type

◆ handler_storage

using ecl::handler_storage = typedef std::aligned_storage_t<sizeof(irq::handler_type), alignof(irq::handler_type)>

Storage type for the IRQ handlers.

◆ thread_handle

using ecl::thread_handle = typedef void *

OS-specific handle.

Yet we know that FreeRTOS uses void * as a typedef for TaskHandle_t this will stay here.

◆ explode_chunk

template<typename S , size_t B, size_t L>
using ecl::explode_chunk = typedef typename explode_chunk_impl<S, B, L>::result

Syntactical sugar for exploding substring.

Template Parameters
SString advertiser with str() method that will return valid constexpr string.
BIndex of begin of substring to be exploded.
LLength of substring to be exploded.

◆ bus_handler

using ecl::bus_handler = typedef std::function<void(bus_channel ch, bus_event type, size_t total)>

Event handler type.

User can provide a function object in order to handle events from a bus.

Parameters
[in]chChannel where event occurred.
[in]typeType of the event.
[in]totalBytes transferred trough given channel during current xfer.
See also
generic_bus::xfer()

◆ test_uart

◆ test_gpios

typedef gpio_list< red_led, blue_led, green_led > ecl::test_gpios

Exported list of GPIOs.

Enumeration Type Documentation

◆ err

enum ecl::err : int
strong

theCore system-wide errors

Rudely taken from http://en.cppreference.com/w/cpp/error/errno_macros

Enumerator
ok 
tobig 

Successfully completed.

acces 

Argument list too long.

addrinuse 

Permission denied.

addrnotavail 

Address in use.

afnosupport 

Address not available.

again 

Address family not supported.

already 

Resource unavailable.

badf 

Connection already in progress.

badmsg 

Bad file descriptor.

busy 

Bad message.

canceled 

Device or resource busy.

child 

Operation canceled.

connaborted 

No child processes.

connrefused 

Connection aborted.

connreset 

Connection refused.

deadlk 

Connection reset.

destaddrreq 

Resource deadlock would occur.

dom 

Destination address required.

exist 

Mathematics argument out of domain of function.

fault 

File exists.

fbig 

Bad address.

hostunreach 

File too large.

idrm 

Host is unreachable.

ilseq 

Identifier removed.

inprogress 

Illegal byte sequence.

intr 

Operation in progress.

inval 

Interrupted function.

io 

Invalid argument.

isconn 

I/O error.

isdir 

Socket is connected.

loop 

Is a directory.

mfile 

Too many levels of symbolic links.

mlink 

File descriptor value too large.

msgsize 

Too many links.

nametoolong 

Message too large.

netdown 

Filename too long.

netreset 

Network is down.

netunreach 

Connection aborted by network.

nfile 

Network unreachable.

nobufs 

Too many files open in system.

nodata 

No buffer space available.

nodev 

No message is available on the STREAM head read queue.

noent 

No such device.

noexec 

No such file or directory.

nolck 

Executable file format error.

nolink 

No locks available.

nomem 

Link has been severed.

nomsg 

Not enough space.

noprotoopt 

No message of the desired type.

nospc 

Protocol not available.

nosr 

No space left on device.

nostr 

No STREAM resources.

nosys 

Not a STREAM.

notconn 

Function not supported.

notdir 

The socket is not connected.

notempty 

Not a directory.

notrecoverable 

Directory not empty.

notsock 

State not recoverable.

notsup 

Not a socket.

notty 

Not supported.

nxio 

Inappropriate I/O control operation.

opnotsupp 

No such device or address.

overflow 

Operation not supported on socket.

ownerdead 

Value too large to be stored in data type.

perm 

Previous owner died.

pipe 

Operation not permitted.

proto 

Broken pipe.

protonosupport 

Protocol error.

prototype 

Protocol not supported.

range 

Protocol wrong type for socket.

rofs 

Result too large.

spipe 

Read-only file system.

srch 

Invalid seek.

time 

No such process.

timedout 

Stream ioctl() timeout.

txtbsy 

Connection timed out.

wouldblock 

Text file busy.

xdev 

Operation would block.

generic 

Cross-device link.

◆ adc_event

enum ecl::adc_event
strong

ADC events that can occur during coversion.

Enumerator
hc 

Half conversion event. Generated when half of channels are converted.

eoc 

End of conversion event. Generated when all channels are converted.

ovr 

Overrun event. Generated when data is lost during conversion.

◆ bus_channel

enum ecl::bus_channel
strong

Channels of a bus.

Enumerator
rx 

Receive channel.

tx 

Transmit channel.

meta 

Meta-channel.

◆ bus_event

enum ecl::bus_event
strong

Various events.

Enumerator
ht 

Half transfer event.

tc 

Transfer complete event.

err 

Error event.

◆ async_type

enum ecl::async_type
strong

Defines async xfer types.

Enumerator
deferred 

Xfer going to be deferred until user asks.

immediate 

Xfer will be executed as soon as possible.

◆ i2c_device [1/2]

enum ecl::i2c_device
strong
Enumerator
bus1 
bus2 
bus3 
wire0 

◆ spi_device

enum ecl::spi_device
strong
Enumerator
bus1 
bus2 
bus3 
bus4 
bus5 
bus6 
bus7 
bus8 

◆ i2c_device [2/2]

enum ecl::i2c_device
strong

List of I2C devices.

Only one device is present in particle electron board. This enum is present to provide consistent interface accross theCore platforms.

Enumerator
bus1 
bus2 
bus3 
wire0 

◆ uart_device

enum ecl::uart_device
strong

Represents distinct peripheral devices According to the particle electron wiring and docs, there are no Serial3 device.

See RM.

Enumerator
serial0 
serial1 
serial2 
serial4 
serial5 

◆ i2c_mode

enum ecl::i2c_mode
strong

Mode of event handling.

Enumerator
POLL 
IRQ 

◆ dma_data_sz

enum ecl::dma_data_sz
strong

Common data sizes of the DMA transaction, defined by STM32 SPL.

Enumerator
byte 
word 
hword 

◆ dma_mode

enum ecl::dma_mode
strong

Common DMA modes, defined by STM32 SPL.

Enumerator
normal 
circular 

◆ adc_dev

enum ecl::adc_dev
strong

Present ADC devices in the MCU.

Enumerator
dev1 
dev2 
dev3 

◆ dma_stream

enum ecl::dma_stream
strong

DMA streams present, according to the RM.

High-order byte represents DMA number, low order - stream number

Enumerator
dma1_0 
dma1_1 
dma1_2 
dma1_3 
dma1_4 
dma1_5 
dma1_6 
dma1_7 
dma2_0 
dma2_1 
dma2_2 
dma2_3 
dma2_4 
dma2_5 
dma2_6 
dma2_7 

◆ dma_channel [1/2]

enum ecl::dma_channel
strong
Enumerator
ch0 
ch1 
ch2 
ch3 
ch4 
ch5 
ch6 
ch7 
dma1_1 
dma1_2 
dma1_3 
dma1_4 
dma1_5 
dma1_6 
dma1_7 
dma2_1 
dma2_2 
dma2_3 
dma2_4 
dma2_5 

◆ dma_channel [2/2]

enum ecl::dma_channel
strong

DMA channels present, according to the RM.

High-order byte represents DMA number, low order - channel number.

Enumerator
ch0 
ch1 
ch2 
ch3 
ch4 
ch5 
ch6 
ch7 
dma1_1 
dma1_2 
dma1_3 
dma1_4 
dma1_5 
dma1_6 
dma1_7 
dma2_1 
dma2_2 
dma2_3 
dma2_4 
dma2_5 

Function Documentation

◆ default_handler()

static void ecl::default_handler ( )
static

Unhandled interrupt must cause the abort.

Here is the call graph for this function:

◆ extract_handlers()

static auto ecl::extract_handlers ( )
static

Effectively casts IRQ storage.

◆ __attribute__()

ecl::__attribute__ ( (used)  )

Handles IRQ and visible to the startup code.

Here is the call graph for this function:

◆ dispatch()

template<class I2C_Dev >
static void ecl::dispatch ( )
static

Real dispatch function that operates over given I2C theCore driver.

Template Parameters
I2C_DevtheCore I2C driver.

Upon call, it will determine if data should be send or received from the I2C driver.

◆ i2c_dispatch()

void ecl::i2c_dispatch ( )

◆ serial_tx_dispatch()

void ecl::serial_tx_dispatch ( )

◆ serial_rx_dispatch()

template<uart_device dev>
void ecl::serial_rx_dispatch ( )

◆ dev_tmr()

static Timer ecl::dev_tmr ( 1000  ,
&dispatcher_timer::check_xfer  ,
dispatcher_obj   
)
static

Soft-IRQ dispatcher timer.

◆ notify_xfer_start()

void ecl::notify_xfer_start ( )

Notifies main loop about pending transactions.

Unfortunately, particle firmware does not provide access to control, or at least get interrupts notifications (except for some slave-side cases in I2C and SPI). It is something that differs from theCore event model, where everything runs asynchronously. To compensate missing interrupts, they should be emulated by software. By calling this routine should be the platform-level driver can receive async event after xfer completetion. Emulated IRQ executed by

See also
dispatcher_timer
Here is the call graph for this function:

◆ bypass_console_init()

void ecl::bypass_console_init ( )
Here is the call graph for this function:

◆ wfi()

static void ecl::wfi ( )
inlinestatic

Waits for interrupts.

Processor will stop executing until any interrupt will occur. See also: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0014q/CJAJGICJ.html

◆ wfe()

static void ecl::wfe ( )
inlinestatic

Waits for events.

Processor will stop executing until any event will occur.

Note
Event flag will be set regardless of execution state. To track spurious wakeup, additional flags must be checked. See also: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0014q/CJAJGICJ.html

◆ arch_spin_wait()

static void ecl::arch_spin_wait ( uint32_t  ms)
inlinestatic

Performs a dummy busy wait for specified amount of milliseconds.

Parameters
msnumber of milliseconds to wait.

This function is useful for a short delays.

Returns
None.
Here is the call graph for this function:

◆ noskipws()

template<typename stream >
stream& ecl::noskipws ( stream &  ios)

◆ skipws()

template<typename stream >
stream& ecl::skipws ( stream &  ios)

◆ allocate_shared()

template<typename T , class Alloc , class... Args>
shared_ptr< T > ecl::allocate_shared ( const Alloc &  alloc,
Args...  args 
)
Template Parameters
UIs a T or is a subclass of T.
Here is the call graph for this function:

◆ operator==() [1/2]

template<typename T >
bool ecl::operator== ( const shared_ptr< T > &  shr,
std::nullptr_t  nullp 
)
Here is the call graph for this function:

◆ operator!=() [1/2]

template<typename T >
bool ecl::operator!= ( const shared_ptr< T > &  shr,
std::nullptr_t  nullp 
)
Here is the call graph for this function:

◆ operator==() [2/2]

template<typename T >
bool ecl::operator== ( const shared_ptr< T > &  shr1,
const shared_ptr< T > &  shr2 
)
Here is the call graph for this function:

◆ operator!=() [2/2]

template<typename T >
bool ecl::operator!= ( const shared_ptr< T > &  shr1,
const shared_ptr< T > &  shr2 
)
Here is the call graph for this function:

◆ operator!()

template<typename T >
bool ecl::operator! ( const shared_ptr< T > &  shr)
Here is the call graph for this function:

◆ endl()

template<typename stream >
stream& ecl::endl ( stream &  ios)

◆ is_error()

static bool ecl::is_error ( err  error)
inlinestatic

◆ is_ok()

static bool ecl::is_ok ( err  error)
inlinestatic
Here is the call graph for this function:

◆ err_to_str()

const char * ecl::err_to_str ( err  error)

◆ LE()

template<typename Integer >
Integer ecl::LE ( Integer  in)

◆ BE() [1/6]

static uint16_t ecl::BE ( uint16_t  in)
inlinestatic

◆ BE() [2/6]

static int16_t ecl::BE ( int16_t  in)
inlinestatic

◆ BE() [3/6]

static uint32_t ecl::BE ( uint32_t  in)
inlinestatic

◆ BE() [4/6]

static int32_t ecl::BE ( int32_t  in)
inlinestatic

◆ BE() [5/6]

static uint64_t ecl::BE ( uint64_t  in)
inlinestatic

◆ BE() [6/6]

static int64_t ecl::BE ( int64_t  in)
inlinestatic

◆ for_each_impl()

template<class FuncT , class TupleT , size_t ... Is>
void ecl::for_each_impl ( TupleT &  tuple,
FuncT  func,
std::index_sequence< Is... >   
)

◆ for_each() [1/2]

template<class FuncT , class ... Tp>
void ecl::for_each ( std::tuple< Tp... > &  tuple,
FuncT  func 
)
Here is the call graph for this function:

◆ for_each() [2/2]

template<template< typename > class Callable, class ... Tp>
void ecl::for_each ( )

For-each for types only.

Template Parameters
CallableType with operator() overloaded
TpTypes for with Callable will be called

◆ offset_of()

template<typename T1 , typename T2 >
constexpr size_t ecl::offset_of ( T1 T2::*  member)
inline

Obtains offset of the given member within given type.

◆ extract_value()

template<typename Enum >
constexpr auto ecl::extract_value ( Enum  val)

Extracts value from enumerator element of given type.

Template Parameters
EnumEnumerator type.
Parameters
[in]valValue of the enumerator type.
Returns
Integer representation of the enum value.

◆ strlen_constexpr() [1/2]

template<int N>
constexpr auto ecl::strlen_constexpr ( const char(&)  str[N])

Calculates string length in compile time, if possible.

◆ strlen_constexpr() [2/2]

constexpr auto ecl::strlen_constexpr ( const char *  str)

Calculates string length in compile time, if possible.

Overload for consuming pointers.

◆ strchri_constexpr()

constexpr int ecl::strchri_constexpr ( const char *  str,
char  ch 
)

Returns an index to the first occurrence of the character in the string.

Usable in compile-time

Returns
Index of a character in string where given char is located, -1 otherwise.

◆ version()

static const char* ecl::version ( )
inlinestatic

Returns constant version string of theCore.

◆ git_commit()

static const char* ecl::git_commit ( )
inlinestatic

Returns string with SHA of git commit.

◆ git_branch()

static const char* ecl::git_branch ( )
inlinestatic

Returns git branch.

◆ git_url()

static const char* ecl::git_url ( )
inlinestatic

Returns remote URL of theCore.

◆ bypass_puts()

static void ecl::bypass_puts ( const char *  str)
inlinestatic

Bypasses console drivers and puts string directly to the UART.

Here is the call graph for this function:

◆ bypass_greeting()

static void ecl::bypass_greeting ( )
inlinestatic

Puts a greeting to a theCore console.

Here is the call graph for this function:

◆ wait_for() [1/3]

template<class Predicate >
static bool ecl::wait_for ( uint32_t  ms,
Predicate  pred 
)
inlinestatic

Waits conditionally not less than given amount of milliseconds.

Template Parameters
PredicatePredicate type.
Parameters
[in]msMilliseconds to wait. Can be 0.
[in]predPredicate to check.
Todo:
Use RTC instead of relying on clock. See #213 also.

Stops waiting if predicate returns true. Guarantees that predicate will be called at least once.

Note
If WFE and systimer are present and used, MCU will go to sleep, waiting for events. External events or interrupts will wake up MCU, allowing predicate to be executed. This also means that at minimum, MCU will wake up on every timer interrupt. In such manner, granularity of predicate checks depends on events rate.
Return values
falseTimeout reached and predicate is still false.
truePredicate returned true before timeout was hit.
Here is the call graph for this function:

◆ wait_for() [2/3]

static void ecl::wait_for ( uint32_t  ms)
inlinestatic

Waits in loop for a given amount of milliseconds.

Parameters
[in]msMilliseconds to wait
Todo:
Use RTC instead of relying on clock. See #213 also.
Here is the call graph for this function:

◆ wait_for() [3/3]

template<class Rep , class Period >
static void ecl::wait_for ( const std::chrono::duration< Rep, Period > &  wait_duration)
inlinestatic

Waits in loop for given amount of time, expressed using std::chrono library.

Parameters
[in]wait_durationTime to wait.
Todo:
Use RTC instead of relying on clock. See #213 also.
Here is the call graph for this function:

◆ abort()

static void ecl::abort ( )
inlinestatic

Aborts execution of currently running code. Never return.

◆ spin_wait() [1/2]

static void ecl::spin_wait ( unsigned  ms)
inlinestatic

Performs a dummy busy wait for specified amount of milliseconds.

Parameters
msnumber of milliseconds to wait.

This function is useful for a short delays.

Returns
None.
Here is the call graph for this function:

◆ spin_wait() [2/2]

static void ecl::spin_wait ( unsigned  ms)
inlinestatic

Waits not less than given amount of milliseconds.

◆ bypass_init()

static void ecl::bypass_init ( )
inlinestatic

Initializes bypass console.

◆ direct_exti()

template<uint32_t SplExti>
constexpr auto ecl::direct_exti ( )

Checks if given EXTI line is direct.

Template Parameters
SplExtiEXTI line in the SPL representation.
Returns
true if EXTI is direct and false if otherwise.

◆ grouped_exti()

template<uint32_t SplExti>
constexpr auto ecl::grouped_exti ( )

Checks if given EXTI line is grouped.

Template Parameters
SplExtiEXTI line in the SPL representation.
Returns
true if EXTI is grouped and false if otherwise.

◆ get_exti_idx()

template<uint32_t SplExti>
constexpr auto ecl::get_exti_idx ( )

Gets EXTI index suitable for arranging EXTI handlers in an array.

Template Parameters
SplExtiEXTI line in the SPL representation.

Indexing is different for grouped and direct EXTI.

Returns
EXTI index randing from [0 ... CONFIG_ECL_EXTI_DIRECT_COUNT) for direct EXTI and [0 ... CONFIG_ECL_EXTI_GROUPED_COUNT) for grouped EXTI.

◆ adcs_count()

static constexpr auto ecl::adcs_count ( )
static

Gets amount of present ADC devices.

◆ get_adc_idx()

static constexpr auto ecl::get_adc_idx ( adc_dev  dev)
static

Maps ADC to index in the ADC array.

Variable Documentation

◆ nifty_counter

int ecl::nifty_counter
static

Tracks initialization and destruction.

◆ console_obj_buf

std::aligned_storage< sizeof(console_driver), alignof(console_driver) >::type ecl::console_obj_buf
static

Memory for the console device driver.

◆ cin_obj_buf

std::aligned_storage< sizeof(cin_type), alignof(cin_type) >::type ecl::cin_obj_buf
static

Memory for the cin object.

◆ cout_obj_buf

std::aligned_storage< sizeof(cout_type), alignof(cout_type) >::type ecl::cout_obj_buf
static

Memory for the cout object.

◆ cerr_obj_buf

std::aligned_storage< sizeof(cerr_type), alignof(cerr_type) >::type ecl::cerr_obj_buf
static

Memory for the cerr object.

◆ console_device

istream<console_driver>::device_type& ecl::console_device = reinterpret_cast< console_driver& >(console_obj_buf)

◆ cin

istream< console_driver > & ecl::cin = reinterpret_cast< cin_type& >(cin_obj_buf)

◆ cout

ostream< console_driver > & ecl::cout = reinterpret_cast< cout_type& >(cout_obj_buf)

◆ cerr

ostream< console_driver > & ecl::cerr = reinterpret_cast< cerr_type& >(cerr_obj_buf)

◆ ver_str

const char* ecl::ver_str = "@PROJECT_NAME@ v@PROJECT_VERSION@ " "@PROJECT_GIT_SHORT@" DIRTY

◆ ver_commit

const char* ecl::ver_commit = "@PROJECT_GIT_COMMIT@"

◆ ver_branch

const char* ecl::ver_branch = "@PROJECT_GIT_BRANCH@"

◆ ver_url

const char* ecl::ver_url = "@PROJECT_GIT_URL@"

◆ storage

handler_storage ecl::storage[IRQ_COUNT]
static

IRQ storage itself.

◆ greeter_obj

struct ecl::greeter ecl::greeter_obj
static

◆ dispatcher_obj

struct ecl::dispatcher_timer ecl::dispatcher_obj
static

◆ stream_initializer

struct ecl::iostream_initializer ecl::stream_initializer
static

◆ adc_irqn

constexpr auto ecl::adc_irqn = ADC_IRQn
static

ADC IRQ channel.

It is typical for stm32 devices to have only one IRQ for all ADCs. If for some families it is not a case, additional IRQ must be added and logic must be changed.

◆ adcs

constexpr adc_dev ecl::adcs[] = { adc_dev::dev1, adc_dev::dev2, adc_dev::dev3 }
static

Possible ADCs/.

◆ exti_irq_idx_direct_mapping [1/2]

constexpr std::pair<size_t, IRQn> ecl::exti_irq_idx_direct_mapping[]
static
Initial value:
=
{
{get_exti_idx<EXTI_Line0>(), EXTI0_IRQn},
{get_exti_idx<EXTI_Line1>(), EXTI1_IRQn},
{get_exti_idx<EXTI_Line2>(), EXTI2_IRQn},
{get_exti_idx<EXTI_Line3>(), EXTI3_IRQn},
{get_exti_idx<EXTI_Line4>(), EXTI4_IRQn},
}

Maps direct EXTI IRQs into appropriate EXTI index.

◆ exti_irq_idx_grouped_mapping [1/2]

constexpr std::pair<size_t, IRQn> ecl::exti_irq_idx_grouped_mapping[]
static
Initial value:
=
{
{get_exti_idx<EXTI_Line9>(), EXTI9_5_IRQn},
{get_exti_idx<EXTI_Line15>(), EXTI15_10_IRQn},
}

Maps grouped EXTI IRQs into appropriate EXTI index.

◆ exti_irq_idx_direct_mapping [2/2]

constexpr std::pair<size_t, IRQn> ecl::exti_irq_idx_direct_mapping[]
static
Initial value:
=
{
{get_exti_idx<EXTI_Line0>(), EXTI0_IRQn},
{get_exti_idx<EXTI_Line1>(), EXTI1_IRQn},
{get_exti_idx<EXTI_Line2>(), EXTI2_IRQn},
{get_exti_idx<EXTI_Line3>(), EXTI3_IRQn},
{get_exti_idx<EXTI_Line4>(), EXTI4_IRQn},
}

Maps direct EXTI IRQs into appropriate EXTI index.

◆ exti_irq_idx_grouped_mapping [2/2]

constexpr std::pair<size_t, IRQn> ecl::exti_irq_idx_grouped_mapping[]
static
Initial value:
=
{
{get_exti_idx<EXTI_Line9>(), EXTI9_5_IRQn},
{get_exti_idx<EXTI_Line15>(), EXTI15_10_IRQn},
}

Maps grouped EXTI IRQs into appropriate EXTI index.