mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-04 14:07:30 +00:00
Working source and receiver calibration
This commit is contained in:
parent
875f3b0170
commit
026fffd588
23 changed files with 722 additions and 68 deletions
|
|
@ -30,7 +30,7 @@ void Flash::read(uint32_t address, uint16_t length, void *dest) {
|
|||
}
|
||||
|
||||
bool Flash::write(uint32_t address, uint16_t length, void *src) {
|
||||
if((address & 0xFF) != 0 || length%256 != 0) {
|
||||
if(address % PageSize != 0 || length%PageSize != 0) {
|
||||
// only writes to complete pages allowed
|
||||
LOG_ERR("Invalid write address/size: %lu/%u", address, length);
|
||||
return false;
|
||||
|
|
@ -46,7 +46,7 @@ bool Flash::write(uint32_t address, uint16_t length, void *src) {
|
|||
(uint8_t) (address >> 8) & 0xFF,
|
||||
(uint8_t) (address & 0xFF),
|
||||
};
|
||||
// issue read command
|
||||
// issue write command
|
||||
HAL_SPI_Transmit(spi, cmd, 4, 100);
|
||||
// write data
|
||||
HAL_SPI_Transmit(spi, (uint8_t*) src, 256, 1000);
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@ public:
|
|||
const SPI_HandleTypeDef* const getSpi() const {
|
||||
return spi;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr uint32_t PageSize = 256;
|
||||
static constexpr uint32_t SectorSize = 4096;
|
||||
static constexpr uint32_t Block32Size = 32768;
|
||||
static constexpr uint32_t Block64Size = 65536;
|
||||
|
||||
private:
|
||||
void CS(bool high) {
|
||||
if(high) {
|
||||
CS_gpio->BSRR = CS_pin;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue