Skip to content

Commit

Permalink
Fixed few more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthvikm committed Apr 10, 2024
1 parent 70719f0 commit 46a3c14
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 36 deletions.
4 changes: 0 additions & 4 deletions pi4micronaut-utils/src/docs/asciidoc/components.adoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalInput.adoc[Improve this doc]

To define in application.yaml add digital-input as a field under pi4j, then add each component under digital-input.
"Digital Input" refers to a type of electronic signal or data that can be read by the Raspberry Pi's GPIO pins. These signals are binary, meaning they can only be in one of two states: HIGH (1) or LOW (0).

To define in application.yaml add digital-input as a field under Pi4J, then add each component under digital-input.

Each component will need

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/commun_WithHardware/digitalOutput.adoc[Improve this doc]

To define in application.yaml add digital-output as a field under pi4j, then add each component under digital-output.
"Digital Output" refers to a signal sent from the Raspberry Pi's GPIO pins to another device or circuit. Unlike digital input, which the Raspberry Pi reads, digital output is a signal that the Raspberry Pi sends out.

Digital outputs are also binary, meaning they can only have two states: HIGH (1) or LOW (0). These states correspond to different voltage levels, typically 3.3V for high and 0V (ground) for low on a Raspberry Pi.

To define in application.yaml, add digital-output as a field under Pi4J, then add each component under digital-output.

Each component will need

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ SPI uses 4 separate connections to communicate with the target device:


====
*Note:*
Controller/Peripheral is formerly referred to as Master/Slave. In order to move away from the use of such terminology, we have opted to use the term Controller in place of Master, and Peripheral in place of Slave.
*Note:* Controller/Peripheral is formerly referred to as Master/Slave. In order to move away from the use of such terminology, we have opted to use the term Controller in place of Master, and Peripheral in place of Slave.
====


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
=== Input Components
[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/inputComponents.adoc[Improve this doc]

The Components that provide input signal or data to the application from Raspberry Pi GPIO pins.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ including its components, assembly instructions, and functionality.

image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/image152.png[]

.Note: The 220Ω resistor is for the LED and the 10Ω for the button.
.*Note:* The 220Ω resistor is for the LED and the 10Ω for the button.

Schematic Diagram:
*Schematic Diagram:*

image::https://docs.sunfounder.com/projects/raphael-kit/en/latest/_images/image303.png[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ stated below and in the diagram.

===== Circuit Diagram

- Note the resistor location at GPIO 27

image::rotary_encoder_circuit.png[]

*Note:* The resistor location at GPIO 27.

===== Functionality
The rotary encoder returns the value as you rotate the knob.

Expand Down Expand Up @@ -88,7 +88,7 @@ for more details.

===== An Example Controller

====== This controller sets up two rotary encoders
====== This controller uses a rotary encoder

[source, java]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ so that power can be supplied to the LED and touch switch as shown in the diagra

image:touchSwitchDiagram.png[]

Schematic Diagram:
*Schematic Diagram:*

image:touchSwitch.png[]

Expand All @@ -61,13 +61,13 @@ Use the below commands to test the touch switch.
* `/enable` - turns on touch switch
[source, bash]
----
curl http://localhost:8080/touchSwitch/enable
$ curl http://localhost:8080/touchSwitch/enable
----

* `/disable` - turns off touch switch
[source, bash]
----
curl http://localhost:8080/touchSwitch/disable
$ curl http://localhost:8080/touchSwitch/disable
----

===== Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ including its components, assembly instructions, and functionality.

image::ultrasonic_sensor_model.png[]

Schematic Diagram:
*Schematic Diagram:*

image::ultrasonic_sensor_circuit.png[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/components/outputComponents.adoc[Improve this doc]

The Components that provide output signal either by emitting, displaying, lighting, etc. through Raspberry Pi GPIO pins.
35 changes: 19 additions & 16 deletions pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@
https://github.com/oss-slu/Pi4Micronaut/edit/develop/pi4micronaut-utils/src/docs/asciidoc/contribute/newComponent.adoc[Improve this doc]


If its compatible with a Raspberry Pi then it should work well with the Pi4Micronaut framework. The following steps should encompass how most components are added to the framework, but should more or different steps be needed, create a new
If its compatible with a Raspberry Pi then it should work well with the Pi4Micronaut. The following steps should encompass how most components are added to the library. Start by creating a new
https://github.com/oss-slu/Pi4Micronaut/issues/new/choose[Issue] to suggest changes.


1. Determine the communication type for that device. For example, Buzzer works with PWM and LCD1602 works with I2C.
1. Determine the communication type for the component which you want to use. For example, Buzzer works with PWM and LCD1602 works with I2C.
2. Create a Controller:
** Controllers define and handle interactions with a given component. The Controller of a component will have a `@Controller("/example")` right above the class declaration that acts as the endpoint for requests to the component. Instead of "example", you should name the endpoint something that is identifiable to the component. Each method of the Controller should have a `@Get("/exampleEndPoint")` above the method declaration. The endpoint for the method should have the same name as the method and any parameters should be included in the endpoint `/exampleEndPoint/{parameter1},{parameter2}`.
** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java[RGB Controller] for an example of a Controller.
** Consult the https://micronaut-projects.github.io/micronaut-docs-mn3/3.8.1/guide/#creatingClient[Micronaut Documentation] for more explanation on Controllers.
** All Controllers should be kept here:
`components\src\main\java\com\opensourcewithslu\components\controllers`
2. Setup the circuit.
3. Add Component to the Application yml
** The new component will need to be added to the application yml found at `components/src/main/resources/application.yml`.
** More information on the `application.yml` found in <<Communicating with a Hardware Component>>

3. Create a Helper:
** A Helper is what the Controller calls to do a action. For example, to change the color of an RGB LED the controller will take the request to change it. The Controller will then call the change color method in the helper. The helper then takes all the actions needed to change the color of the LED.
4. Create a Helper:
** A Helper is what the Controller calls to do an action. For example, to change the color of an RGB LED the controller will take the request to change it. The Controller will then call the change color method in the helper. The helper then takes all the actions needed to change the color of the LED.
** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/pi4micronaut-utils/src/main/java/com/opensourcewithslu/outputdevices/RGBLEDHelper.java[RBG Helper] for an example of a Helper.
** All Helpers should be kept here: `pi4micronaut-utils\src\main\java\com\opensourcewithslu\(inputdevices or outputdevices)`

4. Add Component to the Application yml
** The new component will need to be added to the application yml found at `components/src/main/resources/application.yml`.
** More information on the `application.yml` found in <<Communicating with a Hardware Component>>
5. Create a Controller:
** Controllers define and handle interactions with a given component. The Controller of a component will have a `@Controller("/example")` right above the class declaration that acts as the endpoint for requests to the component. Instead of "example", you should name the endpoint something that is identifiable to the component. Each method of the Controller should have a `@Get("/exampleEndPoint")` above the method declaration. The endpoint for the method should have the same name as the method and any parameters should be included in the endpoint `/exampleEndPoint/{parameter1},{parameter2}`.
** See the https://github.com/oss-slu/Pi4Micronaut/blob/develop/components/src/main/java/com/opensourcewithslu/components/controllers/rgbController.java[RGB Controller] for an example of a Controller.
** Consult the https://micronaut-projects.github.io/micronaut-docs-mn3/3.8.1/guide/#creatingClient[Micronaut Documentation] for more explanation on Controllers.
** All Controllers should be kept here:
`components\src\main\java\com\opensourcewithslu\components\controllers`
5. Thoroughly test:
6. Thoroughly test:
** Contributors should thoroughly test their integrations
** When submitting a pull request, make sure to include how you tested the component, any circuits that you may have used, and how to run any examples you may have created.
** It is important that reviewers are able to replicated your work in order to properly test the implementation.
6. Create documentation for the component:
7. Create documentation for the component:
** Create an .adoc file with the component name as the file name.
** Make sure to include all the information that the other components. Simply copy/paste an existing components documentation and edit as needed.
** Add the file here: `pi4micronaut-utils/src/docs/asciidoc/components` under either input or output components.
3 changes: 1 addition & 2 deletions pi4micronaut-utils/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ include::contribute/contributingToLibrary.adoc[]
include::contribute/newComponent.adoc[]



include::components.adoc[]
== Components

include::components/commun_WithHardware.adoc[]

Expand Down

0 comments on commit 46a3c14

Please sign in to comment.