-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from MannyPeterson/develop
HeliOS 0.2.7
- Loading branch information
Showing
25 changed files
with
359 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Ignore rules to keep the hex files out. | ||
|
||
*.hex | ||
|
||
# I use Simulide, ignore the backup file. | ||
|
||
*_backup.simu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Include the standard HeliOS header for Arduino sketches. This header | ||
* includes the required HeliOS header files automatically. | ||
*/ | ||
#include <HeliOS_Arduino.h> | ||
|
||
volatile int ledState = 0; | ||
volatile int buttonState = 0; | ||
const int buttonPin = 2; | ||
const int ledPin = 4; | ||
|
||
void taskBlink(xTaskId id_) { | ||
|
||
if (ledState) { | ||
|
||
digitalWrite(LED_BUILTIN, LOW); | ||
|
||
ledState = 0; | ||
} else { | ||
|
||
digitalWrite(LED_BUILTIN, HIGH); | ||
|
||
ledState = 1; | ||
} | ||
} | ||
|
||
void buttonRead(xTaskId id_) { | ||
buttonState = digitalRead(buttonPin); | ||
|
||
// check if the pushbutton is pressed. If it is, the buttonState is HIGH: | ||
if (buttonState == HIGH) { | ||
// turn LED on: | ||
digitalWrite(ledPin, HIGH); | ||
} else { | ||
// turn LED off: | ||
digitalWrite(ledPin, LOW); | ||
} | ||
} | ||
|
||
void setup() { | ||
|
||
xTaskId id = 0; | ||
|
||
xHeliOSSetup(); | ||
|
||
pinMode(LED_BUILTIN, OUTPUT); | ||
pinMode(ledPin, OUTPUT); | ||
// initialize the pushbutton pin as an input: | ||
pinMode(buttonPin, INPUT); | ||
|
||
id = xTaskAdd("TASKBLINK", &taskBlink); | ||
|
||
xTaskWait(id); | ||
|
||
xTaskSetTimer(id, 2000000); | ||
|
||
id = xTaskAdd("BUTTON", &buttonRead); | ||
|
||
xTaskStart(id); | ||
} | ||
|
||
void loop() { | ||
|
||
xHeliOSLoop(); | ||
} |
Oops, something went wrong.