BV I2C (minor): use hex prefix
This commit is contained in:
parent
93d3d3048e
commit
956188fdee
|
@ -165,7 +165,7 @@ static void busvoodoo_i2c_read(void)
|
|||
uint8_t data; // to store the data read
|
||||
switch (i2c_master_read(BUSVOODOO_I2C, &data, 1)) {
|
||||
case I2C_MASTER_RC_NONE: // all went fine
|
||||
printf("0x%02x", data); // show data
|
||||
printf("%+02x", data); // show data
|
||||
break;
|
||||
case I2C_MASTER_RC_NOT_MASTER:
|
||||
printf("slave not selected");
|
||||
|
@ -190,7 +190,7 @@ static void busvoodoo_i2c_read(void)
|
|||
*/
|
||||
static void busvoodoo_i2c_write(uint8_t data)
|
||||
{
|
||||
printf("write 0x%02x: ", data);
|
||||
printf("write %+02x: ", data);
|
||||
busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // pulse blue LED to show we send data
|
||||
switch (i2c_master_write(BUSVOODOO_I2C, &data, 1)) {
|
||||
case I2C_MASTER_RC_NONE: // all went fine
|
||||
|
@ -225,9 +225,9 @@ static void busvoodoo_i2c_select(uint16_t slave, bool write)
|
|||
{
|
||||
printf("select slave ");
|
||||
if (10 == busvoodoo_i2c_addressbits) {
|
||||
printf("0x%03x", slave);
|
||||
printf("%+03x", slave);
|
||||
} else {
|
||||
printf("0x%02x", slave);
|
||||
printf("%+02x", slave);
|
||||
}
|
||||
printf(" to %s: ", write ? "write" : "read");
|
||||
busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // pulse blue LED to show we send the slave address
|
||||
|
@ -472,7 +472,7 @@ static void busvoodoo_i2c_command_scan(void* argument)
|
|||
switch (i2c_master_select_slave(BUSVOODOO_I2C, address, 10 == busvoodoo_i2c_addressbits, false)) { // try to select slave (includes start condition)
|
||||
case I2C_MASTER_RC_NONE: // slave found
|
||||
busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // pulse blue LED to show we found a slave
|
||||
printf((busvoodoo_i2c_addressbits > 7) ? "0x%03x " : "0x%02x ", address); // display address
|
||||
printf((busvoodoo_i2c_addressbits > 7) ? "%+03x " : "%+02x ", address); // display address
|
||||
i2c_slaves++; // increase slave count
|
||||
break;
|
||||
case I2C_MASTER_RC_START_STOP_IN_PROGESS: // I2C peripheral error
|
||||
|
|
Loading…
Reference in New Issue