-
Notifications
You must be signed in to change notification settings - Fork 412
Bootcamp: Apilaash Yoharan #254
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: master
Are you sure you want to change the base?
Conversation
nucleof072rb/Core/Src/main.c
Outdated
|
|
||
| /* Private user code ---------------------------------------------------------*/ | ||
| /* USER CODE BEGIN 0 */ | ||
| #define MIN_DUTY_TIME 0.05 |
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.
Try to avoid using floats as best as you can
nucleof072rb/Core/Src/main.c
Outdated
| // Setup bits for ADC | ||
| SPI_TX[0] = 0b00000001; | ||
| SPI_TX[1] = 0b10000000; | ||
| SPI_TX[2] = 0b00000000; |
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.
Does this need to be in the loop?
nucleof072rb/Core/Src/main.c
Outdated
| ADC_Value = (SPI_RX[1] & 0b00000011 << 8) | SPI_RX[2]; | ||
|
|
||
| // Converts the ADC value into an appropriate value to set the register | ||
| Register_Value = MIN_DUTY_TIME + (ADC_Value / MAX_ADC_VALUE) * (MAX_DUTY_TIME-MIN_DUTY_TIME); |
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.
this doesn't mesh with what you defined the MAX and MIN duty time constants to be
nucleof072rb/Core/Src/main.c
Outdated
|
|
||
|
|
||
| // Set the CS pin to low | ||
| HAL_GPIO_WritePin(CS_PIN_GPIO_Port, CS_PIN_Pin, 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.
This could be moved a bit up in your program
nucleof072rb/Core/Src/main.c
Outdated
| while (1) | ||
| { | ||
| // Set the CS pin to high | ||
| HAL_GPIO_WritePin(CS_PIN_GPIO_Port, CS_PIN_Pin, 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.
Are you sure this is how you initiate a SPI data transfer?
No description provided.