-- Define the IIC pins and initiaize the pin direction.
alias i2c_scl is pin_C0 -- Pin 10 for 14 pin DIP
-- alias pin_scl_direction is pin_C0_direction. Note: Not needed for this PIC.
alias i2c_sda is pin_C1 -- Pin 9 for 14 pin DIP.
-- alias pin_sda_direction is pin_C1_direction. Note: Not needed for this PIC.
const word _i2c_bus_speed = 4 -- 400 kHz.
const bit _i2c_level = TRUE -- i2c levels (not SMB)
const word I2C_HARDWARE_TIMEOUT = 10_000 -- At least 10 ms to prevent hang-up.
include i2c_hardware
i2c_initialize()
-- Now include the ina3221 library and initialize.
-- Remove the comment below if you want to use floats instead of word/dword.
--const INA3221_USE_FLOAT = TRUE
include ina3221
ina3221_init()