PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

88 行
1.1KB

  1. #ifndef LowPower_h
  2. #define LowPower_h
  3. #ifndef __AVR__
  4. #error "This LowPower library only works on AVR processors"
  5. #endif
  6. enum period_t
  7. {
  8. SLEEP_15Ms,
  9. SLEEP_30MS,
  10. SLEEP_60MS,
  11. SLEEP_120MS,
  12. SLEEP_250MS,
  13. SLEEP_500MS,
  14. SLEEP_1S,
  15. SLEEP_2S,
  16. SLEEP_4S,
  17. SLEEP_8S,
  18. SLEEP_FOREVER
  19. };
  20. enum bod_t
  21. {
  22. BOD_OFF,
  23. BOD_ON
  24. };
  25. enum adc_t
  26. {
  27. ADC_OFF,
  28. ADC_ON
  29. };
  30. enum timer2_t
  31. {
  32. TIMER2_OFF,
  33. TIMER2_ON
  34. };
  35. enum timer1_t
  36. {
  37. TIMER1_OFF,
  38. TIMER1_ON
  39. };
  40. enum timer0_t
  41. {
  42. TIMER0_OFF,
  43. TIMER0_ON
  44. };
  45. enum spi_t
  46. {
  47. SPI_OFF,
  48. SPI_ON
  49. };
  50. enum usart0_t
  51. {
  52. USART0_OFF,
  53. USART0_ON
  54. };
  55. enum twi_t
  56. {
  57. TWI_OFF,
  58. TWI_ON
  59. };
  60. class LowPowerClass
  61. {
  62. public:
  63. void idle(period_t period, adc_t adc, timer2_t timer2,
  64. timer1_t timer1, timer0_t timer0, spi_t spi,
  65. usart0_t usart0, twi_t twi);
  66. void adcNoiseReduction(period_t period, adc_t adc, timer2_t timer2);
  67. void powerDown(period_t period, adc_t adc, bod_t bod);
  68. void powerSave(period_t period, adc_t adc, bod_t bod, timer2_t timer2);
  69. void powerStandby(period_t period, adc_t adc, bod_t bod);
  70. void powerExtStandby(period_t period, adc_t adc, bod_t bod, timer2_t timer2);
  71. };
  72. extern LowPowerClass LowPower;
  73. #endif