<PAL_MAG>
Board BEHAVIOR for OPEN-CLOSE SENSE PAL OPEN-CLOSE SENSE PAL.
The sensor of the open/close sensor pal is a magnetic sensor, which is the only input for the interrupt of the two signal lines.
PAL_MAG::PIN_NSNSNS_NORTH
is interrupted when the sensor detects an N-pole and PAL_MAG::PIN_NSNSNS_SOUTH
is interrupted when the sensor detects an N-pole.
The following settings should be made before sleep
Check the IO of the waking factor upon waking.
<PAL_MOT>
Board BEHAVIOR for MOTION SENSE PAL MOTION SENSE PAL.
In addition to common definitions, it can handle sensors on the board.
Accelerometer MC3630
MC3630 Sensor object.
<PAL_AMB>
Board BEHAVIOR for Environmental Sensor Pal AMBIENT SENSE PAL.
Common Definition plus the sensors on the board can be handled.
Temperature/humidity sensor SHTC3
Illuminance sensor LTR308ALS
SHTC3 sensor object.
LTR308ALS sensor object.
<PAL_NOTICE>
Board BEHAVIOR for NOTICE PAL.
In addition to common definition plus the ability to handle sensors on the board.
LED driver PCA9632
Accelerometer MC3630
[PCA9632 device](... /... /sensor_object/pca9632-leddoraiba.md) object. The board definition performs Wire initialization and device initialization. In principle, it is controlled using the PCA9632 operation method described below.
It is not possible to continuously draw a large current from a CR2032 coin cell. In this board definition, the maximum illuminance setting in normal operation is set at a PWM duty ratio of approximately 50%, but even at this setting, overload effects may be apparent. Adjust the combination of LEDs, illumination intensity, and blinking according to the operating requirements.
When using coin cell batteries, periodic, momentary flashing can mitigate the effects of large currents.
For example, a setting that allows the LED to flash for 20 ms every second or so will not only maintain sufficient visual brightness to mitigate the above effects, but will also reduce battery drain. ) {endhint %}
MC3630 sensor object. The board definition includes SPI initialization, MC3630 device initialization, and MC3630 interrupt processing. Various processes are handled by sns_MC3630
.
NOTICE PAL has a FET switch at the rear of the PCA9632 output. The LED will not light unless this switch is turned ON.
Set individual LEDs to off, on, or blinking.
set_leds() changes the lighting status of all LEDs. Parameters are lighting statePAL_NOTICE::LED_OFF
PAL_NOTICE::LED_ON
PAL_NOTICE::LED_BLINK
PAL_NOTICE::LED_NOP
.
Specifies the PWM duty ratio (LED lighting brightness).
set_led_brightness_? _reg()
and set_leds_brightness_reg()
specify the register value directly. 0...255 is specified and the lighting will be the ratio duty/256
.
set_led_brightness_?1000()
and set_leds_brightness1000()
specify a duty ratio of 0..1000, where 0 corresponds to no light and the larger the value, the brighter (longer lighting interval). If boost
is set to false
, the register value is 127 when 1000 is specified. If boost
is set to true
, the register value will be 255.
Since PAL is operated by a coin cell battery, the specified maximum value is set to a duty ratio of approximately 50%.
The final setting is assigned to the register value, so even if 0...1000 steps are specified, the actual control value will be the precision of the register value.
LEDs with PAL_NOTICE::LED_BLINK
will blink with the specified period and lighting duration ratio.
Blinking patterns cannot be specified individually.
Brightness can also be controlled since the LEDs are turned on at the PWM duty ratio specified in the lighting illuminance setting above.
set_blink_cycle_ms()
blinks for a period of time specified by x
.
set_blink_duty1000()sets
xto 0..1000 and blinks for
cycle*x/1000` as the lighting period.
The final setting is assigned to the register value, so even if you specify 0...1000 steps, the actual control value will be the precision of the register value.
Turns on the 4 LEDs for a very short period of time. After lighting, the master switch is turned on (set_led_master_sw_on()
).
PAL common interface.
TWELITE PAL's hardware has common parts, and board BEHAVIOR also defines common interfaces for common hardware.
The following definitions are available
It can be accessed as PAL_AMB::PIN_BTN
.
Each pin is initialized as shown in the code above.
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).
LED (D1) control.
Do not call this method if you do not want to control with board BEHAVIOR.
mode
は以下のパラメータを取ります。tick
は点灯時間[ms]を指定しますが、詳細はmode
の解説を参照してください。
The setting before the return to sleep is maintained after the return to sleep.
Turns on the LED for a specified period of time. Cannot be used at the same time as the set_led()
function.
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.
Definition | Meaning |
---|---|
Definition | Meaning |
---|---|
Definition | Meaning |
---|---|
Designation | Meaning |
---|---|
PAL_NOTICE::LED_OFF
OFF
PAL_NOTICE::LED_ON
On (PWM illuminance control)
PAL_NOTICE::LED_BLINK
Blinking
PAL_NOTICE::LED_NOP
Do not change
PAL_NOTICE::LED_R
LED Red
PAL_NOTICE::LED_G
LED Green
PAL_NOTICE::LED_B
LED Green
PAL_NOTICE::LED_W
LED White
PAL_NOTICE::LED_REG_MAX_PWM
PMW register set value for standard illuminance (1/2 of all lights are standard)
PAL_NOTICE::LED_REG_BOOST_PWM
PWM register set value for boosting
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.