Use explicitly sized types from stdint
Replace bare int types with stdint types. This was done with: grep -rwl 'int' src/ | xargs sed -i 's/\<int\>/int16_t/g' grep -rwl 'unsigned long' src/ | xargs sed -i 's/\<unsigned long\>/uint32_t/g' grep -rwl 'unsigned char' src/ | xargs sed -i 's/\<unsigned char\>/uint8_t/g' Then reverted for *main(), putchar(), and getchar(). The Arduino declarations for parallel_main() were also corrected to match their definitions. SDCC does *not* generate the same code in all instances, due to `int` being treated different than `short int`. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
38b2a628f9
commit
99af8a35f5
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <common/i2c.h>
|
||||
|
||||
int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant {
|
||||
int res = 0;
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, true);
|
||||
if (res < 0) return res;
|
||||
@@ -16,8 +16,8 @@ int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentr
|
||||
return res;
|
||||
}
|
||||
|
||||
int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant {
|
||||
int res = 0;
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
if (res < 0) return res;
|
||||
@@ -30,8 +30,8 @@ int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentr
|
||||
return res;
|
||||
}
|
||||
|
||||
int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant {
|
||||
int res = 0;
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
if (res < 0) return res;
|
||||
@@ -42,8 +42,8 @@ int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int leng
|
||||
return i2c_recv(i2c, addr, data, length);
|
||||
}
|
||||
|
||||
int i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant {
|
||||
int res = 0;
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
if (res < 0) return res;
|
||||
|
@@ -16,7 +16,7 @@ struct I2C;
|
||||
|
||||
// Start i2c transaction
|
||||
// Must be defined by arch, board, or ec
|
||||
int i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant;
|
||||
int16_t i2c_start(struct I2C * i2c, uint8_t addr, bool read) __reentrant;
|
||||
|
||||
// Stop i2c transaction
|
||||
// Must be defined by arch, board, or ec
|
||||
@@ -24,22 +24,22 @@ void i2c_stop(struct I2C * i2c) __reentrant;
|
||||
|
||||
// Send a byte on i2c bus
|
||||
// Must be defined by arch, board, or ec
|
||||
int i2c_write(struct I2C * i2c, uint8_t * data, int length) __reentrant;
|
||||
int16_t i2c_write(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant;
|
||||
|
||||
// Read bytes from bus
|
||||
// Must be defined by arch, board, or ec
|
||||
int i2c_read(struct I2C * i2c, uint8_t * data, int length) __reentrant;
|
||||
int16_t i2c_read(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant;
|
||||
|
||||
// Read multiple bytes from address in one transaction
|
||||
int i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant;
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant;
|
||||
|
||||
// Write multiple bytes to address in one transaction
|
||||
int i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int length) __reentrant;
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant;
|
||||
|
||||
// Read multiple bytes from a register in one transaction
|
||||
int i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant;
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant;
|
||||
|
||||
// Write multiple bytes to a register in one transaction
|
||||
int i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int length) __reentrant;
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant;
|
||||
|
||||
#endif // _COMMON_I2C_H
|
||||
|
@@ -27,9 +27,9 @@
|
||||
// Save dynamic keymap to flash
|
||||
bool keymap_save_config(void);
|
||||
// Get a keycode from the dynamic keymap
|
||||
bool keymap_get(int layer, int output, int input, uint16_t * value);
|
||||
bool keymap_get(int16_t layer, int16_t output, int16_t input, uint16_t * value);
|
||||
// Set a keycode in the dynamic keymap
|
||||
bool keymap_set(int layer, int output, int input, uint16_t value);
|
||||
bool keymap_set(int16_t layer, int16_t output, int16_t input, uint16_t value);
|
||||
#endif
|
||||
|
||||
// Translate a keycode from PS/2 set 2 to PS/2 set 1
|
||||
|
Reference in New Issue
Block a user