tca6424.h (1223B)
1 /** 2 * @file tca6424.h 3 * @author astro 4 * @brief driver for the tca6424 5 * 6 * Copyright 2020 astro <yuleiz@gmail.com> 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #pragma once 23 24 #include <stdint.h> 25 26 #ifndef TCA6424_ADDR 27 #define TCA6424_ADDR 0x44 28 #endif 29 30 typedef enum { 31 TCA6424_PORT0 = 0, 32 TCA6424_PORT1, 33 TCA6424_PORT2, 34 } TCA6424_PORT; 35 36 void tca6424_init(void); 37 38 void tca6424_write_config(TCA6424_PORT port, uint8_t data); 39 void tca6424_write_polarity(TCA6424_PORT port, uint8_t data); 40 41 void tca6424_write_port(TCA6424_PORT port, uint8_t data); 42 uint8_t tca6424_read_port(TCA6424_PORT port);