Automated datasheet processing and embedded code generation
ML Datasheet Processing
HAL Definition
Driver Generation
Test datasheet.pdf
The pdf datasheet was uploaded and processed to intermediate representation, a machine readable variation
#ifndef _VEML7700_H
#define _VEML7700_H
#include <I2CDevice.h>
#define I2C_ADDR 0x10
#define GAIN_1 0x00
#define GAIN_2 0x01
#define GAIN_1_8 0x02
#define GAIN_1_4 0x03
#define IT_100MS 0x00
#define IT_200MS 0x01
#define IT_400MS 0x02
#define IT_800MS 0x03
#define IT_50MS 0x08
#define IT_25MS 0x0C
#define POWERSAVE_MODE1 0x00
#define POWERSAVE_MODE2 0x01
#define POWERSAVE_MODE3 0x02
#define POWERSAVE_MODE4 0x03
#define ALS_CONFIG 0x00
#define ALS_THREHOLD_HIGH 0x01
#define ALS_THREHOLD_LOW 0x02
#define ALS_POWER_SAVE 0x03
#define ALS_DATA 0x04
#define WHITE_DATA 0x05
#define INTERRUPTSTATUS 0x06
#define INTERRUPT_HIGH 0x4000
#define INTERRUPT_LOW 0x8000
static err_t i2c_read_reg
(i2c_handle_t dev, uint8_t reg_addr, uint16_t *reg_data);
static err_t i2c_write_reg
(i2c_handle_t dev, uint8_t reg_addr, uint16_t reg_data);
static err_t i2c_read_reg(i2c_handle_t dev, uint8_t reg_addr, uint16_t *reg_data)
{
err_t resultCode;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev->addr << 1) | I2C_MASTER_WRITE, true);
i2c_master_write_byte(cmd, reg_addr, true);
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev->addr << 1) | I2C_MASTER_READ, true);
uint8_t read_data[2];
i2c_master_read(cmd, read_data, 2, I2C_MASTER_LAST_NACK);
i2c_master_stop(cmd);
resultCode = i2c_master_cmd_begin(dev->i2c_master_num, cmd, 2000 / portTICK_PERIOD_MS);
*reg_data = read_data[0] | (read_data[1]<<8);
i2c_cmd_link_delete(cmd);
return resultCode;
}
static err_t i2c_write_reg(i2c_handle_t dev, uint8_t reg_addr, uint16_t reg_data)
{
err_t resultCode;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev->addr << 1) | I2C_MASTER_WRITE, false);
i2c_master_write_byte(cmd, reg_addr, false);
uint8_t write_data[2];
write_data[0] = reg_data&0xff;
write_data[1] = (reg_data>>8)&0xff;
i2c_master_write(cmd, write_data, 2, false);
i2c_master_stop(cmd);
resultCode = i2c_master_cmd_begin(dev->i2c_master_num, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
return resultCode;
}
Create drivers in minutes with custom project settings
Our code generation technology provides accurate and high reliable code
Capability to extract not only tables and functions but also charts and calibration graphs
Freedom and flexibility to generate drivers for multitude of system configurations and applications
Wearables
Industrial Electronics
Wireless communication
Automotive
Medical devices
Consumer Electronics
Computing and data storage
IoT
Enter your details and we will contact you shortly