Skip to content

Commit

Permalink
drivers/ft5x06: fix register addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Aug 14, 2023
1 parent 0df9480 commit a9f3ce1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
16 changes: 8 additions & 8 deletions drivers/ft5x06/ft5x06.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ int ft5x06_init(ft5x06_t *dev, const ft5x06_params_t *params, ft5x06_event_cb_t
return -EPROTO;
}

uint8_t expected_id;
if (dev->params.type == FT5X06_TYPE_FT6X06 || dev->params.type == FT5X06_TYPE_FT6X36) {
expected_id = FT6XX6_VENDOR_ID;
if ((vendor_id != FT5X06_VENDOR_ID_2) && (vendor_id != FT5X06_VENDOR_ID_3)) {
DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x or 0x%02x)\n",
vendor_id, FT5X06_VENDOR_ID_2, FT5X06_VENDOR_ID_3);
i2c_release(FT5X06_BUS);
return -ENODEV;
}
}
else {
expected_id = FT5X06_VENDOR_ID;
}

if (expected_id != vendor_id) {
else if (vendor_id != FT5X06_VENDOR_ID_1) {
DEBUG("[ft5x06] init: invalid vendor ID: '0x%02x' (expected: 0x%02x)\n",
vendor_id, expected_id);
vendor_id, FT5X06_VENDOR_ID_1);
i2c_release(FT5X06_BUS);
return -ENODEV;
}
Expand Down
19 changes: 12 additions & 7 deletions drivers/ft5x06/include/ft5x06_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ extern "C" {
#define FT5X06_I2C_DEFAULT_ADDRESS (0x38)

/**
* @brief Vendor ID for FT6X06 and FT6X36 models.
* @brief Vendor ID for FT5606, FT5X16, FT5X06I, FT5336, FT3316, FT5436I, FT5336I, FT5X46 models.
*/
#define FT6XX6_VENDOR_ID (0x11)
#define FT5X06_VENDOR_ID_1 (0x51)

/**
* @brief Vendor ID for FT5606, FT5X16, FT5X06I, FT5336, FT3316, FT5436I, FT5336I, FT5X46 models.
* @brief Vendor ID used for most FT6X06 and FT6X36 as well as FT3X67 models.
*/
#define FT5X06_VENDOR_ID_2 (0x11)

/**
* @brief Vendor ID used for some FT6X06 and FT6X36 models.
*/
#define FT5X06_VENDOR_ID (0x51)
#define FT5X06_VENDOR_ID_3 (0xcd)

/**
* @brief Maximum touches count for FT6X06 and FT6X36 models.
Expand Down Expand Up @@ -81,9 +86,9 @@ extern "C" {
#define FT5X06_TOUCH5_YH_REG (0x1D)
#define FT5X06_TOUCH5_YL_REG (0x1E)
#define FT5X06_G_AUTO_CLB_MODE_REG (0xA0)
#define FT5X06_G_CIPHER_REG (0xA1)
#define FT5X06_G_LIB_VERSION_H_REG (0xA2)
#define FT5X06_G_LIB_VERSION_L_REG (0xA3)
#define FT5X06_G_LIB_VERSION_H_REG (0xA1)
#define FT5X06_G_LIB_VERSION_L_REG (0xA2)
#define FT5X06_G_CIPHER_REG (0xA3)
#define FT5X06_G_MODE_REG (0xA4)
#define FT5X06_G_PMODE_REG (0xA5)
#define FT5X06_G_FIRMID_REG (0xA6)
Expand Down

0 comments on commit a9f3ce1

Please sign in to comment.