Skip to main content

ChipLib

Spend less time converting datasheets to code

From Datasheet

Datasheets are great for conveying all the information about a chip, but not so great for creating libraries.

To ChipLib

ChipLib specifies a language-agnostic format for describing the registers, fields, and enumerations for a chip.

To Your Favorite Language

Generate consistent, custom libraries in any language, according to any library format from the ChipLib file.

The Best Part?

Skip straight to generating the libraries you need by leveraging a collection of existing ChipLib files.

From Datasheet to Driver

Stop manually calculating bitmasks. Define your hardware in a human-readable YAML file, and let ChipLib generate production-ready, language-agnostic code.

Handle complex register maps, bit-fields, and enums with ease. Create libraries according to your specifications. See the example below for a ChipLib register definition and the corresponding automatically generated C++ code.

Input: TMP1075N.yaml
registers:
- address: 0x00
name: Temperature
symbol: TEMP
fields:
- name: Temperature
symbol: T
bits: [ 15, 4 ]
access: [ r ]
format:
representation: tc
unit: "Celsius"
Output: TMP1075N.cppm
/**
* @brief R | T | 12-bit, read-only register that stores the most recent temperature conversion results (Read)
* @returns std::expected<uint16_t, std::error_code> The read value, or error code on failure.
*/
[[nodiscard("Function returns expected which represents success or failure")]]
auto Temperature() -> std::expected<uint16_t, std::error_code> {
if (const auto read_result = this->Read(0x0); !read_result) [[unlikely]]
return std::unexpected(read_result.error());
else [[likely]]
this->temp_ = read_result.value();
return this->temp_ & 0xFFF0 >> 4;
}
Output: TMP1075N.py
# Register: Temperature
_temperature = ROBits(12, _TEMP, 4, 2, signed=True, lsb_first=False)

@property
def temperature(self):
"""12-bit, read-only register that stores the most recent temperature conversion results | Underlying units: Celsius"""
return self._temperature