Skip to content

Conversation

@tejasbains
Copy link

Bootcamp submission for Tejas Bains

Copy link
Member

@Rosnaky Rosnaky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a few errors with the spi communication-I think you were missing the right diagram. Let me know if you have questions!

/* USER CODE BEGIN 4 */
int readADC() {
uint8_t command_byte = 0b11000;
uint8_t tx[2] = {command_byte, 0x00};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to send and receive 3 bytes as per figure 6.1

Image


/* USER CODE BEGIN 4 */
int readADC() {
uint8_t command_byte = 0b11000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to fix this as per the comment below

/* pull cs high*/
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_SET);
/* clean up and combine rx1 and rx2 */
rx[1] = rx[1] >> 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will need to fix as per figure 6.1


float getTimerCounts(float pulse_width) {
/* clock period is 20,000 so that 1 timer count = 1 microsecond */
float timer_counts = pulse_width * 1000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants