Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8_t AT86RF2XX::reg_read(const uint8_t addr)
- {
- uint8_t value;
- uint8_t readCommand = addr | AT86RF2XX_ACCESS_REG | AT86RF2XX_ACCESS_READ; //never mind for these constants, they're correct
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
- // PA8 is set as GPIO output from CubemMX, and plays the role of the SS pin, now it goes off to wake up the slave
- HAL_SPI_TransmitReceive(spi, &readCommand, &value, 1, 100);
- while(HAL_SPI_GetState(spi) != HAL_SPI_STATE_READY);
- HAL_SPI_TransmitReceive(spi, &readCommand, &value, 1, 100);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET); // set it back to high to terminate the communication.
- return (uint8_t)value;
- }
Add Comment
Please, Sign In to add comment