-
Notifications
You must be signed in to change notification settings - Fork 0
Power Manager
ProffieOS v6.7x009
The power manager turns on and off the following power domains:
- Pixel blade
- Audio amplifier
- Audio booster
- SD Card
- Processor
The power subscribers are firmware objects that require one ore more power domains to be active in order to operate. Power subscribers request power and have each assigned a timeout, after which the power manager will consider that the subscriber no longer needs power. Each power domain gets automatically turned off when no subscriber needs it anymore, and when no domain remains on the processor will go into deep sleep mode. Waking up from deep sleep can be caused by a button action or by receiving data on the serial port.
The power domains are handled by the power manager. The power subscribers should do the following:
In order to become a power subscriber, a class must inherit the xPowerSubscriber class and call its constructor specifying the power domains it will subscribe to.
class MyClass : xPowerSubscriber {
MyClass() : xPowerSubscriber(pwr4_none) { // replace pwr_none with a bitwise OR of PDType flags
// my constructor
}
}Once subscribed to one or more power domains, the subscriber will:
- turn ON when all its subscribed power domains are on
- turn OFF when at leas one of its subscribed power domains are off
The power manager provides callback functions that can be used to initialize / deinitialize objects or peripherals when the subscriber's power turns on and off.
ON/OFF actions are defined by overriding the PwrOn_Callback() and PwrOff_Callback() functions:
void PwrOn_Callback() override {
// Action to run immediately after subscriber's power goes on
}
void PwrOff_Callback() override {
// Action to run just before subscriber's power goes off
}When a subscriber is requesting power:
- If any subscribed domain is off, it will turn on
- All subscribed domains will reset their own auto-power-off (timeout) timer
Power is requested by calling the RequestPower() function:
myobject.RequestPower(); // turn and keep power onOnce a domain is turned on, it will automatically turn off if the timeout expires without any subscriber requesting power from it. Each domain has its built-in timeout, which can be overriden by the subscriber requesting power:
uint32_t subscriber_timeouts[] = { 500, 10000 }; // timeout in milliseconds for each subscribed domain, in PDType order.
myobject.RequestPower(subscriber_timeouts); // turn and keep power on, reset timeouts to specified valuesOnce the subscriber's power turned on, an alternative to repeaditly request power before any domain timeouts is to hold power asynchronously. This allows the subscriber to maintain power based on logical rather than timed conditions, by overriding the HoldPower() function:
virtual bool HoldPower() override {
// return true to hold power
// processor will not go in deep sleep as long as any subscriber is holding power
return false;
}As long as HoldPower() returns true, all the subscribed domains will pause their timeout timer.
(C) RSX Engineering SRL. FileVer. 1.1 / Apr. 2023
- Board Configuration (coming soon)
- Install Configuration
- User Profile
- Twist & Tick Menu (coming soon)
- UltraSaber Prop (coming soon)
- COD Reader
- Interpolators
- CPU Probes
- Developer's Setup(coming soon)