• Home
Name Date Size #Lines LOC

..--

button/12-May-2024-690409

devices/display/12-May-2024-16388

display/12-May-2024-501316

i2c/12-May-2024-196111

led/12-May-2024-518320

netdev/12-May-2024-517304

pwm/12-May-2024-15784

settings/12-May-2024-7035

spi/12-May-2024-15577

CMakeLists.txtD12-May-2024667 3126

README.mdD12-May-20242.1 KiB4533

README.md

1# lws meta-drivers
2
3Although drivers in lws (enabled in cmake by `LWS_WITH_DRIVERS`) provide
4actual drivers for some devices like I2C OLED controllers, their main job is
5to conceal from user code the underlying OS APIs being used to interface
6to the SoC hardware assets.
7
8CMake already allows lws to be platform-agnostic for build, the plat adaptations
9allow lws to be platform-agnostic within itself for runtime.  The lws
10drivers intend to extend that agnosticism to user code.
11
12Using this technique on supported OSes frees the user code from dependencies
13on the underlying OS choice... for example, although ESP32 is very good, it
14comes with a highly specific set of apis in esp-idf that mean your code is
15locked in to esp-idf if you follow them.  Esp-idf uses freertos apis for things
16like OS timers, again if you follow those you are locked into freertos, the
17end result is your work is non-portable to other platforms and completely
18dependent on esp.
19
20LWS drivers provide a thin wrapper to eliminate the OS dependencies while
21still taking advantage of the work, drivers and maintenance of the underlying
22OS layer without duplicating them, but bringing the flexibility to retarget
23your work to other scenarios... for example, there is a generic gpio object
24subclassed for specific implementations, an i2c object which may be subclassed
25to use OS drivers or bitbang using the generic gpio object, buttons on top of
26generic gpio, led class that can use generic gpio or pwm interchangeably,
27platform-specific gpio, i2c, pwm implementations that can be used at the generic
28level are defined to use underlying OS native apis and drivers.
29
30## Building on the next layer up
31
32At these generic objects like buttons or led controllers, there is a stable
33codebase used by multiple implementations and the intention is to provide
34best-of-breed features there generically, like
35
36 - sophisticated button press debounce and classification
37
38 - high quality transitions and log-response compensation and mixing for led pwm
39
40 - display dimming timers, blanking timers, generic interaction detection to unblank
41
42which are automatically available on top of any implementation that is ported to
43lws drivers.
44
45