Processor power management technologies are defined in the ACPI specification and are divided into two categories or states:【参考1】
Power performance states (ACPI P states)P-states provide a way to scale the frequency and voltage at which the processor runs so as to reduce the power consumption of the CPU. The number of available P-states can be different for each model of CPU, even those from the same family.
Processor idle sleep states (ACPI C states)C-states are states when the CPU has reduced or turned off selected functions. Different processors support different numbers of C-states in which various parts of the CPU are turned off. To better understand the C-states that are supported and exposed, contact the CPU vendor. Generally, higher C-states turn off more parts of the CPU, which significantly reduce power consumption. Processors may have deeper C-states that are not exposed to the operating system.
简单的说, P-states 是 CPU 醒着的时候降低功耗(好比上班摸鱼,玩玩手机放松一下,但是随时都是醒着的),C-states 就是CPU 睡着了。
从下面的示意图可以看的更清晰
System states【参考2】【参考3】睡得越深,需要关闭的东西越多,也更加省电,相反,需要醒来的时间会越长【参考3】进入 C-States 的一些动作【参考3】
The maximum PWM frequency with the currently used ledc duty resolution of 10 bits in PWM module is 78.125KHz.
The duty resolution can be lowered down to 1 bit in which case the maximum frequency is 40 MHz, but only the duty of 50% is available.
For duty resolution of 8 buts, the maximal frequency is 312.5 kHz.
The available duty levels are (2^bit_num)-1, where bit_num can be 1-15.
The maximal frequency is 80000000 / 2^bit_num
In my MicroPython implementation, I'm currently working on enabling user selectable and/or automatic duty resolution and higher maxumum frequencies.
/*
Streaming of sound data with Bluetooth to an other Bluetooth device.
We provide the complete sound data as a simple c array which
can be prepared e.g. in the following way
- Open any sound file in Audacity. Make sure that it contains 2 channels
- Select Tracks -> Resample and select 44100
- Export -> Export Audio -> Header Raw ; Signed 16 bit PCM
- Convert to c file e.g. with "xxd -i file_example_WAV_1MG.raw file_example_WAV_1MG.c"
- add the const qualifier to the array definition. E.g const unsigned char file_example_WAV_1MG_raw[] = {
Copyright (C) 2020 Phil Schatzmann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "BluetoothA2DPSource.h"
#include "StarWars30.h"
BluetoothA2DPSource a2dp_source;
//SoundData *data = new TwoChannelSoundData((Channels*)StarWars10_raw,StarWars10_raw_len/4);
SoundData *data = new OneChannelSoundData((int16_t*)StarWars30_raw, StarWars30_raw_len/2);
void setup() {
Serial.begin(115200);
Serial.println("Start");
a2dp_source.start("JABRA TALK");
}
void loop() {
if (a2dp_source.isConnected()==true) {
Serial.println("Connected!");
if (a2dp_source.hasSoundData()==true) {
Serial.println("Has sound!");
}
else {
Serial.println("No sound!");
a2dp_source.writeData(data);
}
}
else {
Serial.println("Not connected!");
}
delay(2000);
}