diff --git a/lib/busvoodoo_onewire.c b/lib/busvoodoo_onewire.c index 140927a..869d074 100644 --- a/lib/busvoodoo_onewire.c +++ b/lib/busvoodoo_onewire.c @@ -65,8 +65,8 @@ static bool busvoodoo_onewire_setup(char** prefix, const char* line) switch (busvoodoo_onewire_setting) { case BUSVOODOO_ONEWIRE_SETTING_NONE: busvoodoo_onewire_setting = BUSVOODOO_ONEWIRE_SETTING_PULLUP; // go to first setting - printf("1) use embedded pull-up resistor (2kO)\n"); - printf("2) use external pull-up resistor\n"); + puts("1) use embedded pull-up resistor (2kO)\n"); + puts("2) use external pull-up resistor\n"); snprintf(busvoodoo_global_string, LENGTH(busvoodoo_global_string), "pull-up mode (1,2) [%c]", busvoodoo_onewire_embedded_pullup ? '1' : '2'); // show pull-up setting *prefix = busvoodoo_global_string; // display next setting break; @@ -81,8 +81,8 @@ static bool busvoodoo_onewire_setup(char** prefix, const char* line) } } if (BUSVOODOO_ONEWIRE_SETTING_POWER==busvoodoo_onewire_setting) { - printf("1) don't drive 1-wire data line (target uses external or parasitic power)\n"); - printf("2) power 1-wire data line at 3.3V when not communicating (not multi-master compatible)\n"); + puts("1) don't drive 1-wire data line (target uses external or parasitic power)\n"); + puts("2) power 1-wire data line at 3.3V when not communicating (not multi-master compatible)\n"); snprintf(busvoodoo_global_string, LENGTH(busvoodoo_global_string), "power source (1,2) [%c]", busvoodoo_onewire_power ? '2' : '1'); // show power setting *prefix = busvoodoo_global_string; // display next setting } @@ -107,7 +107,7 @@ static bool busvoodoo_onewire_setup(char** prefix, const char* line) if (!busvoodoo_onewire_power) { busvoodoo_embedded_pullup(true); // set embedded pull-ups } - printf("use LV to set pull-up voltage\n"); + puts("use LV to set pull-up voltage\n"); } busvoodoo_led_blue_off(); // disable blue LED because there is no activity busvoodoo_onewire_setting = BUSVOODOO_ONEWIRE_SETTING_NONE; // restart settings next time @@ -145,9 +145,9 @@ static void busvoodoo_onewire_write(uint8_t value) printf("write: 0x%02x", value); busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // pulse blue LED to show we are writing if (!onewire_master_write_byte(value)) { // send data bytes - printf(" (error)"); + puts(" (error)"); } - printf("\n"); + putc('\n'); } /** read from 1-wire @@ -200,7 +200,7 @@ static bool busvoodoo_onewire_action(const char* action, uint32_t repetition, bo //if (!gpio_get(GPIO(ONEWIRE_MASTER_PORT), GPIO(ONEWIRE_MASTER_PIN))) { // printf("WARNING: data line does not seem to be pulled up\n"); //} - printf("start transaction: "); + puts("start transaction: "); bool presence = onewire_master_reset(); // send reset pulse and detect slave presence printf("slave presence %sdetected\n", presence ? "" : "not "); } else if (1 == length && ']' == action[0]) { // stop transaction @@ -302,16 +302,16 @@ static bool busvoodoo_onewire_action(const char* action, uint32_t repetition, bo static void busvoodoo_onewire_command_actions(void* argument) { if (NULL == argument || 0 == strlen(argument)) { - printf("available actions (separated by space or ,):\n"); - printf("[\tstart transaction: send reset pulse and detect slave presence\n"); + puts("available actions (separated by space or ,):\n"); + puts("[\tstart transaction: send reset pulse and detect slave presence\n"); printf("]\tend transaction%s\n", busvoodoo_onewire_power ? " and provide power on data line" : ""); - printf("0\twrite decimal byte\n"); - printf("0x0\twrite hexadecimal byte\n"); - printf("0b0\twrite binary byte\n"); - printf("\"a\"/'a'\twrite ASCII characters\n"); - printf("r\tread byte\n"); - printf("u/m\twait 1 us/ms\n"); - printf(":n\trepeat action n times\n"); + puts("0\twrite decimal byte\n"); + puts("0x0\twrite hexadecimal byte\n"); + puts("0b0\twrite binary byte\n"); + puts("\"a\"/'a'\twrite ASCII characters\n"); + puts("r\tread byte\n"); + puts("u/m\twait 1 us/ms\n"); + puts(":n\trepeat action n times\n"); return; } // copy argument since it will be modified @@ -322,7 +322,7 @@ static void busvoodoo_onewire_command_actions(void* argument) strncpy(copy, argument, strlen(argument)+1); // verify and perform actions if (!busvoodoo_global_actions(copy, false, &busvoodoo_onewire_action)) { // verify actions - printf("malformed action(s)\n"); + puts("malformed action(s)\n"); } else { // action are OK busvoodoo_global_actions(argument, true, &busvoodoo_onewire_action); // perform action }