22 .name =
"SPI Buttons 1" ,
34 .name =
"SPI Buttons 2" ,
96 if(newPin !=
nullptr){
104 this->
conf.cutRight =
true;
105 this->
spiConfig.peripheral.FirstBit = SPI_FIRSTBIT_LSB;
106 this->
spiConfig.peripheral.CLKPhase = SPI_PHASE_1EDGE;
107 this->
spiConfig.peripheral.CLKPolarity = SPI_POLARITY_LOW;
110 this->
conf.cutRight =
false;
111 this->
spiConfig.peripheral.FirstBit = SPI_FIRSTBIT_LSB;
112 this->
spiConfig.peripheral.CLKPhase = SPI_PHASE_2EDGE;
113 this->
spiConfig.peripheral.CLKPolarity = SPI_POLARITY_HIGH;
118 mask = 0xffffffffffffffff;
140 this->
conf.spi_speed = speedPreset;
161 if(this->
conf.cutRight){
164 *buf = *buf & this->
mask;
174 memcpy(buf,this->spi_buf,std::min<uint8_t>(this->bytes,8));
177 if(spiPort.isTaken() || !ready)
181 spiPort.receive_DMA(spi_buf, bytes,
this);
188 for(uint8_t i = 0; i<names.size();i++){
189 reply+= names[i] +
":" + std::to_string(i)+
"\n";
225 replies.emplace_back(this->
getConfig()->cutRight ? 1 : 0);
234 replies.emplace_back((uint8_t)this->
conf.mode);
246 replies.emplace_back((uint8_t)this->
conf.spi_speed);
270 c.
invert = (config_int >> 6) & 0x1;
271 c.
cutRight = (config_int >> 7) & 0x1;
273 c.
cs_num = (config_int_2 & 0x3);
281 val |= (uint16_t)c->
mode << 8;
285 return { val,
val2 };
void registerCommand(const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
virtual void setCommandsEnabled(bool enable)
static CommandStatus handleGetSet(const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value)
CommandHandler(const char *clsname, uint16_t clsid, uint8_t instance=0)
SPIDevice(SPIPort &port, OutputPin csPin)
TVal Flash_ReadDefault(uint16_t adr, TVal def)
bool Flash_Write(uint16_t adr, uint16_t dat)
static void * memcpy(void *dst, const void *src, size_t n)