Compare commits
3 commits
1a4be828cf
...
ca814c5d13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca814c5d13 | ||
|
|
bae32f9710 | ||
|
|
0cb890f34b |
1 changed files with 10 additions and 6 deletions
18
i2c.c
18
i2c.c
|
|
@ -95,7 +95,7 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
|
||||||
{
|
{
|
||||||
unsigned int what = (unsigned int)(par->par);
|
unsigned int what = (unsigned int)(par->par);
|
||||||
unsigned int a = -1;
|
unsigned int a = -1;
|
||||||
unsigned int n = 0;
|
unsigned int n = -1;
|
||||||
unsigned int how = 0;
|
unsigned int how = 0;
|
||||||
if (what & 2) {
|
if (what & 2) {
|
||||||
how = alt_cmd_inj;
|
how = alt_cmd_inj;
|
||||||
|
|
@ -103,15 +103,19 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
|
||||||
n = i2c_size;
|
n = i2c_size;
|
||||||
}
|
}
|
||||||
error_msg_t e = parse_expression_square(cmd, &a, optional_empty | optional_close);
|
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)
|
if (e)
|
||||||
return parser_error_message(cmd, e);
|
return parser_error_message(cmd, e);
|
||||||
e = parse_expression_square(cmd, &n, optional_brackets | optional_open);
|
if (n < 0x10000) {
|
||||||
n <<= 16;
|
n <<= 16;
|
||||||
if (a < 0x0100)
|
|
||||||
n = (n<<8) | (a<<16) | 0x4000;
|
|
||||||
n |= i2c_register | what & 1;
|
|
||||||
if (!e)
|
|
||||||
n |= 0x4000;
|
n |= 0x4000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
n=0;
|
||||||
|
if (a < 0x0100)
|
||||||
|
n = ((n & 0xffff0000) << 8) | (a << 16) | 0x4000;
|
||||||
|
n |= i2c_register | what & 1;
|
||||||
switch (n & 0x4001) {
|
switch (n & 0x4001) {
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
a = 0;
|
a = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue