-
Notifications
You must be signed in to change notification settings - Fork 1
Temp and humidty sensor #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
Preliminary to making the sensors function
Changed the loop in dht11.c so that it does not run infinitly, instead, ends when the two values are read in
Formatting and what not
Fixed a few things detailed in the pull request review
djpetti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you already have all my comments, Lucas.
|
This got closed when I deleted the psoc branch. All that code is in the devel branch now, so I've changed the base, and am reopening this. Incidentally, it will probably also have to be rebased. |
Put the loop that reads in the temperature and humidity in a switch case. This was its not running awlays, and won't run unless we initilize it again.
djpetti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interrupt-driven stuff is moving in the right direction.
Also, you need to rebase this on devel before it can get merged.
| _CY_ISR_PROTO(Delay_Timer_ISR_Handler); | ||
| _CY_ISR_PROTO(DHT_Pin_ISR_Handler); | ||
|
|
||
| // What Return_Decoded_Temperature does: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update function name in comment.
|
|
||
| if(g_decoded_temperature_data == NULL) { | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put else on same line as closing brace.
| } | ||
| } | ||
|
|
||
| // What Return_Decoded_Humidity does: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update function name in comment.
|
|
||
| uint8_t dht_get_temperature(){ | ||
|
|
||
| if(g_decoded_temperature_data == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a space between "if" and "(". Same for "else" and "{".
| g_executed = 0; | ||
| Delay_Timer_ISR_Enable(); | ||
| // Write 0 to Control_Reg_Delay_Timer to starting Delay_Timer component | ||
| Control_Reg_Delay_Timer_Write(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure there's not just a Delay_Timer_Start() function you can call?
| } | ||
|
|
||
| int j; | ||
| for(j=0; j<8; ++j) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces around "=" and "<" again. Also, it looks like there are some more "magic" numbers here that need documentation.
| DHT_Pin_ClearInterrupt(); | ||
| // Read the counter values of Data_Timer for processing | ||
| g_countvalues_datatimer[g_risingedge_counts]=Data_Timer_ReadCounter(); | ||
| g_risingedge_counts++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer preincrement when you can. It's more efficient.
| // Clear the interrupt request of the pin DHT_Pin | ||
| DHT_Pin_ClearInterrupt(); | ||
| // Read the counter values of Data_Timer for processing | ||
| g_countvalues_datatimer[g_risingedge_counts]=Data_Timer_ReadCounter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space around "=".
| // be in the respective variables | ||
|
|
||
| /* | ||
| switch(g_has_been_executed){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything below here looks like the old blocking implementation. Did you mean to get rid of it?
| #include <stdint.h> | ||
|
|
||
|
|
||
| //Initilize everything needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after //
This change makes it so that instead of the temp and humidity sensor being continually updated, it doesnt update until someone calls it agian
I guess this didn't go with the previous commit
Just changing things to be more pleasing to look at and easier to read.
This change is for increased functionality and also a sense of cleanliness in the code
Not needed when the functions are called properly
We don't need it any more, since we took away the switch statment
|
Have you tested this on actual hardware yet? |
New pull request because I deleted the new one