1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+ #
4+ # Copyright (c) 2025, Henrik Hose
5+ #
6+ # This file is part of the modm project.
7+ #
8+ # This Source Code Form is subject to the terms of the Mozilla Public
9+ # License, v. 2.0. If a copy of the MPL was not distributed with this
10+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11+ # -----------------------------------------------------------------------------
12+
13+ class Vl53l5cx (Module ):
14+ def init (self , module ):
15+ module .name = "vl53l5cx"
16+ module .description = "Driver for ST VL53L5CX Multi-Zone Time-of-Flight Sensor"
17+
18+ def prepare (self , module , options ):
19+ module .add_option (
20+ BooleanOption (
21+ name = "examples" ,
22+ description = "" ,
23+ default = False
24+ )
25+ )
26+ return True
27+
28+ def build (self , env ):
29+ env .outbasepath = "modm/ext"
30+ env .copy ("vl53/vl53l5cx/src" )
31+ env .copy ("vl53/vl53l5cx/inc" )
32+ env .copy ("vl53/vl53l5cx/LICENSE.txt" )
33+ if env [":vl53:vl53l5cx:examples" ]:
34+ env .copy ("vl53/vl53l5cx/examples" )
35+ env .collect (":build:path.include" , "modm/ext/vl53/" )
36+ env .collect (":build:path.include" , "modm/ext/vl53/vl53l5cx/inc" )
37+
38+ class Vl53lmz (Module ):
39+ def init (self , module ):
40+ module .name = "vl53lmz"
41+ module .description = "Driver for ST VL53L7 and VL53L8 Multi-Zone Time-of-Flight Sensors"
42+
43+ def prepare (self , module , options ):
44+ module .add_option (
45+ BooleanOption (
46+ name = "examples" ,
47+ description = "" ,
48+ default = False
49+ )
50+ )
51+ return True
52+
53+ def build (self , env ):
54+ env .outbasepath = "modm/ext"
55+ env .copy ("vl53/vl53lmz/src" )
56+ env .copy ("vl53/vl53lmz/inc" )
57+ env .copy ("vl53/vl53lmz/LICENSE.txt" )
58+ if env [":vl53:vl53lmz:examples" ]:
59+ env .copy ("vl53/vl53lmz/examples" )
60+ env .collect (":build:path.include" , "modm/ext/vl53/" )
61+ env .collect (":build:path.include" , "modm/ext/vl53/vl53lmz/inc" )
62+
63+ def init (module ):
64+ module .name = ":vl53"
65+ module .description = """\
66+ # ST's VL53 Time-of-Flight ULD Drivers
67+
68+ Currently supported sensors:
69+ - With VL53LMZ driver: VL53L7CX, VL53L7CH, VL53L8CX, VL53L8CH
70+ - VL53L5CX driver
71+
72+ """
73+
74+ def prepare (module , options ):
75+ module .add_submodule (Vl53l5cx ())
76+ module .add_submodule (Vl53lmz ())
77+ module .depends (":architecture:spi.device" )
78+ module .depends (":architecture:i2c.device" )
79+ return True
80+
81+ def build (env ):
82+ env .outbasepath = "modm/ext/vl53"
83+ env .copy ("vl53.hpp" )
84+ env .copy ("vl53_transport.hpp" )
85+ env .copy ("vl53_transport_impl.hpp" )
86+ env .copy ("vl53_platform.h" )
0 commit comments