Skip to content

Commit aad6032

Browse files
committed
comments for main.c and some RPG functions
1 parent 0f9b8bf commit aad6032

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

BUILD_DIR/main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
ESOS_USER_TASK(demoLEDsAndSwitches) {
1818
ESOS_TASK_BEGIN();
19-
esos_uiF14_flashLED3( 500 );
19+
esos_uiF14_flashLED3( 500 ); //heartbeat always blinking
20+
// RPG controls LED2
2021
if (esos_uiF14_isRpgTurning ()){
2122
esos_uiF14_turnLED2Off ();
2223
}
@@ -29,7 +30,8 @@ ESOS_USER_TASK(demoLEDsAndSwitches) {
2930
if (esos_uiF14_isRpgTurningFast()){
3031
esos_uiF14_flashLED2( 100 );
3132
}
32-
if (esos_uiF14_isSW3Released()){
33+
//switch on RPG (SW3) controls whether SW1 or SW2 controls LED1
34+
if (esos_uiF14_isSW3Released()){
3335
if (esos_uiF14_isSW1Pressed()){
3436
esos_uiF14_turnLED1On ();
3537
} else if (esos_uiF14_isSW1Released (){
@@ -99,7 +101,6 @@ ESOS_USER_TASK(drawDisplay) {
99101
} else {outString("Sw3 is NOT Double Pressed\n\n");}
100102

101103
if (esos_uiF14_isRPGTurning()) {
102-
103104
outString("RPG is Turning ");
104105
if (esos_uiF14_isRPGTurningCW()) {
105106
outString("CW ");
@@ -117,13 +118,13 @@ ESOS_USER_TASK(drawDisplay) {
117118
outString("RPG is Not Turning");
118119
}
119120
ESOS_TASK_WAIT_TICKS(50);
120-
outString("\n\n\n\n\n\n\n\n");
121+
outString("\n\n\n\n\n\n\n\n"); //these newlines clear the screen and allow overwrite
121122
}
122123
ESOS_TASK_END();
123124
}
124125
void user_init(){
125126

127+
esos_RegisterTask(demoLEDsAndSwitches);
126128
esos_RegisterTask(drawDisplay);
127-
128129

129130
}

esos/include/esos_f14ui.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef struct {
2020
BOOL b_SW2DoublePressed;
2121
BOOL b_SW3Pressed;
2222
BOOL b_SW3DoublePressed;
23-
uint16_t u16_doublePressUpperMs;
23+
uint16_t u16_doublePressUpperMs; //upper time limit to be double pressed
2424

2525
BOOL b_RPGALast; // compared to current RPGA, used to detect rotation
2626
BOOL b_RPGFast;
@@ -30,17 +30,17 @@ typedef struct {
3030
uint16_t u16_RPGLastChangeMs; //time of last RPGA change
3131
uint16_t u16_RPGPeriodMs; // time SINCE last RPGA change
3232
uint16_t u16_RPGNotMovingToSlowPeriodMs; //border between not moving and slow
33-
uint16_t u16_RPGSlowToMediumPeriodMs;
34-
uint16_t u16_RPGMediumToFastPeriodMs;
35-
BOOL b_RPGCW;
36-
BOOL b_RPGCCW;
37-
int16_t i16_RPGCounter; // notice signed int for couting CCW from start
38-
int16_t i16_lastRPGCounter;
39-
BOOL b_RPGCWRev;
33+
uint16_t u16_RPGSlowToMediumPeriodMs; //border between slow and medium
34+
uint16_t u16_RPGMediumToFastPeriodMs; //border between medium and fast
35+
BOOL b_RPGCW; //clockwise rotation
36+
BOOL b_RPGCCW; //counter clockwise
37+
int16_t i16_RPGCounter; //notice signed int for counting CCW from start
38+
int16_t i16_lastRPGCounter;
39+
BOOL b_RPGCWRev; //T/F has RPG gone 1 full CW revolution?
4040
BOOL b_RPGCCWRev;
4141

4242
BOOL b_LED1On;
43-
uint16_t u16_LED1FlashPeriod;
43+
uint16_t u16_LED1FlashPeriod; //period of one full one then off toggle
4444

4545
BOOL b_LED2On;
4646
uint16_t u16_LED2FlashPeriod;

esos/src/esos_f14ui.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ inline BOOL esos_uiF14_isSW3DoublePressed (void) {
8080

8181
// PUBLIC LED FUNCTIONS
8282

83-
//Ryan: I think some of these functions are intended to actually
84-
//trigger LED changes, so I'm updating the LED register
8583

8684
inline BOOL esos_uiF14_isLED1On (void) {
8785
return (_st_esos_uiF14Data.b_LED1On);

0 commit comments

Comments
 (0)