/      日本語

<CUE>

For TWELITE CUE
This board behavior supports peripherals on the TWELITE CUE.

Provides access to the onboard accelerometer, magnetic sensor, and LED.

  • Accelerometer
  • Magnetic Sensor
  • LED
void setup() {
  auto&& brd = the_twelite.board.use<CUE>();
}

Accelerometer

The member object (sns_MC3630) of the MC3630 sensor is defined.

Magnetic Sensor

The sensor used in the Door Sensor PAL is a magnetic sensor, with two interrupt input lines only.

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;

CUE::PIN_SNS_NORTH triggers an interrupt when the north pole is detected; CUE::PIN_SNS_SOUTH also triggers on north pole detection.

Configure the following before entering sleep:

pinMode(CUE::PIN_SNS_OUT1, PIN_MODE::WAKE_FALLING);
pinMode(CUE::PIN_SNS_OUT2, PIN_MODE::WAKE_FALLING);

On wake-up, check which GPIO triggered the event:

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 LED (D1).

mode takes the following parameters. tick specifies the lighting duration [ms]; see the explanation of mode for details.

ValueDescription
LED_TIMER::BLINKBlinks the LED. Toggles ON/OFF every tick milliseconds. Resets counter after sleep and starts ON.
LED_TIMER::ON_RXTurns on LED for tick milliseconds upon packet reception.
LED_TIMER::ON_TX_COMPTurns on LED for tick milliseconds when transmission completes.

led_one_shot()

void led_one_shot(uint16_t tick)

Turns on LED for a specified duration. Cannot be used simultaneously with set_led().

Watchdog Timer

Resets the external watchdog timer at startup, after waking from sleep, and after a certain time post-start.