Specializes for Pi
This commit is contained in:
451
.idea/dbnavigator.xml
generated
Normal file
451
.idea/dbnavigator.xml
generated
Normal file
@@ -0,0 +1,451 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DBNavigator.Project.DataEditorManager">
|
||||||
|
<record-view-column-sorting-type value="BY_INDEX" />
|
||||||
|
<value-preview-text-wrapping value="true" />
|
||||||
|
<value-preview-pinned value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.DataExportManager">
|
||||||
|
<export-instructions>
|
||||||
|
<create-header value="true" />
|
||||||
|
<quote-values-containing-separator value="true" />
|
||||||
|
<quote-all-values value="false" />
|
||||||
|
<value-separator value="" />
|
||||||
|
<file-name value="" />
|
||||||
|
<file-location value="" />
|
||||||
|
<scope value="GLOBAL" />
|
||||||
|
<destination value="FILE" />
|
||||||
|
<format value="EXCEL" />
|
||||||
|
<charset value="UTF-8" />
|
||||||
|
</export-instructions>
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.DatabaseBrowserManager">
|
||||||
|
<autoscroll-to-editor value="false" />
|
||||||
|
<autoscroll-from-editor value="true" />
|
||||||
|
<show-object-properties value="true" />
|
||||||
|
<loaded-nodes />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.EditorStateManager">
|
||||||
|
<last-used-providers />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.MethodExecutionManager">
|
||||||
|
<method-browser />
|
||||||
|
<execution-history>
|
||||||
|
<group-entries value="true" />
|
||||||
|
<execution-inputs />
|
||||||
|
</execution-history>
|
||||||
|
<argument-values-cache />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.ObjectDependencyManager">
|
||||||
|
<last-used-dependency-type value="INCOMING" />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.ObjectQuickFilterManager">
|
||||||
|
<last-used-operator value="EQUAL" />
|
||||||
|
<filters />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
|
||||||
|
<recently-used-interfaces />
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.Settings">
|
||||||
|
<connections />
|
||||||
|
<browser-settings>
|
||||||
|
<general>
|
||||||
|
<display-mode value="TABBED" />
|
||||||
|
<navigation-history-size value="100" />
|
||||||
|
<show-object-details value="false" />
|
||||||
|
</general>
|
||||||
|
<filters>
|
||||||
|
<object-type-filter>
|
||||||
|
<object-type name="SCHEMA" enabled="true" />
|
||||||
|
<object-type name="USER" enabled="true" />
|
||||||
|
<object-type name="ROLE" enabled="true" />
|
||||||
|
<object-type name="PRIVILEGE" enabled="true" />
|
||||||
|
<object-type name="CHARSET" enabled="true" />
|
||||||
|
<object-type name="TABLE" enabled="true" />
|
||||||
|
<object-type name="VIEW" enabled="true" />
|
||||||
|
<object-type name="MATERIALIZED_VIEW" enabled="true" />
|
||||||
|
<object-type name="NESTED_TABLE" enabled="true" />
|
||||||
|
<object-type name="COLUMN" enabled="true" />
|
||||||
|
<object-type name="INDEX" enabled="true" />
|
||||||
|
<object-type name="CONSTRAINT" enabled="true" />
|
||||||
|
<object-type name="DATASET_TRIGGER" enabled="true" />
|
||||||
|
<object-type name="DATABASE_TRIGGER" enabled="true" />
|
||||||
|
<object-type name="SYNONYM" enabled="true" />
|
||||||
|
<object-type name="SEQUENCE" enabled="true" />
|
||||||
|
<object-type name="PROCEDURE" enabled="true" />
|
||||||
|
<object-type name="FUNCTION" enabled="true" />
|
||||||
|
<object-type name="PACKAGE" enabled="true" />
|
||||||
|
<object-type name="TYPE" enabled="true" />
|
||||||
|
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
|
||||||
|
<object-type name="ARGUMENT" enabled="true" />
|
||||||
|
<object-type name="DIMENSION" enabled="true" />
|
||||||
|
<object-type name="CLUSTER" enabled="true" />
|
||||||
|
<object-type name="DBLINK" enabled="true" />
|
||||||
|
</object-type-filter>
|
||||||
|
</filters>
|
||||||
|
<sorting>
|
||||||
|
<object-type name="COLUMN" sorting-type="NAME" />
|
||||||
|
<object-type name="FUNCTION" sorting-type="NAME" />
|
||||||
|
<object-type name="PROCEDURE" sorting-type="NAME" />
|
||||||
|
<object-type name="ARGUMENT" sorting-type="POSITION" />
|
||||||
|
</sorting>
|
||||||
|
<default-editors>
|
||||||
|
<object-type name="VIEW" editor-type="SELECTION" />
|
||||||
|
<object-type name="PACKAGE" editor-type="SELECTION" />
|
||||||
|
<object-type name="TYPE" editor-type="SELECTION" />
|
||||||
|
</default-editors>
|
||||||
|
</browser-settings>
|
||||||
|
<navigation-settings>
|
||||||
|
<lookup-filters>
|
||||||
|
<lookup-objects>
|
||||||
|
<object-type name="SCHEMA" enabled="true" />
|
||||||
|
<object-type name="USER" enabled="false" />
|
||||||
|
<object-type name="ROLE" enabled="false" />
|
||||||
|
<object-type name="PRIVILEGE" enabled="false" />
|
||||||
|
<object-type name="CHARSET" enabled="false" />
|
||||||
|
<object-type name="TABLE" enabled="true" />
|
||||||
|
<object-type name="VIEW" enabled="true" />
|
||||||
|
<object-type name="MATERIALIZED VIEW" enabled="true" />
|
||||||
|
<object-type name="NESTED TABLE" enabled="false" />
|
||||||
|
<object-type name="COLUMN" enabled="false" />
|
||||||
|
<object-type name="INDEX" enabled="true" />
|
||||||
|
<object-type name="CONSTRAINT" enabled="true" />
|
||||||
|
<object-type name="DATASET TRIGGER" enabled="true" />
|
||||||
|
<object-type name="DATABASE TRIGGER" enabled="true" />
|
||||||
|
<object-type name="SYNONYM" enabled="false" />
|
||||||
|
<object-type name="SEQUENCE" enabled="true" />
|
||||||
|
<object-type name="PROCEDURE" enabled="true" />
|
||||||
|
<object-type name="FUNCTION" enabled="true" />
|
||||||
|
<object-type name="PACKAGE" enabled="true" />
|
||||||
|
<object-type name="TYPE" enabled="true" />
|
||||||
|
<object-type name="TYPE ATTRIBUTE" enabled="false" />
|
||||||
|
<object-type name="ARGUMENT" enabled="false" />
|
||||||
|
<object-type name="DIMENSION" enabled="false" />
|
||||||
|
<object-type name="CLUSTER" enabled="false" />
|
||||||
|
<object-type name="DBLINK" enabled="true" />
|
||||||
|
</lookup-objects>
|
||||||
|
<force-database-load value="false" />
|
||||||
|
<prompt-connection-selection value="true" />
|
||||||
|
<prompt-schema-selection value="true" />
|
||||||
|
</lookup-filters>
|
||||||
|
</navigation-settings>
|
||||||
|
<dataset-grid-settings>
|
||||||
|
<general>
|
||||||
|
<enable-zooming value="true" />
|
||||||
|
</general>
|
||||||
|
<sorting>
|
||||||
|
<nulls-first value="true" />
|
||||||
|
<max-sorting-columns value="4" />
|
||||||
|
</sorting>
|
||||||
|
<tracking-columns>
|
||||||
|
<columnNames value="" />
|
||||||
|
<visible value="true" />
|
||||||
|
<editable value="false" />
|
||||||
|
</tracking-columns>
|
||||||
|
</dataset-grid-settings>
|
||||||
|
<dataset-editor-settings>
|
||||||
|
<text-editor-popup>
|
||||||
|
<active value="false" />
|
||||||
|
<active-if-empty value="false" />
|
||||||
|
<data-length-threshold value="100" />
|
||||||
|
<popup-delay value="1000" />
|
||||||
|
</text-editor-popup>
|
||||||
|
<values-list-popup>
|
||||||
|
<show-popup-button value="true" />
|
||||||
|
<element-count-threshold value="1000" />
|
||||||
|
<data-length-threshold value="250" />
|
||||||
|
</values-list-popup>
|
||||||
|
<general>
|
||||||
|
<fetch-block-size value="100" />
|
||||||
|
<fetch-timeout value="30" />
|
||||||
|
<trim-whitespaces value="true" />
|
||||||
|
<convert-empty-strings-to-null value="true" />
|
||||||
|
<select-content-on-cell-edit value="true" />
|
||||||
|
<large-value-preview-active value="true" />
|
||||||
|
</general>
|
||||||
|
<filters>
|
||||||
|
<prompt-filter-dialog value="true" />
|
||||||
|
<default-filter-type value="BASIC" />
|
||||||
|
</filters>
|
||||||
|
<qualified-text-editor text-length-threshold="300">
|
||||||
|
<content-types>
|
||||||
|
<content-type name="Text" enabled="true" />
|
||||||
|
<content-type name="Properties" enabled="true" />
|
||||||
|
<content-type name="XML" enabled="true" />
|
||||||
|
<content-type name="DTD" enabled="true" />
|
||||||
|
<content-type name="HTML" enabled="true" />
|
||||||
|
<content-type name="XHTML" enabled="true" />
|
||||||
|
<content-type name="Java" enabled="true" />
|
||||||
|
<content-type name="SQL" enabled="true" />
|
||||||
|
<content-type name="PL/SQL" enabled="true" />
|
||||||
|
<content-type name="Groovy" enabled="true" />
|
||||||
|
<content-type name="AIDL" enabled="true" />
|
||||||
|
<content-type name="YAML" enabled="true" />
|
||||||
|
<content-type name="Bash" enabled="true" />
|
||||||
|
<content-type name="Manifest" enabled="true" />
|
||||||
|
</content-types>
|
||||||
|
</qualified-text-editor>
|
||||||
|
<record-navigation>
|
||||||
|
<navigation-target value="VIEWER" />
|
||||||
|
</record-navigation>
|
||||||
|
</dataset-editor-settings>
|
||||||
|
<code-editor-settings>
|
||||||
|
<general>
|
||||||
|
<show-object-navigation-gutter value="false" />
|
||||||
|
<show-spec-declaration-navigation-gutter value="true" />
|
||||||
|
</general>
|
||||||
|
<confirmations>
|
||||||
|
<save-changes value="false" />
|
||||||
|
<revert-changes value="true" />
|
||||||
|
</confirmations>
|
||||||
|
</code-editor-settings>
|
||||||
|
<code-completion-settings>
|
||||||
|
<filters>
|
||||||
|
<basic-filter>
|
||||||
|
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="function" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="schema" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="role" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="user" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="privilege" selected="true" />
|
||||||
|
<user-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="true" />
|
||||||
|
</user-schema>
|
||||||
|
<public-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="false" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="false" />
|
||||||
|
</public-schema>
|
||||||
|
<any-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="true" />
|
||||||
|
</any-schema>
|
||||||
|
</basic-filter>
|
||||||
|
<extended-filter>
|
||||||
|
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="function" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
|
||||||
|
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="schema" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="user" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="role" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="privilege" selected="true" />
|
||||||
|
<user-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="true" />
|
||||||
|
</user-schema>
|
||||||
|
<public-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="true" />
|
||||||
|
</public-schema>
|
||||||
|
<any-schema>
|
||||||
|
<filter-element type="OBJECT" id="table" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="materialized view" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="index" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="constraint" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="trigger" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="synonym" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="sequence" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="procedure" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="function" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="package" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="type" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dimension" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="cluster" selected="true" />
|
||||||
|
<filter-element type="OBJECT" id="dblink" selected="true" />
|
||||||
|
</any-schema>
|
||||||
|
</extended-filter>
|
||||||
|
</filters>
|
||||||
|
<sorting enabled="true">
|
||||||
|
<sorting-element type="RESERVED_WORD" id="keyword" />
|
||||||
|
<sorting-element type="RESERVED_WORD" id="datatype" />
|
||||||
|
<sorting-element type="OBJECT" id="column" />
|
||||||
|
<sorting-element type="OBJECT" id="table" />
|
||||||
|
<sorting-element type="OBJECT" id="view" />
|
||||||
|
<sorting-element type="OBJECT" id="materialized view" />
|
||||||
|
<sorting-element type="OBJECT" id="index" />
|
||||||
|
<sorting-element type="OBJECT" id="constraint" />
|
||||||
|
<sorting-element type="OBJECT" id="trigger" />
|
||||||
|
<sorting-element type="OBJECT" id="synonym" />
|
||||||
|
<sorting-element type="OBJECT" id="sequence" />
|
||||||
|
<sorting-element type="OBJECT" id="procedure" />
|
||||||
|
<sorting-element type="OBJECT" id="function" />
|
||||||
|
<sorting-element type="OBJECT" id="package" />
|
||||||
|
<sorting-element type="OBJECT" id="type" />
|
||||||
|
<sorting-element type="OBJECT" id="dimension" />
|
||||||
|
<sorting-element type="OBJECT" id="cluster" />
|
||||||
|
<sorting-element type="OBJECT" id="dblink" />
|
||||||
|
<sorting-element type="OBJECT" id="schema" />
|
||||||
|
<sorting-element type="OBJECT" id="role" />
|
||||||
|
<sorting-element type="OBJECT" id="user" />
|
||||||
|
<sorting-element type="RESERVED_WORD" id="function" />
|
||||||
|
<sorting-element type="RESERVED_WORD" id="parameter" />
|
||||||
|
</sorting>
|
||||||
|
<format>
|
||||||
|
<enforce-code-style-case value="true" />
|
||||||
|
</format>
|
||||||
|
</code-completion-settings>
|
||||||
|
<execution-engine-settings>
|
||||||
|
<statement-execution>
|
||||||
|
<fetch-block-size value="100" />
|
||||||
|
<execution-timeout value="20" />
|
||||||
|
<debug-execution-timeout value="600" />
|
||||||
|
<focus-result value="false" />
|
||||||
|
<prompt-execution value="false" />
|
||||||
|
</statement-execution>
|
||||||
|
<script-execution>
|
||||||
|
<command-line-interfaces />
|
||||||
|
<execution-timeout value="300" />
|
||||||
|
</script-execution>
|
||||||
|
<method-execution>
|
||||||
|
<execution-timeout value="30" />
|
||||||
|
<debug-execution-timeout value="600" />
|
||||||
|
<parameter-history-size value="10" />
|
||||||
|
</method-execution>
|
||||||
|
</execution-engine-settings>
|
||||||
|
<operation-settings>
|
||||||
|
<transactions>
|
||||||
|
<uncommitted-changes>
|
||||||
|
<on-project-close value="ASK" />
|
||||||
|
<on-disconnect value="ASK" />
|
||||||
|
<on-autocommit-toggle value="ASK" />
|
||||||
|
</uncommitted-changes>
|
||||||
|
<multiple-uncommitted-changes>
|
||||||
|
<on-commit value="ASK" />
|
||||||
|
<on-rollback value="ASK" />
|
||||||
|
</multiple-uncommitted-changes>
|
||||||
|
</transactions>
|
||||||
|
<session-browser>
|
||||||
|
<disconnect-session value="ASK" />
|
||||||
|
<kill-session value="ASK" />
|
||||||
|
<reload-on-filter-change value="false" />
|
||||||
|
</session-browser>
|
||||||
|
<compiler>
|
||||||
|
<compile-type value="KEEP" />
|
||||||
|
<compile-dependencies value="ASK" />
|
||||||
|
<always-show-controls value="false" />
|
||||||
|
</compiler>
|
||||||
|
<debugger>
|
||||||
|
<debugger-type value="ASK" />
|
||||||
|
<use-generic-runners value="true" />
|
||||||
|
</debugger>
|
||||||
|
</operation-settings>
|
||||||
|
<ddl-file-settings>
|
||||||
|
<extensions>
|
||||||
|
<mapping file-type-id="VIEW" extensions="vw" />
|
||||||
|
<mapping file-type-id="TRIGGER" extensions="trg" />
|
||||||
|
<mapping file-type-id="PROCEDURE" extensions="prc" />
|
||||||
|
<mapping file-type-id="FUNCTION" extensions="fnc" />
|
||||||
|
<mapping file-type-id="PACKAGE" extensions="pkg" />
|
||||||
|
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
|
||||||
|
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
|
||||||
|
<mapping file-type-id="TYPE" extensions="tpe" />
|
||||||
|
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
|
||||||
|
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
|
||||||
|
</extensions>
|
||||||
|
<general>
|
||||||
|
<lookup-ddl-files value="true" />
|
||||||
|
<create-ddl-files value="false" />
|
||||||
|
<synchronize-ddl-files value="true" />
|
||||||
|
<use-qualified-names value="false" />
|
||||||
|
<make-scripts-rerunnable value="true" />
|
||||||
|
</general>
|
||||||
|
</ddl-file-settings>
|
||||||
|
<general-settings>
|
||||||
|
<regional-settings>
|
||||||
|
<date-format value="MEDIUM" />
|
||||||
|
<number-format value="UNGROUPED" />
|
||||||
|
<locale value="SYSTEM_DEFAULT" />
|
||||||
|
<use-custom-formats value="false" />
|
||||||
|
</regional-settings>
|
||||||
|
<environment>
|
||||||
|
<environment-types>
|
||||||
|
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
|
||||||
|
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
|
||||||
|
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
|
||||||
|
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
|
||||||
|
</environment-types>
|
||||||
|
<visibility-settings>
|
||||||
|
<connection-tabs value="true" />
|
||||||
|
<dialog-headers value="true" />
|
||||||
|
<object-editor-tabs value="true" />
|
||||||
|
<script-editor-tabs value="false" />
|
||||||
|
<execution-result-tabs value="true" />
|
||||||
|
</visibility-settings>
|
||||||
|
</environment>
|
||||||
|
</general-settings>
|
||||||
|
</component>
|
||||||
|
<component name="DBNavigator.Project.StatementExecutionManager">
|
||||||
|
<execution-variables />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
3
.idea/modules/IOBoard.iml
generated
3
.idea/modules/IOBoard.iml
generated
@@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="IOBoard" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="IOBoard" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="com.henrypump" external.system.module.version="0.1" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$/../..">
|
<content url="file://$MODULE_DIR$/../..">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/../../out" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|||||||
4
.idea/modules/IOBoard_main.iml
generated
4
.idea/modules/IOBoard_main.iml
generated
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="IOBoard:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="IOBoard:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="com.henrypump" external.system.module.type="sourceSet" external.system.module.version="0.1" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
<output url="file://$MODULE_DIR$/../../out/production/classes" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$/../../src/main">
|
<content url="file://$MODULE_DIR$/../../src/main">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
||||||
|
|||||||
6
.idea/modules/IOBoard_test.iml
generated
6
.idea/modules/IOBoard_test.iml
generated
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="IOBoard:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="IOBoard:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="com.henrypump" external.system.module.type="sourceSet" external.system.module.version="0.1" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$/../../src/test">
|
<content url="file://$MODULE_DIR$/../../src/test">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
<orderEntry type="library" name="Gradle: org.apache.commons:commons-math3:3.6.1" level="project" />
|
<orderEntry type="library" name="Gradle: org.apache.commons:commons-math3:3.6.1" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: io.mraa:mraa:1.5.1" level="project" />
|
<orderEntry type="library" name="Gradle: io.mraa:mraa:1.5.1" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.pi4j:pi4j-core:1.1" level="project" />
|
<orderEntry type="library" name="Gradle: com.pi4j:pi4j-core:1.1" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: junit:junit:4.12" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: com.google.guava:guava:21.0" level="project" />
|
<orderEntry type="library" name="Gradle: com.google.guava:guava:21.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
|
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestModuleProperties" production-module="IOBoard_main" />
|
<component name="TestModuleProperties" production-module="IOBoard_main" />
|
||||||
|
|||||||
992
.idea/workspace.xml
generated
992
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,9 @@
|
|||||||
// Apply the java-library plugin to add support for Java Library
|
// Apply the java-library plugin to add support for Java Library
|
||||||
apply plugin: 'java-library'
|
apply plugin: 'java-library'
|
||||||
|
|
||||||
|
group = "com.henrypump"
|
||||||
|
version = '0.1'
|
||||||
|
|
||||||
// In this section you declare where to find the dependencies of your project
|
// In this section you declare where to find the dependencies of your project
|
||||||
repositories {
|
repositories {
|
||||||
// Use jcenter for resolving your dependencies.
|
// Use jcenter for resolving your dependencies.
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.henrypump.io;
|
package com.henrypump.io;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,102 +10,148 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class AnalogIn {
|
public class AnalogIn {
|
||||||
|
|
||||||
public int channel;
|
private int channel;
|
||||||
public int rawValue;
|
private int rawValue;
|
||||||
public double lastValue;
|
private double lastValue;
|
||||||
public double rawMax, rawMin, euMax, euMin;
|
private Instant lastStored = Instant.EPOCH;
|
||||||
public List<Integer> channelMux;
|
private double rawMax, rawMin, euMax, euMin;
|
||||||
|
private List<Integer> channelMux;
|
||||||
|
private double m, b;
|
||||||
private double[] history = new double[100];
|
private double[] history = new double[100];
|
||||||
|
private long badReads = 0;
|
||||||
|
|
||||||
AnalogIn(int channel, double rawMin, double rawMax, double euMin, double euMax) {
|
public AnalogIn(int channel, double rawMin, double rawMax, double euMin, double euMax) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.channelMux = MuxSetup.muxValues.get(channel);
|
if (channel != 99) {
|
||||||
|
this.channelMux = MuxSetup.muxValues.get(channel);
|
||||||
|
}
|
||||||
this.rawMax = rawMax;
|
this.rawMax = rawMax;
|
||||||
this.rawMin = rawMin;
|
this.rawMin = rawMin;
|
||||||
this.euMax = euMax;
|
this.euMax = euMax;
|
||||||
this.euMin = euMin;
|
this.euMin = euMin;
|
||||||
|
|
||||||
|
m = (euMax - euMin) / (rawMax - rawMin);
|
||||||
|
b = euMax - m * (rawMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
double getHistory(int pointIndex) {
|
public int getChannel() {
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRawMax() {
|
||||||
|
return rawMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRawMin() {
|
||||||
|
return rawMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getEuMax() {
|
||||||
|
return euMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getEuMin() {
|
||||||
|
return euMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBadReads() {
|
||||||
|
return badReads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRawValue() {
|
||||||
|
return rawValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastValue() {
|
||||||
|
return lastValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getLastStored() {
|
||||||
|
return lastStored;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getHistory(int pointIndex) {
|
||||||
return history[pointIndex];
|
return history[pointIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
double setValue(int value) {
|
double setValue(int value) {
|
||||||
|
// System.out.println(value);
|
||||||
this.rawValue = value;
|
this.rawValue = value;
|
||||||
double pv = ((euMax - euMin)/(rawMax - rawMin)) * rawValue + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax);
|
double pv = m * rawValue + b;
|
||||||
|
lastValue = pv;
|
||||||
|
lastStored = Instant.now();
|
||||||
|
System.arraycopy(history, 0, history,1, history.length - 1);
|
||||||
|
history[0] = lastValue;
|
||||||
|
// System.out.println(value + " --> " + pv);
|
||||||
|
return pv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double read(MuxSetup mux){
|
||||||
|
mux.set(channelMux.get(0), channelMux.get(1), channelMux.get(2));
|
||||||
|
int rawIn = mux.readAnalog();
|
||||||
|
if (rawIn != -1){
|
||||||
|
badReads = 0;
|
||||||
|
return setValue(rawIn);
|
||||||
|
} else {
|
||||||
|
badReads++;
|
||||||
|
try {
|
||||||
|
Thread.sleep(5);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lastValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double readSim(double simRaw){
|
||||||
|
double pv = ((euMax - euMin)/(rawMax - rawMin)) * simRaw + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax);
|
||||||
lastValue = pv;
|
lastValue = pv;
|
||||||
System.arraycopy(history, 0, history,1, history.length - 1);
|
System.arraycopy(history, 0, history,1, history.length - 1);
|
||||||
history[0] = lastValue;
|
history[0] = lastValue;
|
||||||
return pv;
|
return pv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Long> getStatus(){
|
||||||
|
HashMap<String, Long> status;
|
||||||
|
status = new HashMap<String, Long>();
|
||||||
|
|
||||||
|
status.put("badReads", badReads);
|
||||||
|
status.put("measurementAge", Duration.between(lastStored, Instant.now()).toMillis());
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MuxSetup mux = new MuxSetup();
|
MuxSetup mux = null;
|
||||||
|
Instant now = Instant.now();
|
||||||
|
mux = new MuxSetup();
|
||||||
|
HashMap<String, Long> aI1status;
|
||||||
|
// HashMap<String, Long> aI2status;
|
||||||
|
|
||||||
System.out.println("Testing Analog Inputs");
|
System.out.println("Testing Analog Inputs");
|
||||||
int rawIn;
|
|
||||||
|
|
||||||
|
AnalogIn aI1 = new AnalogIn(1, 32560, 65535, 0, 100);
|
||||||
|
// AnalogIn aI2 = new AnalogIn(2, 0, 65535, 0, 50000);
|
||||||
|
// AnalogIn aI3 = new AnalogIn(3, 0, 65535, 0, 100);
|
||||||
|
// AnalogIn aI4 = new AnalogIn(4, 0, 65535, 0, 100);
|
||||||
|
|
||||||
AnalogIn aI1 = new AnalogIn(1, 0, 65535, 0, 10);
|
for (int i = 0; i < 500; i++) {
|
||||||
AnalogIn aI2 = new AnalogIn(2, 0, 65535, 0, 10);
|
|
||||||
AnalogIn aI3 = new AnalogIn(3, 0, 65535, 0, 10);
|
|
||||||
AnalogIn aI4 = new AnalogIn(4, 0, 65535, 0, 10);
|
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
double a1Val = aI1.read(mux);
|
||||||
mux.set(aI1.channelMux.get(0), aI1.channelMux.get(1), aI1.channelMux.get(2));
|
// double a2Val = aI2.read(mux);
|
||||||
rawIn = mux.readAnalog();
|
aI1status = aI1.getStatus();
|
||||||
if (rawIn != -1) {
|
// aI2status = aI2.getStatus();
|
||||||
aI1.setValue(mux.readAnalog());
|
System.out.println("Input " + aI1.channel + ": " + aI1.lastValue + ", age= " + aI1status.get("measurementAge") + "ms" + ", badReads= " + aI1status.get("badReads"));
|
||||||
System.out.println("Input " + aI1.channel + ": " + aI1.lastValue);
|
// System.out.println("Input " + aI2.channel + ": " + aI2.lastValue + ", age= " + aI2status.get("measurementAge") + "ms" + ", badReads= " + aI2status.get("badReads"));
|
||||||
} else {
|
// System.out.println("Input " + aI3.channel + ": " + aI3.lastValue + ", age= " + Duration.between(aI3.lastStored, now).toMillis() + "ms");
|
||||||
try {
|
// System.out.println("Input " + aI4.channel + ": " + aI4.lastValue + ", age= " + Duration.between(aI4.lastStored, now).toMillis() + "ms");
|
||||||
Thread.sleep(25);
|
// System.out.println("--");
|
||||||
} catch (InterruptedException e) {
|
// System.out.printf("%s,%s%n", aI1.lastValue, aI2.lastValue);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mux.set(aI2.channelMux.get(0), aI2.channelMux.get(1), aI2.channelMux.get(2));
|
|
||||||
|
|
||||||
rawIn = mux.readAnalog();
|
|
||||||
if (rawIn != -1) {
|
|
||||||
aI2.setValue(mux.readAnalog());
|
|
||||||
System.out.println("Input " + aI2.channel + ": " + aI2.lastValue);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(25);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mux.set(aI3.channelMux.get(0), aI3.channelMux.get(1), aI3.channelMux.get(2));
|
|
||||||
rawIn = mux.readAnalog();
|
|
||||||
if (rawIn != -1) {
|
|
||||||
aI3.setValue(mux.readAnalog());
|
|
||||||
System.out.println("Input " + aI3.channel + ": " + aI3.lastValue);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(25);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mux.set(aI4.channelMux.get(0), aI4.channelMux.get(1), aI4.channelMux.get(2));
|
|
||||||
rawIn = mux.readAnalog();
|
|
||||||
if (rawIn != -1) {
|
|
||||||
aI4.setValue(mux.readAnalog());
|
|
||||||
System.out.println("Input " + aI4.channel + ": " + aI4.lastValue);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(25);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// for (int j = 0; j < 100; j++){
|
||||||
|
// System.out.println("History[" + j + "]= " + aI3.getHistory(j));
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
package com.henrypump.io;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by patrickjmcd on 6/21/17.
|
|
||||||
*/
|
|
||||||
public class AnalogInPi {
|
|
||||||
public int channel;
|
|
||||||
public int rawValue;
|
|
||||||
public double lastValue;
|
|
||||||
public Instant lastStored = Instant.EPOCH;
|
|
||||||
public double rawMax, rawMin, euMax, euMin;
|
|
||||||
public List<Integer> channelMux;
|
|
||||||
private double[] history = new double[100];
|
|
||||||
|
|
||||||
AnalogInPi(int channel, double rawMin, double rawMax, double euMin, double euMax) {
|
|
||||||
this.channel = channel;
|
|
||||||
this.channelMux = MuxSetupPi.muxValues.get(channel);
|
|
||||||
this.rawMax = rawMax;
|
|
||||||
this.rawMin = rawMin;
|
|
||||||
this.euMax = euMax;
|
|
||||||
this.euMin = euMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
double getHistory(int pointIndex) {
|
|
||||||
return history[pointIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
double setValue(int value) {
|
|
||||||
// System.out.println(value);
|
|
||||||
this.rawValue = value;
|
|
||||||
double pv = ((euMax - euMin)/(rawMax - rawMin)) * rawValue + (euMax - ((euMax - euMin)/(rawMax - rawMin)) * rawMax);
|
|
||||||
lastValue = pv;
|
|
||||||
lastStored = Instant.now();
|
|
||||||
System.arraycopy(history, 0, history,1, history.length - 1);
|
|
||||||
history[0] = lastValue;
|
|
||||||
// System.out.println(value + " --> " + pv);
|
|
||||||
return pv;
|
|
||||||
}
|
|
||||||
|
|
||||||
double read(MuxSetupPi mux) throws IOException {
|
|
||||||
mux.set(channelMux.get(0), channelMux.get(1), channelMux.get(2));
|
|
||||||
int rawIn = mux.readAnalog();
|
|
||||||
if (rawIn != -1){
|
|
||||||
return setValue(rawIn);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return lastValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
MuxSetupPi mux = null;
|
|
||||||
Instant now = Instant.now();
|
|
||||||
try {
|
|
||||||
mux = new MuxSetupPi();
|
|
||||||
|
|
||||||
System.out.println("Testing Analog Inputs");
|
|
||||||
|
|
||||||
AnalogInPi aI1 = new AnalogInPi(1, 0, 65535, 0, 100);
|
|
||||||
AnalogInPi aI2 = new AnalogInPi(2, 0, 65535, 0, 100);
|
|
||||||
AnalogInPi aI3 = new AnalogInPi(3, 0, 65535, 0, 100);
|
|
||||||
// AnalogInPi aI4 = new AnalogInPi(4, 0, 65535, 0, 100);
|
|
||||||
|
|
||||||
for (int i = 0; i < 50; i++) {
|
|
||||||
|
|
||||||
double a1Val = aI1.read(mux);
|
|
||||||
double a2Val = aI2.read(mux);
|
|
||||||
double a3Val = aI3.read(mux);
|
|
||||||
// double a4Val = aI4.read(mux);
|
|
||||||
now = Instant.now();
|
|
||||||
System.out.println("Input " + aI1.channel + ": " + aI1.lastValue + ", age= " + Duration.between(aI1.lastStored, now).toMillis() + "ms");
|
|
||||||
System.out.println("Input " + aI2.channel + ": " + aI2.lastValue + ", age= " + Duration.between(aI2.lastStored, now).toMillis() + "ms");
|
|
||||||
System.out.println("Input " + aI3.channel + ": " + aI3.lastValue + ", age= " + Duration.between(aI3.lastStored, now).toMillis() + "ms");
|
|
||||||
// System.out.println("Input " + aI4.channel + ": " + aI4.lastValue + ", age= " + Duration.between(aI4.lastStored, now).toMillis() + "ms");
|
|
||||||
System.out.println("--");
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -3,27 +3,58 @@ package com.henrypump.io;
|
|||||||
import mraa.Dir;
|
import mraa.Dir;
|
||||||
import mraa.Gpio;
|
import mraa.Gpio;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by patrickjmcd on 6/19/17.
|
* Created by patrickjmcd on 6/19/17.
|
||||||
*/
|
*/
|
||||||
public class AnalogOut {
|
public class AnalogOut {
|
||||||
public int channel;
|
public int channel;
|
||||||
Gpio triggerPin;
|
public int rawValue;
|
||||||
|
public double lastValue;
|
||||||
|
public Instant lastStored = Instant.EPOCH;
|
||||||
|
public double rawMax, rawMin, euMax, euMin;
|
||||||
|
private double m, b;
|
||||||
|
|
||||||
AnalogOut(int channel){
|
|
||||||
|
public AnalogOut(int channel, double rawMin, double rawMax, double euMin, double euMax){
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
triggerPin = new Gpio(6);
|
this.rawMin = rawMin;
|
||||||
triggerPin.dir(Dir.DIR_OUT);
|
this.rawMax = rawMax;
|
||||||
|
this.euMin = euMin;
|
||||||
|
this.euMax = euMax;
|
||||||
|
|
||||||
|
m = (rawMax - rawMin) / (euMax - euMin);
|
||||||
|
b = rawMax - m * euMax;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int trigger(int triggerVal){
|
|
||||||
triggerPin.write(triggerVal);
|
|
||||||
return triggerVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int write(float writeVal){
|
|
||||||
|
|
||||||
|
|
||||||
|
public int write(MuxSetup mux, double writeVal){
|
||||||
|
rawValue = (int) (writeVal * m + b);
|
||||||
|
try {
|
||||||
|
mux.writeAnalog(channel, rawValue);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
try {
|
||||||
|
MuxSetup mux = new MuxSetup();
|
||||||
|
AnalogOut anOut1 = new AnalogOut(2, 0, 65535, 0, 100);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
anOut1.write(mux, (double) (i + 1) * 10.0);
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package com.henrypump.io;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Instant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by patrickjmcd on 6/19/17.
|
|
||||||
*/
|
|
||||||
public class AnalogOutPi {
|
|
||||||
public int channel;
|
|
||||||
public int rawValue;
|
|
||||||
public double lastValue;
|
|
||||||
public Instant lastStored = Instant.EPOCH;
|
|
||||||
public double rawMax, rawMin, euMax, euMin;
|
|
||||||
private double m, b;
|
|
||||||
|
|
||||||
|
|
||||||
AnalogOutPi(int channel, double rawMin, double rawMax, double euMin, double euMax){
|
|
||||||
this.channel = channel;
|
|
||||||
this.rawMin = rawMin;
|
|
||||||
this.rawMax = rawMax;
|
|
||||||
this.euMin = euMin;
|
|
||||||
this.euMax = euMax;
|
|
||||||
|
|
||||||
m = (rawMax - rawMin) / (euMax - euMin);
|
|
||||||
b = rawMax - m * euMax;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int write(MuxSetupPi mux, double writeVal){
|
|
||||||
rawValue = (int) (writeVal * m + b);
|
|
||||||
try {
|
|
||||||
mux.writeAnalog(channel, rawValue);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
|
||||||
try {
|
|
||||||
MuxSetupPi mux = new MuxSetupPi();
|
|
||||||
AnalogOutPi anOut1 = new AnalogOutPi(1, 0, 65535, 0, 100);
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
anOut1.write(mux, (double) (i + 1) * 10.0);
|
|
||||||
Thread.sleep(1000);
|
|
||||||
}
|
|
||||||
} catch (IOException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,13 +14,15 @@ public class DigitalIn {
|
|||||||
public int channel;
|
public int channel;
|
||||||
public int value;
|
public int value;
|
||||||
public List<Integer> channelMux;
|
public List<Integer> channelMux;
|
||||||
DigitalIn(int channel){
|
public DigitalIn(int channel){
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.channelMux = MuxSetup.muxValues.get(channel);
|
this.channelMux = MuxSetup.muxValues.get(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValue(int value){
|
public int read(MuxSetup mux){
|
||||||
this.value = value;
|
mux.set(channelMux.get(0), channelMux.get(1), channelMux.get(2));
|
||||||
|
value = mux.readDigital();
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
@@ -37,36 +39,28 @@ public class DigitalIn {
|
|||||||
DigitalIn dI7 = new DigitalIn(7);
|
DigitalIn dI7 = new DigitalIn(7);
|
||||||
DigitalIn dI8 = new DigitalIn(8);
|
DigitalIn dI8 = new DigitalIn(8);
|
||||||
|
|
||||||
mux.set(dI1.channelMux.get(0), dI1.channelMux.get(1), dI1.channelMux.get(2));
|
dI1.read(mux);
|
||||||
dI1.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI1.channel + ": " + dI1.value);
|
System.out.println("Input " + dI1.channel + ": " + dI1.value);
|
||||||
|
|
||||||
mux.set(dI2.channelMux.get(0), dI2.channelMux.get(1), dI2.channelMux.get(2));
|
dI2.read(mux);
|
||||||
dI2.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI2.channel + ": " + dI2.value);
|
System.out.println("Input " + dI2.channel + ": " + dI2.value);
|
||||||
|
|
||||||
mux.set(dI3.channelMux.get(0), dI3.channelMux.get(1), dI3.channelMux.get(2));
|
dI3.read(mux);
|
||||||
dI3.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI3.channel + ": " + dI3.value);
|
System.out.println("Input " + dI3.channel + ": " + dI3.value);
|
||||||
|
|
||||||
mux.set(dI4.channelMux.get(0), dI4.channelMux.get(1), dI4.channelMux.get(2));
|
dI4.read(mux);
|
||||||
dI4.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI4.channel + ": " + dI4.value);
|
System.out.println("Input " + dI4.channel + ": " + dI4.value);
|
||||||
|
|
||||||
mux.set(dI5.channelMux.get(0), dI5.channelMux.get(1), dI5.channelMux.get(2));
|
dI5.read(mux);
|
||||||
dI5.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI5.channel + ": " + dI5.value);
|
System.out.println("Input " + dI5.channel + ": " + dI5.value);
|
||||||
|
|
||||||
mux.set(dI6.channelMux.get(0), dI6.channelMux.get(1), dI6.channelMux.get(2));
|
dI6.read(mux);
|
||||||
dI6.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI6.channel + ": " + dI6.value);
|
System.out.println("Input " + dI6.channel + ": " + dI6.value);
|
||||||
|
|
||||||
mux.set(dI7.channelMux.get(0), dI7.channelMux.get(1), dI7.channelMux.get(2));
|
dI7.read(mux);
|
||||||
dI7.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI7.channel + ": " + dI7.value);
|
System.out.println("Input " + dI7.channel + ": " + dI7.value);
|
||||||
|
|
||||||
mux.set(dI8.channelMux.get(0), dI8.channelMux.get(1), dI8.channelMux.get(2));
|
dI8.read(mux);
|
||||||
dI8.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI8.channel + ": " + dI8.value);
|
System.out.println("Input " + dI8.channel + ": " + dI8.value);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
package com.henrypump.io;
|
|
||||||
|
|
||||||
import mraa.Dir;
|
|
||||||
import mraa.Gpio;
|
|
||||||
import mraa.Result;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by patrickjmcd on 6/14/17.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class DigitalInPi {
|
|
||||||
public int channel;
|
|
||||||
public int value;
|
|
||||||
public List<Integer> channelMux;
|
|
||||||
DigitalInPi(int channel){
|
|
||||||
this.channel = channel;
|
|
||||||
this.channelMux = MuxSetupPi.muxValues.get(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setValue(int value){
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
|
||||||
try {
|
|
||||||
MuxSetupPi mux = new MuxSetupPi();
|
|
||||||
|
|
||||||
System.out.println("Testing Digital Inputs");
|
|
||||||
|
|
||||||
|
|
||||||
DigitalInPi dI1 = new DigitalInPi(1);
|
|
||||||
DigitalInPi dI2 = new DigitalInPi(2);
|
|
||||||
DigitalInPi dI3 = new DigitalInPi(3);
|
|
||||||
DigitalInPi dI4 = new DigitalInPi(4);
|
|
||||||
DigitalInPi dI5 = new DigitalInPi(5);
|
|
||||||
DigitalInPi dI6 = new DigitalInPi(6);
|
|
||||||
DigitalInPi dI7 = new DigitalInPi(7);
|
|
||||||
DigitalInPi dI8 = new DigitalInPi(8);
|
|
||||||
|
|
||||||
mux.set(dI1.channelMux.get(0), dI1.channelMux.get(1), dI1.channelMux.get(2));
|
|
||||||
dI1.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI1.channel + ": " + dI1.value);
|
|
||||||
|
|
||||||
mux.set(dI2.channelMux.get(0), dI2.channelMux.get(1), dI2.channelMux.get(2));
|
|
||||||
dI2.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI2.channel + ": " + dI2.value);
|
|
||||||
|
|
||||||
mux.set(dI3.channelMux.get(0), dI3.channelMux.get(1), dI3.channelMux.get(2));
|
|
||||||
dI3.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI3.channel + ": " + dI3.value);
|
|
||||||
|
|
||||||
mux.set(dI4.channelMux.get(0), dI4.channelMux.get(1), dI4.channelMux.get(2));
|
|
||||||
dI4.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI4.channel + ": " + dI4.value);
|
|
||||||
|
|
||||||
mux.set(dI5.channelMux.get(0), dI5.channelMux.get(1), dI5.channelMux.get(2));
|
|
||||||
dI5.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI5.channel + ": " + dI5.value);
|
|
||||||
|
|
||||||
mux.set(dI6.channelMux.get(0), dI6.channelMux.get(1), dI6.channelMux.get(2));
|
|
||||||
dI6.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI6.channel + ": " + dI6.value);
|
|
||||||
|
|
||||||
mux.set(dI7.channelMux.get(0), dI7.channelMux.get(1), dI7.channelMux.get(2));
|
|
||||||
dI7.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI7.channel + ": " + dI7.value);
|
|
||||||
|
|
||||||
mux.set(dI8.channelMux.get(0), dI8.channelMux.get(1), dI8.channelMux.get(2));
|
|
||||||
dI8.setValue(mux.readDigital());
|
|
||||||
System.out.println("Input " + dI8.channel + ": " + dI8.value);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,7 @@ public class DigitalOut {
|
|||||||
int channel;
|
int channel;
|
||||||
Gpio gpioPin;
|
Gpio gpioPin;
|
||||||
|
|
||||||
DigitalOut(int channel){
|
public DigitalOut(int channel){
|
||||||
// if ((channel >=0 && channel <=5) || (channel == 8) || (channel == 9)) {
|
// if ((channel >=0 && channel <=5) || (channel == 8) || (channel == 9)) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
gpioPin = new Gpio(channel);
|
gpioPin = new Gpio(channel);
|
||||||
@@ -23,7 +23,7 @@ public class DigitalOut {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(int value){
|
public void write(int value){
|
||||||
gpioPin.write(value);
|
gpioPin.write(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,142 +0,0 @@
|
|||||||
package com.henrypump.io;
|
|
||||||
|
|
||||||
import com.pi4j.io.gpio.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by patrickjmcd on 6/20/17.
|
|
||||||
*/
|
|
||||||
public class DigitalOutPi {
|
|
||||||
int channel;
|
|
||||||
final GpioController gpio = GpioFactory.getInstance();
|
|
||||||
Pin gpioPin;
|
|
||||||
GpioPinDigitalOutput pin;
|
|
||||||
String pinNumbering = "wPi";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DigitalOutPi(int channel){
|
|
||||||
if ((channel >=1 && channel <=6) || (channel == 8) || (channel == 9)) {
|
|
||||||
this.channel = channel;
|
|
||||||
|
|
||||||
switch (channel) {
|
|
||||||
case 1:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_29;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_21;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_28;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_20;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_27;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_16;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_26;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_12;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_06;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_25;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_05;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_24;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_04;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_23;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
if (pinNumbering == "wPi") {
|
|
||||||
gpioPin = RaspiPin.GPIO_01;
|
|
||||||
} else {
|
|
||||||
gpioPin = RaspiPin.GPIO_18;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pin = gpio.provisionDigitalOutputPin(gpioPin, "Output" + channel, PinState.LOW);
|
|
||||||
pin.setShutdownOptions(true, PinState.LOW);
|
|
||||||
} else {
|
|
||||||
System.err.println("Error: This channel does not exist,.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void write(int value){
|
|
||||||
if (value >= 1) {
|
|
||||||
pin.high();
|
|
||||||
} else {
|
|
||||||
pin.low();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
|
||||||
DigitalOutPi dO1 = new DigitalOutPi(1);
|
|
||||||
DigitalOutPi dO2 = new DigitalOutPi(2);
|
|
||||||
DigitalOutPi dO3 = new DigitalOutPi(3);
|
|
||||||
DigitalOutPi dO4 = new DigitalOutPi(4);
|
|
||||||
DigitalOutPi dO5 = new DigitalOutPi(5);
|
|
||||||
DigitalOutPi dO6 = new DigitalOutPi(6);
|
|
||||||
// DigitalOutPi redLED = new DigitalOut(8);
|
|
||||||
// DigitalOutPi greenLED = new DigitalOut(9);
|
|
||||||
System.out.println("Testing Digital Outputs");
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
dO1.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO2.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO3.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO4.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO5.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO6.write(1);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO6.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO5.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO4.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO3.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO2.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
dO1.write(0);
|
|
||||||
Thread.sleep(500);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ import mraa.Dir;
|
|||||||
import mraa.Gpio;
|
import mraa.Gpio;
|
||||||
import mraa.Spi;
|
import mraa.Spi;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ public class MuxSetup {
|
|||||||
private Gpio gpioA1;
|
private Gpio gpioA1;
|
||||||
private Gpio gpioA2;
|
private Gpio gpioA2;
|
||||||
private Gpio gpioA3;
|
private Gpio gpioA3;
|
||||||
|
private Gpio gpioAnOutTrigger;
|
||||||
private Spi spi;
|
private Spi spi;
|
||||||
|
|
||||||
public static List<List<Integer>> muxValues = Arrays.asList(
|
public static List<List<Integer>> muxValues = Arrays.asList(
|
||||||
@@ -34,7 +36,7 @@ public class MuxSetup {
|
|||||||
Arrays.asList(1,1,1)
|
Arrays.asList(1,1,1)
|
||||||
);
|
);
|
||||||
|
|
||||||
MuxSetup(){
|
public MuxSetup(){
|
||||||
gpioA0 = new Gpio(14);
|
gpioA0 = new Gpio(14);
|
||||||
gpioA0.dir(Dir.DIR_OUT);
|
gpioA0.dir(Dir.DIR_OUT);
|
||||||
|
|
||||||
@@ -47,6 +49,10 @@ public class MuxSetup {
|
|||||||
gpioA3 = new Gpio(17);
|
gpioA3 = new Gpio(17);
|
||||||
gpioA3.dir(Dir.DIR_IN);
|
gpioA3.dir(Dir.DIR_IN);
|
||||||
|
|
||||||
|
gpioAnOutTrigger = new Gpio(6);
|
||||||
|
gpioAnOutTrigger.dir(Dir.DIR_OUT);
|
||||||
|
gpioAnOutTrigger.write(1);
|
||||||
|
|
||||||
spi = new Spi(5);
|
spi = new Spi(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +63,7 @@ public class MuxSetup {
|
|||||||
return apply();
|
return apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int apply(){
|
int apply(){
|
||||||
gpioA0.write(A0val);
|
gpioA0.write(A0val);
|
||||||
gpioA1.write(A1val);
|
gpioA1.write(A1val);
|
||||||
gpioA2.write(A2val);
|
gpioA2.write(A2val);
|
||||||
@@ -89,4 +95,39 @@ public class MuxSetup {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void preAnalogWrite(){
|
||||||
|
gpioAnOutTrigger.write(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void postAnalogWrite(){
|
||||||
|
gpioAnOutTrigger.write(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String toBinary( byte b )
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder(8);
|
||||||
|
for( int i = 0; i < 8; i++ )
|
||||||
|
sb.append((b << i % 8 & 0x80) == 0 ? '0' : '1');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int writeAnalog(int channel, int rawValue) throws IOException {
|
||||||
|
preAnalogWrite();
|
||||||
|
byte controlBits = (byte) 0b00010000;
|
||||||
|
|
||||||
|
if (channel == 2){
|
||||||
|
controlBits = (byte) 0b00100100;
|
||||||
|
}
|
||||||
|
byte anWrite[] = new byte[]{
|
||||||
|
controlBits,
|
||||||
|
(byte) (rawValue & 0xFF),
|
||||||
|
(byte) ((rawValue >> 8) & 0xFF)
|
||||||
|
};
|
||||||
|
byte[] result = spi.write(anWrite);
|
||||||
|
System.out.printf("writing %s, %s, %s%n", toBinary(anWrite[0]), toBinary(anWrite[1]), toBinary(anWrite[2]));
|
||||||
|
postAnalogWrite();
|
||||||
|
System.out.printf("0= %s, 1= %s, 2= %s%n", result[0] & 0xFF, result[1] & 0xFF, result[2] & 0xFF);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,142 +0,0 @@
|
|||||||
package com.henrypump.io;
|
|
||||||
|
|
||||||
import com.pi4j.io.gpio.*;
|
|
||||||
import com.pi4j.io.spi.SpiChannel;
|
|
||||||
import com.pi4j.io.spi.SpiDevice;
|
|
||||||
import com.pi4j.io.spi.SpiFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by patrickjmcd on 6/21/17.
|
|
||||||
*/
|
|
||||||
public class MuxSetupPi {
|
|
||||||
|
|
||||||
final GpioController gpio = GpioFactory.getInstance();
|
|
||||||
GpioPinDigitalOutput pinMux1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_21);
|
|
||||||
GpioPinDigitalOutput pinMux2 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_22);
|
|
||||||
GpioPinDigitalOutput pinMux3 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_23);
|
|
||||||
GpioPinDigitalInput pinDigitalRead = gpio.provisionDigitalInputPin(RaspiPin.GPIO_24);
|
|
||||||
|
|
||||||
GpioPinDigitalOutput pinAnOutTrigger = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "AnalogOutTrigger", PinState.HIGH);
|
|
||||||
|
|
||||||
private int mux1value = 0;
|
|
||||||
private int mux2value = 0;
|
|
||||||
private int mux3value = 0;
|
|
||||||
|
|
||||||
private SpiDevice spi;
|
|
||||||
|
|
||||||
public static List<List<Integer>> muxValues = Arrays.asList(
|
|
||||||
Arrays.asList(),
|
|
||||||
Arrays.asList(0,0,0),
|
|
||||||
Arrays.asList(1,0,0),
|
|
||||||
Arrays.asList(0,1,0),
|
|
||||||
Arrays.asList(1,1,0),
|
|
||||||
Arrays.asList(0,0,1),
|
|
||||||
Arrays.asList(1,0,1),
|
|
||||||
Arrays.asList(0,1,1),
|
|
||||||
Arrays.asList(1,1,1)
|
|
||||||
);
|
|
||||||
|
|
||||||
MuxSetupPi() throws IOException{
|
|
||||||
spi = SpiFactory.getInstance(SpiChannel.CS0, SpiDevice.DEFAULT_SPI_SPEED, SpiDevice.DEFAULT_SPI_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int set(int a0val, int a1val, int a2val){
|
|
||||||
this.mux1value = a0val;
|
|
||||||
this.mux2value = a1val;
|
|
||||||
this.mux3value = a2val;
|
|
||||||
return apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int apply(){
|
|
||||||
if (mux1value >= 1) {
|
|
||||||
pinMux1.high();
|
|
||||||
} else {
|
|
||||||
pinMux1.low();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mux2value >= 1) {
|
|
||||||
pinMux2.high();
|
|
||||||
} else {
|
|
||||||
pinMux2.low();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mux3value >= 1) {
|
|
||||||
pinMux3.high();
|
|
||||||
} else {
|
|
||||||
pinMux3.low();
|
|
||||||
}
|
|
||||||
return mux1value + mux2value * 2 + mux3value * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int readDigital(){
|
|
||||||
if (pinDigitalRead.isHigh()){
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void preAnalogWrite(){
|
|
||||||
pinAnOutTrigger.low();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postAnalogWrite(){
|
|
||||||
pinAnOutTrigger.high();
|
|
||||||
}
|
|
||||||
|
|
||||||
static String toBinary( byte b )
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder(8);
|
|
||||||
for( int i = 0; i < 8; i++ )
|
|
||||||
sb.append((b << i % 8 & 0x80) == 0 ? '0' : '1');
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int writeAnalog(int channel, int rawValue) throws IOException{
|
|
||||||
preAnalogWrite();
|
|
||||||
byte controlBits = (byte) 0b00010000;
|
|
||||||
|
|
||||||
if (channel == 2){
|
|
||||||
controlBits = (byte) 0b00100100;
|
|
||||||
}
|
|
||||||
byte anWrite[] = new byte[]{
|
|
||||||
controlBits,
|
|
||||||
(byte) (rawValue & 0xFF),
|
|
||||||
(byte) ((rawValue >> 8) & 0xFF)
|
|
||||||
};
|
|
||||||
byte[] result = spi.write(anWrite);
|
|
||||||
System.out.printf("writing %s, %s, %s%n", toBinary(anWrite[0]), toBinary(anWrite[1]), toBinary(anWrite[2]));
|
|
||||||
postAnalogWrite();
|
|
||||||
System.out.printf("0= %s, 1= %s, 2= %s%n", result[0] & 0xFF, result[1] & 0xFF, result[2] & 0xFF);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int readAnalog() throws IOException {
|
|
||||||
byte zeroes[] = new byte[] {
|
|
||||||
(byte) 0b00000000,
|
|
||||||
(byte) 0b00000000,
|
|
||||||
(byte) 0b00000000
|
|
||||||
};
|
|
||||||
|
|
||||||
byte[] result = spi.write(zeroes);
|
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("Raw= " + (a * 256 + b));
|
|
||||||
int a = result[0] & 0xFF;
|
|
||||||
int b = result[1] & 0xFF;
|
|
||||||
int c = result[2] & 0xFF;
|
|
||||||
// System.out.println("a= " + a + ", b= " + b + ", c= " + c);
|
|
||||||
|
|
||||||
if (c == 13){
|
|
||||||
int x = a * 256;
|
|
||||||
x = x + b;
|
|
||||||
return x;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user