-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: main
Are you sure you want to change the base?
Conversation
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.
EPC611 Driver/epc611.cpp
Outdated
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); |
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 line would never be reached. Place it before return.
EPC611 Driver/epc611.cpp
Outdated
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); |
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.
You can use this-> or simply just call the member function rather than class name
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.
E.g. this->poll(write)
EPC611 Driver/epc611.cpp
Outdated
} | ||
|
||
// 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 |
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.
Could specify the array size or pointer
EPC611 Driver/epc611.cpp
Outdated
|
||
bool EPC611::dataReady() | ||
{ | ||
return (HAL_GPIO_WritePin(gpio_data_rdy,data_rdy_pin) == GPIO_PIN_SET); |
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.
Should be ReadPin?
No description provided.