maix.peripheral.light

maix.peripheral.light module

You can use maix.peripheral.light to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

Variable

Function

Class

Light

Fill light(补光灯) control class.\nThe light pin is read from the board config file(/boot/board or /boot/boards/board.)\nitem "cam_light_io", default is "B25" on MaixCAM2 and "B3" on MaixCAM.\nOn MaixCAM2 the light is driven by PWM so its brightness can be adjusted,\nthe PWM frequency and duty are read from the system config file(/boot/configs):\nmaix_light_freq: PWM frequency, unit Hz, default 10000\nmaix_light_duty: PWM duty, unit %, range [0, 100], default 50\nOn MaixCAM the light is driven by GPIO, only on/off is supported.

C++ defination code:

class Light

__init__

def __init__(self) -> None

Fill light constructor, will open the light hardware and turn it off by default.

item description
type func
throw err::Exception if open the light hardware failed.
static False

C++ defination code:

Light()

on

def on(self) -> maix.err.Err

Turn on the fill light.\nOn MaixCAM2 the PWM duty will be set to the configured duty(maix_light_duty),\non MaixCAM the GPIO will be set to high level.

item description
type func
return error code, err::ERR_NONE means success.
static False

C++ defination code:

err::Err on()

off

def off(self) -> maix.err.Err

Turn off the fill light.

item description
type func
return error code, err::ERR_NONE means success.
static False

C++ defination code:

err::Err off()

is_on

def is_on(self) -> bool

Get the fill light state.

item description
type func
return true if the light is on, else false.
static False

C++ defination code:

bool is_on()

set_duty

def set_duty(self, duty: float) -> maix.err.Err

Set the fill light brightness(PWM duty), only take effect at runtime,\nwill not modify the config file.\nOn MaixCAM only 0(off) and non-zero(on) are supported.

item description
type func
note If duty > 70, a warning will be printed, because long time high power
running may cause the LED to age quickly.
param duty: direction [in], PWM duty, unit %, range [0, 100]. 0 means turn off the light.
return error code, err::ERR_NONE means success.
static False

C++ defination code:

err::Err set_duty(double duty)

duty

def duty(self) -> float

Get the current fill light brightness(PWM duty).

item description
type func
return PWM duty, unit %, range [0, 100].
static False

C++ defination code:

double duty()

pin

def pin(self) -> str

Get the fill light pin name.

item description
type func
return pin name, e.g. "B25".
static False

C++ defination code:

std::string pin()

freq

def freq(self) -> int

Get the fill light PWM frequency.

item description
type func
return PWM frequency, unit Hz. Return 0 if the light is driven by GPIO.
static False

C++ defination code:

int freq()