board/main/pca9555.c

33 lines
774 B
C
Raw Normal View History

2023-03-04 16:24:35 +08:00
#include <stdio.h>
#include <stdlib.h>
#include "driver/i2c.h"
#include "embedded_display.c"
#include "esp_log.h"
#include "i2c.c"
#define PCA_9555_TAG "PCA9555"
// Register of command byte
#define PCA95555_CMD_INPUT_PORT_0 0x00
#define PCA95555_CMD_INPUT_PORT_1 0x01
#define PCA95555_CMD_OUTPUT_PORT_0 0x02
#define PCA95555_CMD_OUTPUT_PORT_1 0x03
#define PCA95555_CMD_POLARITY_INVERSION_PORT_0 0x04
#define PCA95555_CMD_POLARITY_INVERSION_PORT_1 0x05
#define PCA95555_CMD_CONFIGURATION_PORT_0 0x06
#define PCA95555_CMD_CONFIGURATION_PORT_1 0x07
void pca9555_init() {
if (is_pca9555_online == 0) {
ESP_LOGE(PCA_9555_TAG, "salve offline");
return;
}
ESP_LOGI(PCA_9555_TAG, "Initializing PCA9555");
// esp_log_level_set(PCA_9555_TAG, ESP_LOG_ERROR);
}