Skip to content
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

Epc 611 rangefinder #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Epc 611 rangefinder #4

wants to merge 4 commits into from

Conversation

Tann90grin
Copy link

No description provided.

As I don't know the use for UHD, for now the frame data is just dumped into an array. Polling is also now not useless and now holds the entire communication protocol together.
HAL_GPIO_WritePin(gpio_nss,nss_pin,GPIO_PIN_RESET);
uint8_t send[2] = {data>>8, data&0x00FF}; // MSB first
uint8_t received[2] = {0};
HAL_SPI_TransmitReceive(&hspi1, send, received, 2, SPI_TIMEOUT);
return received[0] | (received[1]<<8);
return received[0] <<8 | (received[1]);
HAL_GPIO_WritePin(gpio_nss,nss_pin,GPIO_PIN_SET);
Copy link
Author

Choose a reason for hiding this comment

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

This line would never be reached. Place it before return.

HAL_GPIO_WritePin(gpio_nss,nss_pin,GPIO_PIN_SET);
}

uint16_t EPC611::write(uint8_t data,uint8_t address) {
uint16_t write = EPC_WRITE | data | ((address&0x1F) << 8);
return EPC611::epcSendRecv(write);
return EPC611::poll(write);
Copy link
Author

Choose a reason for hiding this comment

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

You can use this-> or simply just call the member function rather than class name

Copy link
Author

Choose a reason for hiding this comment

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

E.g. this->poll(write)

}

// Returns 8 rows of sums for the 8x8 TOF sensor
void EPC611::getFrameUHD(uint16_t DCS_frames[][]) // Gets 4 frames because that's what the chip does for some reason
Copy link
Author

Choose a reason for hiding this comment

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

Could specify the array size or pointer


bool EPC611::dataReady()
{
return (HAL_GPIO_WritePin(gpio_data_rdy,data_rdy_pin) == GPIO_PIN_SET);
Copy link
Author

Choose a reason for hiding this comment

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

Should be ReadPin?

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