<PAL_NOTICE>

&lt;PAL_NOTICE&gt;

Board BEHAVIOR for NOTICE PAL.

In addition to common definition plus the ability to handle sensors on the board.

  • LED driver PCA9632

  • Accelerometer MC3630

void setup() {
  auto&& brd = the_twelite.board.use<PAL_NOTICE>();
}

member object

sns_PCA9632

[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.

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 %}

sns_MC3630

MC3630 sensor object. The board definition includes SPI initialization, MC3630 device initialization, and MC3630 interrupt processing. Various processes are handled by sns_MC3630.

PCA9632-definition

Lighting Status

Definition
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

LED identification sub

Definition
Meaning

PAL_NOTICE::LED_R

LED Red

PAL_NOTICE::LED_G

LED Green

PAL_NOTICE::LED_B

LED Green

PAL_NOTICE::LED_W

LED White

Register Setting Definition

Definition
Meaning

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

PCA9632-operating method

Master Switch

NOTICE PAL has a FET switch at the rear of the PCA9632 output. The LED will not light unless this switch is turned ON.

Change of lighting status

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.

Light illumination control

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.

Blinking Control

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()setsxto 0..1000 and blinks forcycle*x/1000` as the lighting period.

Test lighting

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

最終更新