<ARIA>
Enables access to the onboard accelerometer, magnetic sensor, and LED.
- Temperature/Humidity Sensor
- Magnetic Sensor
- LED
void setup() {
auto&& brd = the_twelite.board.use<ARIA>();
}
Temperature/Humidity Sensor
A member object for the SHT4x sensor (sns_SHT4x
) is defined.
Magnetic Sensor
The sensor used in the Door Sensor PAL is a magnetic sensor that only has two interrupt input lines.
const uint8_t CUE::PIN_SNS_NORTH = 16;
const uint8_t CUE::PIN_SNS_OUT1 = 16;
const uint8_t CUE::PIN_SNS_SOUTH = 8;
const uint8_t CUE::PIN_SNS_OUT2 = 8;
ARIA::PIN_SNS_NORTH
triggers an interrupt when the sensor detects the north pole.
ARIA::PIN_SNS_SOUTH
also triggers an interrupt when the sensor detects the north pole.
Before entering sleep, configure the pins as follows:
pinMode(CUE::PIN_SNS_OUT1, PIN_MODE::WAKE_FALLING);
pinMode(CUE::PIN_SNS_OUT2, PIN_MODE::WAKE_FALLING);
On wake-up, check the cause using:
uint8_t b_north =
the_twelite.is_wokeup_by_dio(CUE::PIN_SNS_NORTH);
uint8_t b_south =
the_twelite.is_wokeup_by_dio(CUE::PIN_SNS_SOUTH);
LED
set_led()
void set_led(uint8_t mode, uint16_t tick)
Controls the LED (D1).
mode
accepts the following parameters. tick
specifies the lighting duration in milliseconds [ms]. Refer to the mode descriptions for details.
Value | Description |
---|---|
LED_TIMER::BLINK | Blinks the LED. Toggles ON/OFF at intervals specified by tick [ms]. After waking from sleep, the timer resets and starts in the ON state. |
LED_TIMER::ON_RX | Turns on the LED for the specified tick duration [ms] when a packet is received. |
LED_TIMER::ON_TX_COMP | Turns on the LED for the specified tick duration [ms] when transmission completes. |
led_one_shot()
void led_one_shot(uint16_t tick)
Turns on the LED for a specified duration. Cannot be used simultaneously with set_led()
.
Watchdog Timer
Resets the external watchdog timer at startup, upon waking from sleep, and after a certain time has elapsed post-startup.