mn::device::basic_system Class Reference

Get system infos and useful system functins of the using platform. More...

#include <mn_system.hpp>

Static Private Member Functions

public static void shutdown (power_state_code code, mn::timespan_t span=mn::timespan_t(0))
 Halt the CPU. More...
 
static void restart (power_state_code code, mn::timespan_t span=mn::timespan_t(0))
 Restart the CPU. More...
 
static void deepsleep (power_state_code code, uint64_t time_us, mn::timespan_t span=mn::timespan_t(0))
 Enter deep sleep with wakeup by timer. More...
 
static randomAccessMemory get_internal ()
 Return the infos from the internal RAM. More...
 
static randomAccessMemory get_external ()
 Return the infos from the external RAM. More...
 
static uint8_t get_core_speed (const uint8_t core)
 Get the speed of a core in Mhz. More...
 
static uint8_t get_speed ()
 Get the mega hertz of the cpu. More...
 
static void set_core_speed (const uint8_t core, const uint8_t speed)
 Set the speed of a given core. More...
 
static void set_speed (const uint8_t speed)
 Set the speed in Mhz of the cpu. More...
 
static const char * get_sdk_version ()
 Get the version of the using platform SDKs. More...
 
static const char * get_name ()
 Get the name of the using Platform. More...
 
static system_streamget_partition_stream (const char *name)
 Get a system stream to write/read to a partition. More...
 

Private Attributes

public __pad0__: public : enum class power_state_code : int { normal
 
public error
 
public __pad1__: union randomAccessMemory { struct { uint32_t size
 
uint32_t free
 
uint32_t min_freeSinceBoot
 
uint32_t maxAlloc
 
uint32_t data [3]
 
public __pad2__: static uint8_t get_num_cores()
 
public __pad3__: static system_stream* get_flash()
 

Detailed Description

Get system infos and useful system functins of the using platform.

Member Function Documentation

◆ deepsleep()

void mn::device::basic_system::deepsleep ( power_state_code  code,
uint64_t  time_us,
mn::timespan_t  span = mn::timespan_t(0) 
)
staticprivate

Enter deep sleep with wakeup by timer.

Parameters
time_usdeep-sleep time, unit: microsecond.
spanhow many time to wait to deepsleep the system.

◆ get_core_speed()

uint8_t mn::device::basic_system::get_core_speed ( const uint8_t  core)
staticprivate

Get the speed of a core in Mhz.

Returns
Cet the speed of a core.
Note
On ESP32: return get_speed();

◆ get_external()

basic_system::randomAccessMemory mn::device::basic_system::get_external ( )
staticprivate

Return the infos from the external RAM.

Note
ESP32: psram.

◆ get_internal()

basic_system::randomAccessMemory mn::device::basic_system::get_internal ( )
staticprivate

Return the infos from the internal RAM.

◆ get_name()

const char * mn::device::basic_system::get_name ( )
staticprivate

Get the name of the using Platform.

Returns
The name.

◆ get_partition_stream()

system_stream * mn::device::basic_system::get_partition_stream ( const char *  name)
staticprivate

Get a system stream to write/read to a partition.

Parameters
nameThe name of partition.
Returns
The stream to a partiotion or nullptr if the partition mith the given name not exist.

◆ get_sdk_version()

const char * mn::device::basic_system::get_sdk_version ( )
staticprivate

Get the version of the using platform SDKs.

Returns
The version of the using platform SDKs.

◆ get_speed()

uint8_t mn::device::basic_system::get_speed ( )
staticprivate

Get the mega hertz of the cpu.

Returns
The speed in Mhz of the cpu.

◆ restart()

void mn::device::basic_system::restart ( power_state_code  code,
mn::timespan_t  span = mn::timespan_t(0) 
)
staticprivate

Restart the CPU.

Note
ESP32: Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset.
Parameters
code
spanhow many time to wait to shutdown the system.

◆ set_core_speed()

void mn::device::basic_system::set_core_speed ( const uint8_t  core,
const uint8_t  speed 
)
staticprivate

Set the speed of a given core.

Note
On ESP32 is the same with set_speed(speed);

◆ set_speed()

void mn::device::basic_system::set_speed ( const uint8_t  speed)
staticprivate

Set the speed in Mhz of the cpu.

◆ shutdown()

void mn::device::basic_system::shutdown ( power_state_code  code,
mn::timespan_t  span = mn::timespan_t(0) 
)
staticprivate

Halt the CPU.

Parameters
code
spanhow many time to wait to shutdown the system.
Note
ESP32: Enter to the deepsleep mode with wakeup with any gpio pin.

Member Data Documentation

◆ __pad0__

public mn::device::basic_system::__pad0__
private

normal code, no error.

◆ __pad1__

public mn::device::basic_system::__pad1__
private

Total size of the RAM.

◆ __pad2__

public mn::device::basic_system::__pad2__
private

◆ __pad3__

public mn::device::basic_system::__pad3__
private

◆ data

uint32_t mn::device::basic_system::data[3]
private

◆ error

public mn::device::basic_system::error
private

on error

◆ free

uint32_t mn::device::basic_system::free
private

Current available RAM.

◆ maxAlloc

uint32_t mn::device::basic_system::maxAlloc
private

largest block of bytes that can be allocated at once.

◆ min_freeSinceBoot

uint32_t mn::device::basic_system::min_freeSinceBoot
private

lowest size of free RAM since boot


The documentation for this class was generated from the following files: