MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / doExtensionDrcS

Function doExtensionDrcS

wiringPi/wpiExtensions.c:736–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734 */
735
736static int doExtensionDrcS (char *progName, int pinBase, char *params)
737{
738 char *port ;
739 int pins, baud ;
740
741 if ((params = extractInt (progName, params, &pins)) == NULL)
742 return false ;
743
744 if ((pins < 1) || (pins > 1000))
745 {
746 verbError ("%s: pins (%d) out of range (2-1000)", progName, pins) ;
747 return false ;
748 }
749
750 if ((params = extractStr (progName, params, &port)) == NULL)
751 return false ;
752
753 if (strlen (port) == 0)
754 {
755 verbError ("%s: serial port device name required", progName) ;
756 return false ;
757 }
758
759 if ((params = extractInt (progName, params, &baud)) == NULL)
760 return false ;
761
762 if ((baud < 1) || (baud > 4000000))
763 {
764 verbError ("%s: baud rate (%d) out of range", progName, baud) ;
765 return false ;
766 }
767
768 drcSetupSerial (pinBase, pins, port, baud) ;
769
770 return true ;
771}
772
773
774/*

Callers

nothing calls this directly

Calls 4

extractIntFunction · 0.85
verbErrorFunction · 0.85
extractStrFunction · 0.85
drcSetupSerialFunction · 0.85

Tested by

no test coverage detected