Public Documentation
  • Introduction
  • Getting started
    • Introduction
    • 1. Welcome Page
    • 2. Introduction (Beginner's Guide)
  • Portal Tools
    • Blocko
      • Ůvod do blocka
      • Flip-flop
      • REST-API bloček
    • Grid
      • Úvod do GRID
      • Základní Tlačítko (základy GRID)
      • vylepšený Přepínač (stylování a pokročilé možnosti GRID)
      • text generátor button (messeage type, two elements one widget)
      • graf (pokročilé funkce GRID)
      • Slider (User class v GRIDu)
      • Styly a jejich použití
  • Cloud
    • Cloud
    • Instancies
    • Rest-Api
  • General
    • What we plan
  • Hardware a programování
    • Úvod
      • Nahrání prvního programu
    • Konektivita
      • Specifikace zdroje internetu
      • GSM
      • 6LowPAN
      • Komunikace s portálem
      • Přepínání mezi servery
    • Hardware
      • Základní jednotky
        • IODAG3E
          • Rozhraní a periférie
          • Konektor X a Y
          • Napájení
          • Připojení zdroje k VBAT
          • Paměti
          • Technické specifikace
          • Schémata
        • IODAG3L
      • Rozšiřující moduly
        • GSM shield
        • LED shield
        • Relay shield
        • RFID shield
        • Ultrasonic shield
        • Meteo shield
        • Movement shield
        • PIR shield
        • RGB Displej shield
        • Serial shield
      • Ostatní
        • DevKitG3
          • Schéma
        • TK3G
          • Schéma
        • ZPPG3
          • Schéma
        • WEXP
    • Programování HW
      • Architektura FW
        • Aktualizace FW
        • Autobackup
      • Struktura programu
      • Byzance API
        • Vstupy a výstupy do Portálu
        • Callback Busy
        • Odložený restart
        • Callbacky připojení
        • Uživatelská makra
      • MBED API
        • Vstupy a výstupy
        • Komunikační rozhraní
        • Časování
        • RTOS
      • Knihovny
        • DHT
        • DS1820
        • Dali
        • EdgeStruct
        • I2CWrapper
        • Knock
        • MFRC522
        • MFRC522::MIFARE_Key
        • MPU9150
        • ms5637
        • OneWire
        • PCA9536
        • RGB_matrix
        • RollerDrive
        • SHT21
        • ST7565
        • Servo
        • TCA6424A
        • TLC59116
        • TripleSevenSeg
        • MFRC522::Uid
        • WS2812
        • WakeUp
      • Offline programování
        • Vlastní IDE
        • Upload kódu z GUI
        • Upload kódu z konzole
        • Upload kódu Drag&drop
    • Tutoriály
      • Datum a čas (RTC)
      • Komunikace po sériové lince (UART) s PC
        • Konfigurace sériové linky v PC
        • Programování sériové linky
      • Základní tutoriály
        • Digital Read
        • Analog Read/Write
        • PWM Fade
        • Timer/Ticker
        • State Change Detection
        • Ovládání LED modulu
        • BusOut
        • HC-SR04 Senzor
      • Pokročilé
    • Správa a diagnostika
      • Zdroj restartu
      • LED modul
      • Identifikace zařízení
      • Monitoring parametrů
      • Vytížení zařízení
      • Webové rozhraní
        • Základní přehled
        • Správce firmware
        • Vlákna
        • Definované vstupy
        • Konfigurace MQTT
        • Nastavení
      • Bootloader
        • Režimy bootloaderu
        • Command mód
        • Další vlastnosti bootloaderu
      • Webová konzole
      • Konfigurace zařízení
        • Confighash
      • Omezení konfigurace
        • Konfigurace
        • Binárky
        • Omezení MQTT
        • Lowpan
    • Knowledge base
      • Náhodná čísla
      • Watchdog
      • Paměť RAM
Powered by GitBook
On this page
  • Public Static Functions
  • Detailed Description
  • Public Static Functions Documentation
  • function set
  • function set_ms
  • function attach
  • function calibrate
  1. Hardware a programování
  2. Programování HW
  3. Knihovny

WakeUp

PreviousWS2812NextOffline programování

Last updated 6 years ago

Class to make wake up a microcontroller from deepsleep using a low-power timer.

Public Static Functions

Type

Name

static void

static void

static void

static void

Detailed Description

Class to make wake up a microcontroller from deepsleep using a low-power timer.

// Depending on the LED connections either the LED is off the 2 seconds
// the target spends in deepsleep(), and on for the other second. Or it is inverted 

#include "mbed.h"
#include "WakeUp.h"

DigitalOut myled(LED1);

int main() {
    wait(5);

    //The low-power oscillator can be quite inaccurate on some targets
    //this function calibrates it against the main clock
    WakeUp::calibrate();

    while(1) {
        //Set LED to zero
        myled = 0;

        //Set wakeup time for 2 seconds
        WakeUp::set_ms(2000);

        //Enter deepsleep, the program won't go beyond this point until it is woken up
        deepsleep();

        //Set LED for 1 second to one
        myled = 1;
        wait(1);
    }
}

Public Static Functions Documentation

static void WakeUp::set (
    uint32_t s
)

Set the timeout

Parameters:

  • s required time in seconds

static void WakeUp::set_ms (
    uint32_t ms
)

Set the timeout

Parameters:

  • ms required time in milliseconds

static void WakeUp::attach (
    Callback< void()> function
)

Attach a function to be called after timeout This is optional, if you just want to wake up you do not need to attach a function. Important: Many targets will run the wake-up routine at reduced clock speed, afterwards clock speed is restored. This means that clock speed dependent functions, such as printf might end up distorted.

// Attaching regular function
WakeUp::attach(&yourFunc);
// Attaching member function inside another library    
WakeUp::attach(callback(this, &YourLib::yourLibFunction));

It uses the new Callback system to attach functions.

Parameters:

  • *function function to call

static void WakeUp::calibrate (
    void 
)

Calibrate the timer Some of the low-power timers have very bad accuracy. This function calibrates it against the main timer. Warning: Blocks for 100ms!

The documentation for this class was generated from the following file: D:/w/hw-libs/\_libs\_/libraries/WakeUp.h

(uint32_t s)

(uint32_t ms)

(Callback< void()> function)

(void)

function

function

function

function

More...
set
set_ms
attach
calibrate
set
set_ms
attach
calibrate