+// Update USB current (mA)
+// Triggers power change event
+void Output_update_usb_current( unsigned int current )
+{
+ // Only signal if changed
+ if ( current == Output_USBCurrent_Available )
+ return;
+
+ // Update USB current
+ Output_USBCurrent_Available = current;
+
+ unsigned int total_current = Output_current_available();
+ info_msg("USB Available Current Changed. Total Available: ");
+ printInt32( total_current );
+ print(" mA" NL);
+
+ // Send new total current to the Scan Modules
+ Scan_currentChange( Output_current_available() );
+}
+
+
+// Update external current (mA)
+// Triggers power change event
+void Output_update_external_current( unsigned int current )
+{
+ // Only signal if changed
+ if ( current == Output_ExtCurrent_Available )
+ return;
+
+ // Update external current
+ Output_ExtCurrent_Available = current;
+
+ unsigned int total_current = Output_current_available();
+ info_msg("External Available Current Changed. Total Available: ");
+ printInt32( total_current );
+ print(" mA" NL);
+
+ // Send new total current to the Scan Modules
+ Scan_currentChange( Output_current_available() );
+}
+
+
+// Power/Current Available
+unsigned int Output_current_available()
+{
+ unsigned int total_current = 0;
+
+ // Check for USB current source
+ total_current += Output_USBCurrent_Available;
+
+ // Check for external current source
+ total_current += Output_ExtCurrent_Available;
+
+ // XXX If the total available current is still 0
+ // Set to 100 mA, which is generally a safe assumption at startup
+ // before we've been able to determine actual available current
+ if ( total_current == 0 )
+ {
+ total_current = 100;
+ }
+
+ return total_current;
+}
+
+
+