Just set the i2c pins for tri-state mode

This commit is contained in:
Savanni D'Gerinel 2022-08-05 09:26:07 -04:00
parent 4a97284b49
commit cbb537b27d
2 changed files with 4 additions and 12 deletions

View File

@ -22,7 +22,6 @@ inline void set_sda(i2c_bus_t *bus) {
} }
inline void clear_sda(i2c_bus_t *bus) { inline void clear_sda(i2c_bus_t *bus) {
dio_set(&bus->sda, 0);
dio_set_direction(&bus->sda, LINE_OUT); dio_set_direction(&bus->sda, LINE_OUT);
} }
@ -35,7 +34,6 @@ inline void set_scl(i2c_bus_t *bus) {
} }
inline void clear_scl(i2c_bus_t *bus) { inline void clear_scl(i2c_bus_t *bus) {
dio_set(&bus->scl, 0);
dio_set_direction(&bus->scl, LINE_OUT); dio_set_direction(&bus->scl, LINE_OUT);
} }
@ -43,18 +41,13 @@ inline uint8_t read_scl(i2c_bus_t *bus) {
return dio_read(&bus->scl); return dio_read(&bus->scl);
} }
void i2c_init_host(i2c_bus_t *bus) { void i2c_init(i2c_bus_t *bus) {
dio_set(&bus->sda, 0);
dio_set(&bus->scl, 0);
set_sda(bus); set_sda(bus);
set_scl(bus); set_scl(bus);
} }
/*
void i2c_init_client(i2c_client_t *bus) {
set_sda(bus);
set_scl(bus);
}
*/
void i2c_start_condition(i2c_bus_t *bus, i2c_error_e *error) { void i2c_start_condition(i2c_bus_t *bus, i2c_error_e *error) {
if (*error != i2c_ok) return; if (*error != i2c_ok) return;

View File

@ -35,8 +35,7 @@ typedef struct {
} i2c_client_t; } i2c_client_t;
*/ */
void i2c_init_host(i2c_bus_t *); void i2c_init(i2c_bus_t *);
// void i2c_init_client(i2c_client_t *);
// void i2c_host_write(i2c_host_t *, uint8_t, uint8_t, size_t, i2c_error_e); // void i2c_host_write(i2c_host_t *, uint8_t, uint8_t, size_t, i2c_error_e);