MWX Library
latest_en
latest_en
  • The MWX Library
  • revision history
  • About the MWX library
    • License
    • Terms
    • The design policy
  • Install and Build
    • Environment (OS, etc.)
    • Installing the TWELITE SDK
    • Building ACT
    • Creating a new project
    • Installing VSCode
    • Build definition Makefile
    • Other platforms
  • Sample ACTs
    • act0 .. 4
    • Scratch
    • Slp_Wk_and_Tx
    • Parent_MONOSTICK
    • PingPong
    • BRD_APPTWELITE
    • BRD_I2C_TEMPHUMID
    • PAL_AMB
    • PAL_AMB-usenap
    • PAL_AMB-bhv
    • PAL_MAG
    • PAL_MOT-single
    • PAL_MOT-fifo
    • PulseCounter
    • WirelessUART
    • Rcv_Univsl
    • Unit_???
  • API
    • Definition.
    • class object
      • the_twelite
      • Analogue
      • Buttons
      • EEPROM
      • PulseCounter
      • Serial
      • SerialParser
      • SPI
        • SPI (using member functions)
        • SPI (using helper class)
      • TickTimer
      • Timer0 .. 4
      • Wire
        • Wire (using member functions))
        • Wire (using helper class)
    • Classes
      • MWX_APIRET
      • alloc
      • axis_xyzt
      • packet_rx
      • packet_tx
      • serparser
      • pktparser
        • E_PKT
        • idenify_packet_type()
        • TwePacket
          • TwePacketTwelite
          • TwePacketIO
          • TwePacketUART
          • TwePacketPAL
      • smplbuf
        • .get_stream_helper()
        • smplbuf_strm_u8
      • smplque
      • mwx::stream
        • format (mwx::mwx_format)
        • mwx::bigendian
        • mwx::crlf
        • mwx::flush
        • stream_helper
      • SM_SIMPLE state machine
    • Call back functions
      • setup()
      • begin()
      • loop()
      • wakeup()
      • init_coldboot()
      • init_warmboot()
      • on_rx_packet()
      • on_tx_comp()
    • BEHAVIOR
      • PAL_AMB-behavior
    • Functions
      • System Functions
        • millis()
        • delay()
        • delayMicroseconds()
        • random()
      • DIO General purpose IO
        • pinMode()
        • digitalWrite()
        • digitalRead()
        • attachIntDio()
        • detachIntDio()
        • digitalReadBitmap()
      • Utility Functions
        • Printf utils
        • pack_bits()
        • collect_bits()
        • Byte array utils
        • pack_bytes()
        • expand_bytes()
        • CRC8, XOR, LRC
        • div100()
        • Scale utils
        • pnew
    • External Libraries
      • EASTL
  • Board (BRD)
    • <BRD_APPTWELITE>
    • <MONOSTICK>
    • PAL
      • <PAL_AMB>
      • <PAL_MAG>
      • <PAL_MOT>
      • <PAL_NOTICE>
    • <CUE>
  • Sensor Devices (SNS)
    • SHTC3 - Temp/Humd sensor
    • SHT3x - Temp/Humd sensor
    • LTR-308ALS - Luminance Sensor
    • MC3630 - Accel sensor
    • BMx280 - Temp/Humd/Pressure Sensor
    • PCA9632 - LED Driver
  • Network (NWK)
    • Simple Relay Net <NWK_SIMPLE>
    • Layered Tree Net <NWK_LAYERED>
  • Settings (STG) - Interactive settings mode
    • <STG_STD>
GitBook提供
このページ内
  • constants
  • Initialize hardware
  • Watchdog Timer
  • Methods
  • set_led()
PDFとしてエクスポート
  1. Board (BRD)

<MONOSTICK>

&lt;MONOSTICK&gt;

Board BEHAVIOR for MONOSTICK. It includes procedures for controlling the built-in watchdog timer and lighting LEDs.

constants

The following definitions will be available

const uint8_t PIN_LED = mwx::PIN_DIGITAL::DIO16;  // LED

const uint8_t PIN_WDT = mwx::PIN_DIGITAL::DIO9;     // WDT (shall tick < 1sec)
const uint8_t PIN_WDT_EN = mwx::PIN_DIGITAL::DIO11; // WDT (LO as WDT enabled)

const uint8_t PIN_LED_YELLOW = mwx::PIN_DIGITAL::DO1; // YELLOW LED

It can be accessed as MONOSTICK::PIN_LED.

Initialize hardware

pinMode(PIN_LED, OUTPUT_INIT_HIGH);
pinMode(PIN_WDT, OUTPUT_INIT_LOW);
pinMode(PIN_WDT_EN, OUTPUT_INIT_LOW);
pinMode(PIN_LED_YELLOW, OUTPUT);

Each pin is initialized as shown in the code above.

Watchdog Timer

Resets the external watchdog timer at startup, sleep wakeup, and after a certain period of time after startup.

Watchdog timer timeout is 1 second.

MONOSTICK does not normally run applications that sleep, in which case it sets MONOSTICK::PIN_WDT_EN to HIGH before sleeping.

Methods

set_led()

void set_led_red(uint8_t mode, uint16_t tick)
void set_led_yellow(uint8_t mode, uint16_t tick)

LED (red, yellow) control.

Do not call this method if you do not want to control with board BEHAVIOR.

The yellow LED (MONOSTICK::PIN_LED_YELLOW) is the SPIMISO pin (semiconductor pin name DO1). This board BEHAVIOR does not include methods and procedures for lighting by PWM control. If necessary, the following description is made.

  • Do not call set_led_yellow().

  • Initialize PWM output separately after startup; the SPIMISO pin corresponds to PWM3 in the App_Twelite standard application and can be controlled by the Timer3 class object.

  • The PWM output is initialized separately after sleep recovery. At that time, the output setting of DO1 is canceled.

  • Before setting PWM, cancel the output setting of DO1. \1} pinMode(PIN_LED_YELLOW, DISABLE_OUTPUT);

The yellow LED (MONOSTICK::PIN_LED_YELLOW) cannot be turned on during sleep.

mode takes the following parameters. The tick specifies the lighting time [ms], please refer to the description of mode for details.

specification
meaning

LED_TIMER::BLINK

Blinks the LED. ON/OFF is toggled every time tick is given. After returning from sleep, it resets the count and starts from the lit state.

LED_TIMER::ON_RX

When a packet is received, it turns on for the time given to the tick, LED_TIMER::ON_RX.

LED_TIMER::ON_TX_COMP

Turns on for the time given to the tick when the transmission is completed.

The setting before the return to sleep is maintained after the return to sleep.

前へ<BRD_APPTWELITE>次へPAL

最終更新 2 年前