Compare commits

..

No commits in common. "ca814c5d13a6a233edbf86d195356d37a2ad17c2" and "1a4be828cf50456efb411858082c70e7ae62b66e" have entirely different histories.

14
i2c.c
View file

@ -95,7 +95,7 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
{
unsigned int what = (unsigned int)(par->par);
unsigned int a = -1;
unsigned int n = -1;
unsigned int n = 0;
unsigned int how = 0;
if (what & 2) {
how = alt_cmd_inj;
@ -103,19 +103,15 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
n = i2c_size;
}
error_msg_t e = parse_expression_square(cmd, &a, optional_empty | optional_close);
if (!e)
e = parse_expression_square(cmd, &n, optional_brackets | optional_open);
if (e)
return parser_error_message(cmd, e);
if (n < 0x10000) {
e = parse_expression_square(cmd, &n, optional_brackets | optional_open);
n <<= 16;
n |= 0x4000;
}
else
n=0;
if (a < 0x0100)
n = ((n & 0xffff0000) << 8) | (a << 16) | 0x4000;
n = (n<<8) | (a<<16) | 0x4000;
n |= i2c_register | what & 1;
if (!e)
n |= 0x4000;
switch (n & 0x4001) {
case 0x0001:
a = 0;