Skip to content

Commit 4b8f534

Browse files
author
Michael Graff
committed
adjust clock stretch
1 parent dece240 commit 4b8f534

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cores/esp8266/core_esp8266_si2c.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
si2c.c - Software I2C library for esp8266
33
44
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
55
This file is part of the esp8266 core for Arduino environment.
6-
6+
77
This library is free software; you can redistribute it and/or
88
modify it under the terms of the GNU Lesser General Public
99
License as published by the Free Software Foundation; either
@@ -26,20 +26,20 @@ unsigned char twi_dcount = 18;
2626
static unsigned char twi_sda, twi_scl;
2727

2828
#define SDA_LOW() (GPES = (1 << twi_sda)) //Enable SDA (becomes output and since GPO is 0 for the pin, it will pull the line low)
29-
#define SDA_HIGH() (GPEC = (1 << twi_sda)) //Disable SDA (becomes input and since it has pullup it will go high)
29+
#define SDA_HIGH() (GPEC = (1 << twi_sda)) //Disable SDA (becomes input and since it has pullup it will go high)
3030
#define SDA_READ() ((GPI & (1 << twi_sda)) != 0)
31-
#define SCL_LOW() (GPES = (1 << twi_scl))
32-
#define SCL_HIGH() (GPEC = (1 << twi_scl))
31+
#define SCL_LOW() (GPES = (1 << twi_scl))
32+
#define SCL_HIGH() (GPEC = (1 << twi_scl))
3333
#define SCL_READ() ((GPI & (1 << twi_scl)) != 0)
3434

3535
#ifndef FCPU80
3636
#define FCPU80 80000000L
3737
#endif
3838

3939
#if F_CPU == FCPU80
40-
#define TWI_CLOCK_STRETCH 200
40+
#define TWI_CLOCK_STRETCH 800
4141
#else
42-
#define TWI_CLOCK_STRETCH 400
42+
#define TWI_CLOCK_STRETCH 1600
4343
#endif
4444

4545
void twi_setClock(unsigned int freq){
@@ -99,7 +99,7 @@ static bool twi_write_stop(void){
9999
twi_delay(twi_dcount);
100100
SDA_HIGH();
101101
twi_delay(twi_dcount);
102-
102+
103103
return true;
104104
}
105105

0 commit comments

Comments
 (0)