Use millis_t where needed (#12152)

This commit is contained in:
Ludy
2018-10-21 06:21:27 +02:00
committed by Scott Lahteine
parent b641571098
commit 44369d536a
6 changed files with 17 additions and 15 deletions

View File

@ -33,6 +33,8 @@
#include <lpc17xx_pinsel.h>
#include <lpc17xx_libcfg_default.h>
#include "../../../core/millis_t.h"
//////////////////////////////////////////////////////////////////////////////////////
// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
@ -149,13 +151,13 @@ void u8g_i2c_init(uint8_t clock_option) {
u8g_i2c_start(0); // send slave address and write bit
}
volatile extern uint32_t _millis;
volatile extern millis_t _millis;
uint8_t u8g_i2c_send_byte(uint8_t data) {
#define I2C_TIMEOUT 3
LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data
LPC_I2C1->I2CONSET = I2C_I2CONSET_AA;
LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC;
uint32_t timeout = _millis + I2C_TIMEOUT;
millis_t timeout = _millis + I2C_TIMEOUT;
while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && (timeout > _millis)); // wait for xmit to finish
// had hangs with SH1106 so added time out - have seen temporary screen corruption when this happens
return 1;