Eliminate a couple more uses of printf() within the OS. There are several more.
This commit is contained in:
parent
de0ef2486f
commit
d1b31d536a
|
@ -1285,13 +1285,16 @@ void mfrc522_init(FAR struct mfrc522_dev_s *dev)
|
||||||
|
|
||||||
int mfrc522_selftest(FAR struct mfrc522_dev_s *dev)
|
int mfrc522_selftest(FAR struct mfrc522_dev_s *dev)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
|
||||||
uint8_t result[64];
|
|
||||||
uint8_t zeros[25] = {0, 0, 0, 0, 0,
|
uint8_t zeros[25] = {0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0};
|
0, 0, 0, 0, 0};
|
||||||
|
char outbuf[3 * 8 + 1]
|
||||||
|
uint8_t result[64];
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
|
||||||
/* Execute a software reset */
|
/* Execute a software reset */
|
||||||
|
|
||||||
|
@ -1347,14 +1350,15 @@ int mfrc522_selftest(FAR struct mfrc522_dev_s *dev)
|
||||||
mfrc522_writeu8(dev, MFRC522_AUTOTEST_REG, 0x00);
|
mfrc522_writeu8(dev, MFRC522_AUTOTEST_REG, 0x00);
|
||||||
|
|
||||||
mfrc522info("Self Test Result:\n");
|
mfrc522info("Self Test Result:\n");
|
||||||
for (i = 1; i <= 64; i++)
|
|
||||||
{
|
|
||||||
printf("0x%02X ", result[i - 1]);
|
|
||||||
|
|
||||||
if ((i % 8) == 0)
|
for (i = 0; i < 64; i += 8)
|
||||||
|
{
|
||||||
|
for (j = 0; k = 0; j < 8; j++, k += 3)
|
||||||
{
|
{
|
||||||
printf("\n");
|
(void)sprintf(&outbuf[k], " %02x", result[i + j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mfrc522info(" %02x:%s\n", i, outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
mfrc522info("Done!\n");
|
mfrc522info("Done!\n");
|
||||||
|
|
|
@ -3618,6 +3618,8 @@ retry:
|
||||||
ferr("ERROR: Program bug! Expected a free sector, free=%d\n", dev->freesectors);
|
ferr("ERROR: Program bug! Expected a free sector, free=%d\n", dev->freesectors);
|
||||||
for (x = 0; x < dev->neraseblocks; x++)
|
for (x = 0; x < dev->neraseblocks; x++)
|
||||||
{
|
{
|
||||||
|
/* REVISIT: Use of printf is not permitted within the OS */
|
||||||
|
|
||||||
printf("%d ", dev->freecount[x]);
|
printf("%d ", dev->freecount[x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -900,33 +900,42 @@ int cc1101_checkpart(struct cc1101_dev_s *dev)
|
||||||
* Description:
|
* Description:
|
||||||
* Dump the specified range of registers to the syslog.
|
* Dump the specified range of registers to the syslog.
|
||||||
*
|
*
|
||||||
* WARNING: Uses around 200 bytes of stack!
|
* WARNING: Uses around 75 bytes of stack!
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void cc1101_dumpregs(struct cc1101_dev_s *dev, uint8_t addr, uint8_t length)
|
void cc1101_dumpregs(struct cc1101_dev_s *dev, uint8_t addr, uint8_t length)
|
||||||
{
|
{
|
||||||
char outbuf[3 * 48];
|
char outbuf[3 * 16 + 1];
|
||||||
uint8_t regbuf[48];
|
uint8_t regbuf[16];
|
||||||
|
int readsize;
|
||||||
|
int remaining;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
DEBUGASSERT(length < 48);
|
for (remaining = length; remaining > 0; remaining -= 16, addr += 16)
|
||||||
|
|
||||||
/* Read the registers into a buffer */
|
|
||||||
|
|
||||||
cc1101_access(dev, addr, (FAR uint8_t *)regbuf, length);
|
|
||||||
|
|
||||||
/* Format the output data */
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < length; i++, j += 3)
|
|
||||||
{
|
{
|
||||||
(void)sprintf(&outbuf[j], "%02x ", regbuf[i]);
|
/* Read up to 16 registers into a buffer */
|
||||||
|
|
||||||
|
readsize = remaining;
|
||||||
|
if (readsize > 16)
|
||||||
|
{
|
||||||
|
readsize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
cc1101_access(dev, addr, (FAR uint8_t *)regbuf, readsize);
|
||||||
|
|
||||||
|
/* Format the output data */
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < readsize; i++, j += 3)
|
||||||
|
{
|
||||||
|
(void)sprintf(&outbuf[j], " %02x", regbuf[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dump the formatted data to the syslog output */
|
||||||
|
|
||||||
|
wlinfo("CC1101[%2x]:%s\n", addr, outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump the formatted data to the syslog output */
|
|
||||||
|
|
||||||
wlinfo("CC1101[%2x]: %s\n", addr, outbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
@ -1288,18 +1288,18 @@ static int at86rf23x_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||||
static int at86rf23x_regdump(FAR struct at86rf23x_dev_s *dev)
|
static int at86rf23x_regdump(FAR struct at86rf23x_dev_s *dev)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
char buf[4+16*3+2+1];
|
char buf[4 + 16 * 3 + 2 + 1];
|
||||||
int len=0;
|
int len=0;
|
||||||
|
|
||||||
printf("RF23X regs:\n");
|
wlinfo("RF23X regs:\n");
|
||||||
|
|
||||||
for (i=0;i<0x30;i++)
|
for (i = 0; i < 0x30; i++)
|
||||||
{
|
{
|
||||||
/* First row and every 15 regs */
|
/* First row and every 15 regs */
|
||||||
|
|
||||||
if ((i & 0x0f) == 0)
|
if ((i & 0x0f) == 0)
|
||||||
{
|
{
|
||||||
len = sprintf(buf, "%02x: ",i&0xFF);
|
len = sprintf(buf, "%02x: ", i & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the register value */
|
/* Print the register value */
|
||||||
|
@ -1310,10 +1310,10 @@ static int at86rf23x_regdump(FAR struct at86rf23x_dev_s *dev)
|
||||||
* debug message.
|
* debug message.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((i&15) == 15 || i == 0x2f)
|
if ((i & 15) == 15 || i == 0x2f)
|
||||||
{
|
{
|
||||||
sprintf(buf+len, "\n");
|
sprintf(buf + len, "\n");
|
||||||
printf("%s",buf);
|
wlinfo("%s" ,buf);q
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue