I just checked in and created a pull request for turning OS Ticks printing
on/off.
?
Commands:
echo ? prompt ticks tasks mempools
date b
ticks on
248940:Ticks set to:
248940: Console Ticks on
prompt on
249600: Prompt now on.
249600: > ticks off
Console Ticks off
> prompt off
Prompt now off.
I also updated the prompt command to be able to turn it off, which apparently
you couldn't do before once it was on.
This can also be set in syscfg.yml as CONSOLE_TICKS 1 (or 0 to turn it off)
dg
> On Nov 9, 2016, at 7:34 PM, Kevin Townsend <[email protected]> wrote:
>
> I'll put this in a pull request with some of these helper test functions
> later, but I'm just starting to poke at a manufacturing test app that can be
> used to validate all the pins, etc.
>
> This will scan the entire I2C bus for devices, which is always a useful
> sanity check before working on drivers, following the Linux 'i2cdetect' model:
>
> static int
> shell_i2cscan_cmd(int argc, char **argv)
> {
> uint8_t addr;
> int32_t timeout = OS_TICKS_PER_SEC / 10
> uint8_t dev_count = 0;
>
> console_printf("Scanning I2C bus 0\n"
> " 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"
> "00: ");
>
> /* Scan all valid I2C addresses (0x03..0x77) */
> for (addr = 0x03; addr < 0x78; addr++) {
> int rc = hal_i2c_master_probe(0, addr, timeout);
> if (!(addr % 16)) {
> console_printf("\n%02x: ", addr);
> }
> if (!rc) {
> console_printf("%02x ", addr);
> dev_count++;
> } else {
> console_printf("-- ");
> }
> }
> console_printf("\nFound %u devices on I2C bus 0\n", dev_count);
>
> return 0;
> }
>
> This results in the following output on the shell:
>
> 5594:Scanning I2C bus 0
> 0 1 2 3 4 5 6 7 8 9 a b c d e f
> 00: -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1f
> 20: -- 21 -- -- -- -- -- -- -- 29 -- -- -- -- -- --
> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- 76 --
> Found 4 devices on I2C bus 0
>
> My question is ... is there a way to optionally suppress the tick counter on
> 'console_printf' calls for individual instances???
>
> It might get in the way of formatting output with multiple printf lines. I
> had to limit the number of times I used console_printf to avoid the tick
> counter messing the output up.
>
> K.
>
--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin
<http://linkedin.com/in/davidgsimmons> • Twitter
<http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
* http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
* Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!
There are only 2 hard things in computer science: Cache invalidation, naming
things, and off-by-one errors.