Add disable function to I2C driver
This commit is contained in:
parent
5a431482bf
commit
3dde89971c
2 changed files with 9 additions and 0 deletions
|
@ -183,6 +183,14 @@ i2c_enable(void) {
|
||||||
I2C_PxOUT |= (I2C_SDA | I2C_SCL); // Select pull-up resistors
|
I2C_PxOUT |= (I2C_SDA | I2C_SCL); // Select pull-up resistors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
i2c_disable(void) {
|
||||||
|
I2C_PxSEL &= ~(I2C_SDA | I2C_SCL); // GPIO function selected
|
||||||
|
I2C_PxSEL2 &= ~(I2C_SDA | I2C_SCL); // GPIO function selected
|
||||||
|
I2C_PxREN &= ~(I2C_SDA | I2C_SCL); // Deactivate internal pull-up/-down resistors
|
||||||
|
I2C_PxOUT &= ~(I2C_SDA | I2C_SCL); // Select pull-up resistors
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// void i2c_transmit_n(unsigned char byte_ctr, unsigned char *field)
|
// void i2c_transmit_n(unsigned char byte_ctr, unsigned char *field)
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
|
||||||
void i2c_enable(void);
|
void i2c_enable(void);
|
||||||
|
void i2c_disable(void);
|
||||||
|
|
||||||
void i2c_receiveinit(uint8_t slave_address);
|
void i2c_receiveinit(uint8_t slave_address);
|
||||||
uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf);
|
uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf);
|
||||||
|
|
Loading…
Reference in a new issue