Skip to content

lowPower_Halt

gicking edited this page Feb 9, 2018 · 6 revisions

back to Command Reference / Power-Saving

Description

Enter the STM8 HALT low-power mode. In this mode all clocks and peripherals are stopped, main regulator is disabled and flash is put to sleep mode. As a consequence:

  • only external pin interrupts can wake the device
  • current consumption is in the (low) uA range

Inclusion

  • defined in low-power.h
  • not loaded by main_general.h
  • no #define required

Syntax

lowPower_Halt()

Parameters

  • input:

    • none
  • output:

    • none

Returns

  • Nothing

Example Code

The below function counts number of falling edges on pin PE5 in low-power mode.

#include "main_general.h"
#include "low-power.h"

uint16_t count=0;

ISR_HANDLER(PORTE_ISR, __PORTE_VECTOR__) {
  count++;
}

void setup() {
  noInterrupts();
  pinMode(&PORT_E, 5, INPUT_PULLUP_INTERRUPT);
  configExintEdge(&PORT_E, FALLING);
  interrupts();
  pinMode(&PORT_D, 0, OUTPUT);
}

void loop() {
  lowPower_Halt();
  pinToggle(&PORT_D, 0);
}

Relevant Tutorial

Notes and Warnings

  • to decrease power consumption in active mode, disable unused peripherals and clock down the core (not yet supported)

See also

Clone this wiki locally