PCA9632 - LED Driver
PCA9632 - LED Driver
LED driver used for NOTICE PAL.
The control on the NOTICE PAL is done via board(BRD) PAL_NOTICE.
Process flow
1.Wire.begin()
: Initialize bus 2 .setup()
: Initialize the class object .reset()
: Initialization of the driver 4. 4. various procedures
About PCA9632
This is a 4-channel LED driver.
Each channel can specify 4 states: off, all lights on, PWM on, and blinking.
Each channel can control illuminance (PWM) independently.
All chs designated as blinking have the same blinking pattern.
When blinking, illuminance can be controlled for each channel individually by PWM
Procedures required for operation
Wire bus
Before calling the setup()
method, Wire must be put into operation state by Wire.begin()
.
Procedures when returning from sleep mode
Keep the Wire bus in the operating state just before sleep (the Wire is automatically restored after sleep recovery).
Code Example
#include <SNS_PCA9632>
and declaration of SNS_PCA9632
class object is required.
Initialization & Reset
点灯
In the above example, LEDs 1 and 3 are turned on by PWM control.
Be careful of the current value consumed by the driver when lighting up.
Methods.
Constructor, setup()
Specify i2c_addr
in the constructor.
If you define a class object in a global declaration, the constructor will not be called, so call setup()
.
reset()
Initializes the device. \0x0} Writes {0x81, 0x35, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0B, 0x00}
starting with register address 0x0.
set_mode2()
Write a value to the MODE2 register.
set_power_mode()
Setting b_pow_on
to true
will cause normal operation, setting it to false
will cause sleep.
set_blink_cycle() set_blink_cycle_ms()
Determines the blinking (group PWM) period.
If u8var
is specified, the period is (u8var+1)/24
[s].
The u16ms
specifies the period in œms.
set_blink_duty()
Determines the duty ratio of blinking (group PWM). The lighting period is u8duty/256
, where 0 corresponds to lights off and 255 corresponds to all lights on.
set_led_duty()
brightness (duty ratio of PMW control).
port
specifies the target LED (SNS_PCA9632::LED1..4
).
... duty
specifies 0..255, and the LEDs are turned on with the ratio duty/256
.
set_led_duty_all()
Specify the brightness (duty ratio of PMW control) for all LEDs.
p1,p2,p3,p4
specifies 0...255 in duty for LED1...4. The LEDs turn on at a ratio duty/256
.
set_led_status()
Changes the lighting state of all LEDs.
u8led1..4
specifies the state of LED1..4 in order.
The states that can be specified are as follows.
Content | |
---|---|
| OFF |
| All lights on |
| Illumination control(PWM) |
| Blink control (group PWM) |
| Do not change state |
probe()
Returns true
if a device exists on the I2C bus.
show_registers()
Displays the value of register (0x0-0x8).
最終更新