BV I2C: check dump8 input argument
This commit is contained in:
parent
7488ebd737
commit
a404e5ffc4
|
@ -461,7 +461,7 @@ static void busvoodoo_i2c_command_reset(void* argument)
|
||||||
(void)argument; // we won't use the argument
|
(void)argument; // we won't use the argument
|
||||||
if (!i2c_master_reset(BUSVOODOO_I2C)) { // reset the I2C peripheral since it might be stuck
|
if (!i2c_master_reset(BUSVOODOO_I2C)) { // reset the I2C peripheral since it might be stuck
|
||||||
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_WARNING);
|
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_WARNING);
|
||||||
printf("reset failed: check the SDA/SCL lines and retry");
|
printf("reset failed: check the SDA/SCL lines and retry\n");
|
||||||
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_RESET);
|
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_RESET);
|
||||||
} else {
|
} else {
|
||||||
i2c_master_setup(BUSVOODOO_I2C, busvoodoo_i2c_speed); // re-setup I2C
|
i2c_master_setup(BUSVOODOO_I2C, busvoodoo_i2c_speed); // re-setup I2C
|
||||||
|
@ -581,6 +581,13 @@ static void busvoodoo_i2c_command_scan(void* argument)
|
||||||
*/
|
*/
|
||||||
static void busvoodoo_i2c_command_dump8(void* argument)
|
static void busvoodoo_i2c_command_dump8(void* argument)
|
||||||
{
|
{
|
||||||
|
if (NULL == argument) {
|
||||||
|
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_WARNING);
|
||||||
|
printf("slave address needed\n");
|
||||||
|
busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_RESET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t address = *(uint32_t*)argument; // use argument as device address
|
uint16_t address = *(uint32_t*)argument; // use argument as device address
|
||||||
printf("reading bytes from 8-bit memory device at I2C address "); // display explanation
|
printf("reading bytes from 8-bit memory device at I2C address "); // display explanation
|
||||||
printf((busvoodoo_i2c_addressbits > 7) ? "%+03x\n" : "%+02x\n", address); // display address
|
printf((busvoodoo_i2c_addressbits > 7) ? "%+03x\n" : "%+02x\n", address); // display address
|
||||||
|
|
Loading…
Reference in New Issue