This README file describes iqs62x-h2bin, a lightweight Python 3 tool for converting a header file exported from an Azoteq ProxFusion configuration GUI to a binary file that can be parsed by the iqs62x-core Linux kernel driver. Applicable devices include the IQS620A, IQS621, IQS622, IQS624 and IQS625.
Each Azoteq ProxFusion device exposes dozens of registers that represent application-specific parameters such as channel assignment, detection thresholds and much more. Customers can configure these registers using Azoteq development tools which include a GUI offered for each device. To facilitate development, these GUIs offer a means to export all register settings as a C header file that represents register values as macros and arrays of constants.
This automatically generated header file can be included in a customer's source code, thereby replicating the customer's configuration in his or her custom application. While this workflow is suitable for small designs, it is not practical in an embedded Linux application where a device driver's source code must be agnostic to specific applications.
The iqs62x-h2bin tool solves this problem by converting the exported header file to a simple binary file that can be consumed by the iqs62x-core driver at runtime as if it were firmware. This method conveniently bundles all custom device configuration in a single package rather than relying on an unmanageably long list of device tree properties.
The iqs62x-h2bin tool is invoked as follows:
./iqs62x-h2bin [file_in] [file_out]
The file_in parameter is required and specifies the name of the header file exported from the GUI (e.g. IQS620A_Init.h). The optional file_out parameter specifies the name of the output file generated by iqs62x-h2bin. If this parameter is omitted, the output file is named according to the device (e.g. iqs620a.bin for IQS620A).
Files generated by iqs62x-h2bin comprise a series of binary records, each of which is composed of the following fields.
Type, Address, Length, Data[0], Data[1], ..., Data[N]
The following sections describe each field in detail.
The Type field is a single byte that indicates the type of record, as follows:
- 0: Informative text
- 1: Product number
- 2: Hall-effect sensor ATI calibration data
- 3: Read-modify-write
- 4: Bulk write
The Address field is a single byte that indicates the starting register address targeted by the record's contents. The iqs62x-core driver ignores this field for record types 0 and 1.
The Length field is a single byte that indicates the number of bytes in the subsequent Data field.
The contents of the Data field are a function of record type as detailed in the following sections.
The Data field is composed of arbitrary characters that are ignored by the iqs62x-core driver.
The Data field is a single byte equal to the target device's product number as found in register 0x00. The iqs62x-core driver checks this field against the product number returned by the device to ensure compatibility with the binary file.
The Data field is composed of all possible ATI calibration values calculated by the GUI for a pair of channels assigned to a Hall-effect sensor plate. The iqs62x-core driver selects the appropriate value based on device-specific calibration data stored in the device's OTP memory.
The first and second bytes of the Data field represent a bitmask and data value, respectively. Upon encountering a type 3 record, the iqs62x-core driver writes the second byte of the Data field to the register address targeted by the Address field. However, only the bits for which the first byte of the Data field are set will be modified.
All bytes in the Data field represent entire register values to be written to the device. Upon encountering a type 4 record, the iqs62x-core driver performs a bulk write of all values in the Data field starting at the register address targeted by the Address field.
See the LICENSE file for license rights and limitations (MIT).