mirror of
https://github.com/thelsing/knx.git
synced 2024-10-20 20:07:45 +02:00
a306174878
* save WIP on flash api + header reorder * reduce diffs to master * added support for RP2040 (Raspberry Pi Pico) * support DPT9.009 (airflow) and DPT9.029 (absolute humidity) * added support for RP2040 (Raspberry Pi Pico) (#145) * worked on flash implementation * worked on flash implementation * added malloc for _EraseBlockBuffer, fixed some bugs * fixed memoryread and crash while loading KOs (+debugstuff) * some fixes and debugs * align to pagesize * clean up debug stuff, comments ... * added support for both Eeprom and Flash (NvMemoryType) plattforms. * changed memoryReadIndicationP to memoryReadIndication added stdlib and defines * fixed std::min * another try for fixing the min problem * rolled back linux plattform to eeprom * comments only, hints for plattforms * bugfix when calculating memorywrites over multiple blocks by mumpf * added support for EEPROM-Emulation / RAM-buffered Flash improvements in RP2040 plattform * fixed typo in KNX_FLASH_OFFSET * - writebuffersize clarified (PR discussion) - changed alignment from flashpagesize to 32bit - added override modifier (PR discussion) - changed comment regarding flash/eeprom functions for plattforms to override/implement (PR discussion) * resolved CodeFactor issue Co-authored-by: Thomas Kunze <thomas.kunze@gmx.com>
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#include "arduino_platform.h"
|
|
|
|
#include "Arduino.h"
|
|
|
|
#ifdef ARDUINO_ARCH_RP2040
|
|
|
|
#ifndef KNX_FLASH_OFFSET
|
|
#define KNX_FLASH_OFFSET 0x180000 // 1.5MiB
|
|
#pragma warning "KNX_FLASH_OFFSET not defined, using 0x180000"
|
|
#endif
|
|
|
|
#ifdef USE_RP2040_LARGE_EEPROM_EMULATION
|
|
#define USE_RP2040_EEPROM_EMULATION
|
|
#endif
|
|
|
|
|
|
class RP2040ArduinoPlatform : public ArduinoPlatform
|
|
{
|
|
public:
|
|
RP2040ArduinoPlatform();
|
|
RP2040ArduinoPlatform( HardwareSerial* s);
|
|
|
|
void setupUart();
|
|
|
|
// unique serial number
|
|
uint32_t uniqueSerialNumber() override;
|
|
|
|
void restart();
|
|
|
|
#ifdef USE_RP2040_EEPROM_EMULATION
|
|
uint8_t* getEepromBuffer(uint16_t size);
|
|
void commitToEeprom();
|
|
|
|
#ifdef USE_RP2040_LARGE_EEPROM_EMULATION
|
|
uint8_t _rambuff[KNX_FLASH_SIZE];
|
|
bool _rambuff_initialized = false;
|
|
#endif
|
|
#else
|
|
|
|
// size of one EraseBlock in pages
|
|
virtual size_t flashEraseBlockSize();
|
|
// size of one flash page in bytes
|
|
virtual size_t flashPageSize();
|
|
// start of user flash aligned to start of an erase block
|
|
virtual uint8_t* userFlashStart();
|
|
// size of the user flash in EraseBlocks
|
|
virtual size_t userFlashSizeEraseBlocks();
|
|
//relativ to userFlashStart
|
|
virtual void flashErase(uint16_t eraseBlockNum);
|
|
//write a single page to flash (pageNumber relative to userFashStart
|
|
virtual void flashWritePage(uint16_t pageNumber, uint8_t* data);
|
|
|
|
// writes _eraseblockBuffer to flash - overrides Plattform::writeBufferedEraseBlock() for performance optimization only
|
|
void writeBufferedEraseBlock();
|
|
#endif
|
|
};
|
|
|
|
#endif
|