mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 08:22:04 +00:00
i2c: Fix -Wmissing-prototypes warnings
This commit is contained in:
parent
9dfa6e2732
commit
296b43744c
2 changed files with 11 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
/* Load hardware config for I2C4. */
|
|
||||||
void i2c_load_config(void) {
|
void i2c_load_config(void) {
|
||||||
/* Set MSTR_CONFIG_LOAD, TIMEOUT_CONFIG_LOAD, undocumented bit. */
|
/* Set MSTR_CONFIG_LOAD, TIMEOUT_CONFIG_LOAD, undocumented bit. */
|
||||||
I2C_I2C_CONFIG_LOAD_0 = 0x25;
|
I2C_I2C_CONFIG_LOAD_0 = 0x25;
|
||||||
|
@ -15,7 +14,6 @@ void i2c_load_config(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize I2C4. */
|
|
||||||
void i2c_init(void) {
|
void i2c_init(void) {
|
||||||
/* Setup divisor, and clear the bus. */
|
/* Setup divisor, and clear the bus. */
|
||||||
I2C_I2C_CLK_DIVISOR_REGISTER_0 = 0x50001;
|
I2C_I2C_CLK_DIVISOR_REGISTER_0 = 0x50001;
|
||||||
|
@ -40,7 +38,6 @@ void i2c_init(void) {
|
||||||
I2C_INTERRUPT_STATUS_REGISTER_0 = int_status;
|
I2C_INTERRUPT_STATUS_REGISTER_0 = int_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Writes a value to an i2c device. */
|
|
||||||
int i2c_write(unsigned int device, uint32_t val, unsigned int num_bytes) {
|
int i2c_write(unsigned int device, uint32_t val, unsigned int num_bytes) {
|
||||||
if (num_bytes > 4) {
|
if (num_bytes > 4) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -69,14 +66,12 @@ int i2c_write(unsigned int device, uint32_t val, unsigned int num_bytes) {
|
||||||
return (I2C_I2C_STATUS_0 & 7) == 0;
|
return (I2C_I2C_STATUS_0 & 7) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Writes a byte val to reg for given device. */
|
|
||||||
int i2c_send_byte_command(unsigned int device, unsigned char reg, unsigned char b) {
|
int i2c_send_byte_command(unsigned int device, unsigned char reg, unsigned char b) {
|
||||||
uint32_t val = (reg) | (b << 8);
|
uint32_t val = (reg) | (b << 8);
|
||||||
/* Write 1 byte (reg) + 1 byte (value) */
|
/* Write 1 byte (reg) + 1 byte (value) */
|
||||||
return i2c_write(device, val, 2);
|
return i2c_write(device, val, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually reset device 27. This might turn off the screen? */
|
|
||||||
int i2c_send_reset_cmd(void) {
|
int i2c_send_reset_cmd(void) {
|
||||||
/* Write 00 to Device 27 Reg 00. */
|
/* Write 00 to Device 27 Reg 00. */
|
||||||
return i2c_send_byte_command(27, 0, 0);
|
return i2c_send_byte_command(27, 0, 0);
|
||||||
|
|
|
@ -27,8 +27,19 @@
|
||||||
|
|
||||||
#define I2C_I2C_CONFIG_LOAD_0 MAKE_I2C_REG(0x08C)
|
#define I2C_I2C_CONFIG_LOAD_0 MAKE_I2C_REG(0x08C)
|
||||||
|
|
||||||
|
/* Initialize I2C4. */
|
||||||
void i2c_init(void);
|
void i2c_init(void);
|
||||||
|
|
||||||
|
/* Load hardware config for I2C4. */
|
||||||
|
void i2c_load_config(void);
|
||||||
|
|
||||||
|
/* Actually reset device 27. This might turn off the screen? */
|
||||||
int i2c_send_reset_cmd(void);
|
int i2c_send_reset_cmd(void);
|
||||||
|
|
||||||
|
/* Writes a value to an i2c device. */
|
||||||
|
int i2c_write(unsigned int device, uint32_t val, unsigned int num_bytes);
|
||||||
|
|
||||||
|
/* Writes a byte val to reg for given device. */
|
||||||
|
int i2c_send_byte_command(unsigned int device, unsigned char reg, unsigned char b);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue