Re: ULP global variables
Posted: Tue Oct 10, 2017 9:16 pm
WiFive wrote:https://github.com/tomtor/ulp-i2c
In i2c.s, I found some macros, but anyone wont use label.macro I2C_delay
wait 10 // 38 // minimal 4.7us
.endm
.macro read_SCL // Return current level of SCL line, 0 or 1
READ_RTC_REG(RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT_S + 9, 1) // RTC_GPIO_9 == GPIO_32
.endm
.macro read_SDA // Return current level of SDA line, 0 or 1
READ_RTC_REG(RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT_S + 8, 1) // RTC_GPIO_8 == GPIO_33
.endm
.macro set_SCL // Do not drive SCL (set pin high-impedance)
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TC_REG, RTC_GPIO_ENABLE_W1TC_S + 9, 1, 1)
.endm
.macro clear_SCL // Actively drive SCL signal low
// Output mode
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TS_REG, RTC_GPIO_ENABLE_W1TS_S + 9, 1, 1)
.endm
.macro set_SDA // Do not drive SDA (set pin high-impedance)
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TC_REG, RTC_GPIO_ENABLE_W1TC_S + 8, 1, 1)
.endm
.macro clear_SDA // Actively drive SDA signal low
// Output mode
WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TS_REG, RTC_GPIO_ENABLE_W1TS_S + 8, 1, 1)
.endm