class::ev::EventLoopAttributes

class ev::EventLoopAttributes
  : public api::InfoObject

This class defines attributes that apply to an ui::EventLoop.

Summary

EventLoopAttributes()

chrono::Microseconds hibernation_threshold() const

[operator event_loop_attr_t](#classev_1_1_event_loop_attributes_1a1edf66c8d11c9e21e43f3ecb8b1ba2d2)() *const*

chrono::Microseconds period() const

chrono::MicroTime refresh_wait_resolution() const

void set_hibernation_threshold(

const chrono::MicroTime & value
)

void set_period(

const chrono::MicroTime & value
)

void set_refresh_wait_resolution(

const chrono::MicroTime & value
)

void set_update_period(

const chrono::MicroTime & value
)

chrono::Microseconds update_period() const

protected event_loop_attr_t m_attr

Members

EventLoopAttributes()

Construct new Event Loop attributes


chrono::Microseconds hibernation_threshold() const

Accesses the hibernate timeout in chrono::MicroTime.


operator event_loop_attr_t() const

chrono::Microseconds period() const

Accesses the minimum period of the event loop in chrono::MicroTime.


chrono::MicroTime refresh_wait_resolution() const

Accesses the display refresh wait resolution time in microseconds.

The loop will always wait for the display driver to complete its refresh before handling events that modify the display memory. This value determines how long to sleep between polling events to the display driver.


void set_hibernation_threshold(

const chrono::MicroTime & value
)

Sets the hibernate threshold in MicroTime.

Parameters

  • value The hibernate threshold as a MicroTime value

If the update period (set_update_period()) is greater than the hibernation threshold, the event loop will execute the kernel request for hibernation. If the kernel request is not handled, the event loop will put the system in hibernate. The logic looks like this:

if( update_period() > hibernation_threshold() ){
   if( Sys::request(SAPI_REQUEST_HIBERNATE) < 0 ){
      Sys::hibernate( update_period() / 1000 );  //kernel hibernate will wake on an RTC alarm if the RTC is present
   }
}

This logic allows the BSP (which implements the kernel_request() function called by Sys::request()) to override or delay the hibernation until other applications or tasks are ready.

By default, the hibernation threshold is set to the max value (65536) effectively disabling hibernation.

The system will stay in hibernation mode until a hardware interrupt wakes the processor. This interrupt typically needs to be a external pin interrupt or RTC alarm because most peripherals are off during hiberation.


void set_period(

const chrono::MicroTime & value
)

Sets the period of the event loop in chrono::MicroTime.

The loop will delay this amount on every iteration. This determines how often events are processed (such as buttons). It is typically a much smaller value than the update period which determines how often Event::UPDATE is handled.


void set_refresh_wait_resolution(

const chrono::MicroTime & value
)

Sets the value of the display refresh wait resolution in microseconds.

Parameters

  • value The number of microseconds to between display driver polling events

See refresh_wait_resolution() for more details.


void set_update_period(

const chrono::MicroTime & value
)

Sets the Event::UPDATE period which defines how often the event loop will trigger the Event::UPDATE command for the current element.

Parameters

  • value The period as chrono::MicroTime

If the update period is less than the loop period (see set_period()), Event::UPDATE will be called on every loop at the loop period interval.


chrono::Microseconds update_period() const

Accesses the period for firing the Event::UPDATE in chrono::MicroTime.


protected event_loop_attr_t m_attr

X

Thanks for Coming!

Subscribe to news and updates