PAL
PAL common interface.
TWELITE PAL's hardware has common parts, and board BEHAVIOR also defines common interfaces for common hardware.
constants
The following definitions are available
It can be accessed as PAL_AMB::PIN_BTN
.
Hardware initialization
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.
To avoid watchdog timer timeout, TWELITE should be set to wake up within 60 seconds (when using calibrated internal CR timer).
Methods
set_led()
LED (D1) control.
Do not call this method if you do not want to control with board BEHAVIOR.
mode
は以下のパラメータを取ります。tick
は点灯時間[ms]を指定しますが、詳細はmode
の解説を参照してください。
LED_TIMER::BLINK
Blinks the LED. ON/OFF is toggled every [ms] of time given to tick
. 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.
led_one_shot()
Turns on the LED for a specified period of time. Cannot be used at the same time as the set_led()
function.
get_D1() .. D4(), get_DIPSW_BM()
get_D1() ... get_D4()
returns 0
when DIP SW is HIGH (switch is up) and 1
when it is LOW (switch is down).
get_DIPSW_BM()
returns the DIP SW setting as 0..15
. Returns the sum of SW1==LOW
as 1
, SW2 == LOW
as 2
, SW3 == LOW
as 4
and SW4 == LOW
as 8
.
The opposite of HIGH(1),LOW(0)
of D1...D4.
This is because the LOW(0)
side of the DIP SW is set, meaning it has a value of 1
.
This value is checked at system startup and is not updated by manipulating the switch thereafter.
最終更新