Apply pointer formatting

This commit is contained in:
Scott Lahteine 2021-03-29 20:36:37 -05:00
parent 71e789943e
commit 3b73b115ca
102 changed files with 364 additions and 364 deletions

View File

@ -88,7 +88,7 @@ void spiBegin() {
}
/** SPI read data */
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte-- == 0) return;
SPDR = 0xFF;
for (uint16_t i = 0; i < nbyte; i++) {
@ -107,7 +107,7 @@ void spiBegin() {
}
/** SPI send block */
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
@ -215,7 +215,7 @@ void spiBegin() {
}
// Soft SPI read data
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
buf[i] = spiRec();
}
@ -242,7 +242,7 @@ void spiBegin() {
}
// Soft SPI send block
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiSend(token);
for (uint16_t i = 0; i < 512; i++)
spiSend(buf[i]);

View File

@ -56,8 +56,8 @@
#pragma GCC optimize (3)
typedef uint8_t (*pfnSpiTransfer)(uint8_t b);
typedef void (*pfnSpiRxBlock)(uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiRxBlock)(uint8_t *buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t *buf, uint32_t nbyte);
/* ---------------- Macros to be able to access definitions from asm */
#define _PORT(IO) DIO ## IO ## _WPORT
@ -270,7 +270,7 @@
static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX;
// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
static void spiTxBlock0(const uint8_t *ptr, uint32_t todo) {
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
@ -349,7 +349,7 @@
);
}
static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
static void spiRxBlock0(uint8_t *ptr, uint32_t todo) {
uint32_t bin = 0;
uint32_t work = 0;
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
@ -425,13 +425,13 @@
);
}
static void spiTxBlockX(const uint8_t* buf, uint32_t todo) {
static void spiTxBlockX(const uint8_t *buf, uint32_t todo) {
do {
(void)spiTransferTx(*buf++);
} while (--todo);
}
static void spiRxBlockX(uint8_t* buf, uint32_t todo) {
static void spiRxBlockX(uint8_t *buf, uint32_t todo) {
do {
*buf++ = spiTransferRx(0xFF);
} while (--todo);
@ -463,7 +463,7 @@
return b;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte) {
_SS_WRITE(LOW);
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
@ -478,7 +478,7 @@
_SS_WRITE(HIGH);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
_SS_WRITE(LOW);
(void)spiTransferTx(token);
spiTxBlock(buf, 512);
@ -645,7 +645,7 @@
}
// Read from SPI into buffer
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (!nbyte) return;
--nbyte;
for (int i = 0; i < nbyte; i++) {
@ -668,7 +668,7 @@
//DELAY_US(1U);
}
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
@ -689,7 +689,7 @@
FLUSH_RX();
}
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
@ -702,7 +702,7 @@
}
// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN);
WHILE_TX(0);
//WHILE_RX(0);
@ -801,19 +801,19 @@
uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); }
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (int i = 0; i < nbyte; i++)
buf[i] = spiTransfer(0xFF);
}
void spiSend(uint8_t data) { spiTransfer(data); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
spiTransfer(buf[i]);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
spiTransfer(buf[i]);

View File

@ -139,7 +139,7 @@ static void ee_Dump(const int page, const void* data) {
#ifdef EE_EMU_DEBUG
const uint8_t* c = (const uint8_t*) data;
const uint8_t *c = (const uint8_t*) data;
char buffer[80];
sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
@ -293,8 +293,8 @@ static bool ee_PageWrite(uint16_t page, const void* data) {
ee_Dump(-page, data);
// Calculate count of changed bits
uint32_t* p1 = (uint32_t*)addrflash;
uint32_t* p2 = (uint32_t*)data;
uint32_t *p1 = (uint32_t*)addrflash;
uint32_t *p2 = (uint32_t*)data;
int count = 0;
for (i =0; i<PageSize >> 2; i++) {
if (p1[i] != p2[i]) {
@ -470,7 +470,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@ -550,7 +550,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@ -589,7 +589,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
}
static bool ee_IsPageClean(int page) {
uint32_t* pflash = (uint32_t*) getFlashStorage(page);
uint32_t *pflash = (uint32_t*) getFlashStorage(page);
for (uint16_t i = 0; i < (PageSize >> 2); ++i)
if (*pflash++ != 0xFFFFFFFF) return false;
return true;
@ -599,7 +599,7 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
// Check if RAM buffer has something to be written
bool isEmpty = true;
uint32_t* p = (uint32_t*) &buffer[0];
uint32_t *p = (uint32_t*) &buffer[0];
for (uint16_t j = 0; j < (PageSize >> 2); j++) {
if (*p++ != 0xFFFFFFFF) {
isEmpty = false;

View File

@ -675,11 +675,11 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s
* - \code // Waits and gets a value on CDC line
int udi_cdc_getc(void);
// Reads a RAM buffer on CDC line
iram_size_t udi_cdc_read_buf(int* buf, iram_size_t size);
iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size);
// Puts a byte on CDC line
int udi_cdc_putc(int value);
// Writes a RAM buffer on CDC line
iram_size_t udi_cdc_write_buf(const int* buf, iram_size_t size); \endcode
iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode
*
* \section udi_cdc_use_cases Advanced use cases
* For more advanced use of the UDI CDC module, see the following use cases:

View File

@ -264,7 +264,7 @@ bool usb_task_extra_string(void) {
** Handle device requests that the ASF stack doesn't
*/
bool usb_task_other_requests(void) {
uint8_t* ptr = 0;
uint8_t *ptr = 0;
uint16_t size = 0;
if (Udd_setup_type() == USB_REQ_TYPE_VENDOR) {

View File

@ -85,7 +85,7 @@ uint8_t spiRec() {
return returnByte;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transferBytes(0, buf, nbyte);
SPI.endTransaction();
@ -97,7 +97,7 @@ void spiSend(uint8_t b) {
SPI.endTransaction();
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPI.transfer(token);
SPI.writeBytes(const_cast<uint8_t*>(buf), 512);

View File

@ -137,7 +137,7 @@ size_t WebSocketSerial::write(const uint8_t c) {
return ret;
}
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t WebSocketSerial::write(const uint8_t *buffer, size_t size) {
size_t written = 0;
for (size_t i = 0; i < size; i++)
written += write(buffer[i]);

View File

@ -54,7 +54,7 @@ public:
ring_buffer_pos_t read(uint8_t *buffer);
void flush();
ring_buffer_pos_t write(const uint8_t c);
ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size);
ring_buffer_pos_t write(const uint8_t *buffer, ring_buffer_pos_t size);
};
class WebSocketSerial: public Stream {
@ -70,7 +70,7 @@ public:
int read();
void flush();
size_t write(const uint8_t c);
size_t write(const uint8_t* buffer, size_t size);
size_t write(const uint8_t *buffer, size_t size);
#if ENABLED(SERIAL_STATS_DROPPED_RX)
FORCE_INLINE uint32_t dropped() { return 0; }

View File

@ -93,12 +93,12 @@
void spiSend(uint8_t b) { (void)spiTransfer(b); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
(void)spiTransfer(buf[i]);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
@ -135,13 +135,13 @@
void spiSend(uint8_t b) { doio(b); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
}
void spiSend(uint32_t chan, byte b) {}
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {}
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {}
// Read single byte from SPI
uint8_t spiRec() { return doio(0xFF); }
@ -156,7 +156,7 @@
uint8_t spiTransfer(uint8_t b) { return doio(b); }
// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);

View File

@ -66,7 +66,7 @@
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
void spiSend(const uint8_t *buf, size_t n);
static uint8_t rs_last_state = 255;

View File

@ -103,7 +103,7 @@
* @param nbyte Number of bytes to receive.
* @return Nothing
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
sdSPI.beginTransaction(spiConfig);
@ -132,7 +132,7 @@
*
* @details Uses DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
sdSPI.beginTransaction(spiConfig);
sdSPI.transfer(token);
sdSPI.transfer((uint8_t*)buf, nullptr, 512);

View File

@ -193,7 +193,7 @@ static SPISettings spiConfig;
*
* @details Uses DMA
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
SPI.transfer(buf, nbyte);
@ -218,7 +218,7 @@ static SPISettings spiConfig;
*
* @details Use DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
uint8_t rxBuf[512];
SPI.transfer(token);
SPI.transfer((uint8_t*)buf, &rxBuf, 512);

View File

@ -36,7 +36,7 @@ struct MarlinSerial : public HardwareSerial {
void begin(unsigned long baud, uint8_t config);
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void _rx_complete_irq(serial_t* obj);
void _rx_complete_irq(serial_t *obj);
protected:
usart_rx_callback_t _rx_callback;

View File

@ -123,7 +123,7 @@ uint8_t spiRec() {
*
* @details Uses DMA
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
}
@ -146,7 +146,7 @@ void spiSend(uint8_t b) {
*
* @details Use DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.send(token);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
}
@ -160,7 +160,7 @@ uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n) {
void spiSend(uint32_t chan, const uint8_t *buf, size_t n) {
for (size_t p = 0; p < n; p++) spiSend(chan, buf[p]);
}

View File

@ -48,8 +48,8 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false;
bool PersistentStore::access_start() {
const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
const uint32_t *source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t *destination = reinterpret_cast<uint32_t*>(ram_eeprom);
static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4;

View File

@ -82,7 +82,7 @@ uint8_t spiRec() {
}
// SPI read data
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transfer(buf, nbyte);
SPI.endTransaction();
@ -107,7 +107,7 @@ void spiSend(uint8_t b) {
}
// SPI send block
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {

View File

@ -80,7 +80,7 @@ uint8_t spiRec() {
//return SPDR;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transfer(buf, nbyte);
SPI.endTransaction();
@ -103,7 +103,7 @@ void spiSend(uint8_t b) {
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {

View File

@ -97,7 +97,7 @@ uint8_t spiRec() {
//return SPDR;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transfer(buf, nbyte);
SPI.endTransaction();
@ -120,7 +120,7 @@ void spiSend(uint8_t b) {
//while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {

View File

@ -42,7 +42,7 @@ struct MinSerial {
HAL_min_serial_out(ch);
}
// Send String through UART
static void TX(const char* s) { while (*s) TX(*s++); }
static void TX(const char *s) { while (*s) TX(*s++); }
// Send a digit through UART
static void TXDigit(uint32_t d) {
if (d < 10) TX((char)(d+'0'));

View File

@ -71,10 +71,10 @@ void spiSend(uint8_t b);
uint8_t spiRec();
// Read from SPI into buffer
void spiRead(uint8_t* buf, uint16_t nbyte);
void spiRead(uint8_t *buf, uint16_t nbyte);
// Write token and then write from 512 byte buffer to SPI (for SD card)
void spiSendBlock(uint8_t token, const uint8_t* buf);
void spiSendBlock(uint8_t token, const uint8_t *buf);
// Begin SPI transaction, set clock, bit order, data mode
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode);
@ -87,7 +87,7 @@ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode);
void spiSend(uint32_t chan, byte b);
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
void spiSend(uint32_t chan, const uint8_t *buf, size_t n);
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);

View File

@ -44,7 +44,7 @@ static bool UnwReportOut(void* ctx, const UnwReport* bte) {
}
#ifdef UNW_DEBUG
void UnwPrintf(const char* format, ...) {
void UnwPrintf(const char *format, ...) {
char dest[256];
va_list argptr;
va_start(argptr, format);

View File

@ -45,11 +45,11 @@ public:
// Read one or more bytes of data and update the CRC
// Return 'true' on read error
static bool read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing=true);
static bool read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing=true);
// Write one or more bytes of data
// Return 'true' on write error
static inline bool write_data(const int pos, const uint8_t* value, const size_t size=sizeof(uint8_t)) {
static inline bool write_data(const int pos, const uint8_t *value, const size_t size=sizeof(uint8_t)) {
int data_pos = pos;
uint16_t crc = 0;
return write_data(data_pos, value, size, &crc);
@ -61,7 +61,7 @@ public:
// Read one or more bytes of data
// Return 'true' on read error
static inline bool read_data(const int pos, uint8_t* value, const size_t size=1) {
static inline bool read_data(const int pos, uint8_t *value, const size_t size=1) {
int data_pos = pos;
uint16_t crc = 0;
return read_data(data_pos, value, size, &crc);

View File

@ -55,7 +55,7 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) {
// Leave the Bus in-use
}
uint8_t eeprom_read_byte(uint8_t* pos) {
uint8_t eeprom_read_byte(uint8_t *pos) {
_eeprom_begin(pos, CMD_READ); // Set read location and begin transmission
const uint8_t v = spiRec(SPI_CHAN_EEPROM1); // After READ a value sits on the Bus

View File

@ -362,13 +362,13 @@
return *str == '/' ? true : (*str ? containsSlash(str + 1) : false);
}
// Find the last position of the slash
constexpr const char* findLastSlashPos(const char* str) {
constexpr const char* findLastSlashPos(const char *str) {
return *str == '/' ? (str + 1) : findLastSlashPos(str - 1);
}
// Compile-time evaluation of the last part of a file path
// Typically used to shorten the path to file in compiled strings
// CompileTimeString::baseName(__FILE__) returns "macros.h" and not /path/to/Marlin/src/core/macros.h
constexpr const char* baseName(const char* str) {
constexpr const char* baseName(const char *str) {
return containsSlash(str) ? findLastSlashPos(findStringEnd(str)) : str;
}
}

View File

@ -108,9 +108,9 @@ struct SerialBase {
void flushTX() { CALL_IF_EXISTS(void, static_cast<Child*>(this), flushTX); }
// Glue code here
FORCE_INLINE void write(const char* str) { while (*str) write(*str++); }
FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
FORCE_INLINE void print(const char* str) { write(str); }
FORCE_INLINE void write(const char *str) { while (*str) write(*str++); }
FORCE_INLINE void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
FORCE_INLINE void print(const char *str) { write(str); }
// No default argument to avoid ambiguity
NO_INLINE void print(char c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
NO_INLINE void print(unsigned char c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }

View File

@ -51,10 +51,10 @@ class SDFileTransferProtocol {
private:
struct Packet {
struct [[gnu::packed]] Open {
static bool validate(char* buffer, size_t length) {
static bool validate(char *buffer, size_t length) {
return (length > sizeof(Open) && buffer[length - 1] == '\0');
}
static Open& decode(char* buffer) {
static Open& decode(char *buffer) {
data = &buffer[2];
return *reinterpret_cast<Open*>(buffer);
}
@ -67,7 +67,7 @@ private:
};
};
static bool file_open(char* filename) {
static bool file_open(char *filename) {
if (!dummy_transfer) {
card.mount();
card.openFileWrite(filename);
@ -79,7 +79,7 @@ private:
return true;
}
static bool file_write(char* buffer, const size_t length) {
static bool file_write(char *buffer, const size_t length) {
#if ENABLED(BINARY_STREAM_COMPRESSION)
if (compression) {
size_t total_processed = 0, processed_count = 0;
@ -150,7 +150,7 @@ public:
}
}
static void process(uint8_t packet_type, char* buffer, const uint16_t length) {
static void process(uint8_t packet_type, char *buffer, const uint16_t length) {
transfer_timeout = millis() + TIMEOUT;
switch (static_cast<FileTransfer>(packet_type)) {
case FileTransfer::QUERY:

View File

@ -205,7 +205,7 @@ void MeatPack::handle_rx_char(const uint8_t c, const serial_index_t serial_ind)
handle_rx_char_inner(c); // Other characters are passed on for MeatPack decoding
}
uint8_t MeatPack::get_result_char(char* const __restrict out) {
uint8_t MeatPack::get_result_char(char * const __restrict out) {
uint8_t res = 0;
if (char_out_count) {
res = char_out_count;

View File

@ -109,7 +109,7 @@ public:
* @param out [in] Output pointer for unpacked/processed data.
* @return Number of characters returned. Range from 0 to 2.
*/
uint8_t get_result_char(char* const __restrict out);
uint8_t get_result_char(char * const __restrict out);
void reset_state();
void report_state();

View File

@ -362,7 +362,7 @@ bool MMU2::rx_start() {
/**
* Check if the data received ends with the given string.
*/
bool MMU2::rx_str_P(const char* str) {
bool MMU2::rx_str_P(const char *str) {
uint8_t i = strlen(rx_buffer);
while (MMU2_SERIAL.available()) {
@ -394,7 +394,7 @@ bool MMU2::rx_str_P(const char* str) {
/**
* Transfer data to MMU, no argument
*/
void MMU2::tx_str_P(const char* str) {
void MMU2::tx_str_P(const char *str) {
clear_rx_buffer();
uint8_t len = strlen_P(str);
LOOP_L_N(i, len) MMU2_SERIAL.write(pgm_read_byte(str++));
@ -404,7 +404,7 @@ void MMU2::tx_str_P(const char* str) {
/**
* Transfer data to MMU, single argument
*/
void MMU2::tx_printf_P(const char* format, int argument = -1) {
void MMU2::tx_printf_P(const char *format, int argument = -1) {
clear_rx_buffer();
uint8_t len = sprintf_P(tx_buffer, format, argument);
LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
@ -414,7 +414,7 @@ void MMU2::tx_printf_P(const char* format, int argument = -1) {
/**
* Transfer data to MMU, two arguments
*/
void MMU2::tx_printf_P(const char* format, int argument1, int argument2) {
void MMU2::tx_printf_P(const char *format, int argument1, int argument2) {
clear_rx_buffer();
uint8_t len = sprintf_P(tx_buffer, format, argument1, argument2);
LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]);
@ -511,7 +511,7 @@ static void mmu2_not_responding() {
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
void MMU2::tool_change(const char *special) {
if (!enabled) return;
set_runout_valid(false);
@ -598,7 +598,7 @@ static void mmu2_not_responding() {
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
void MMU2::tool_change(const char *special) {
if (!enabled) return;
set_runout_valid(false);
@ -692,7 +692,7 @@ static void mmu2_not_responding() {
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
void MMU2::tool_change(const char *special) {
if (!enabled) return;
set_runout_valid(false);

View File

@ -45,7 +45,7 @@ public:
static void reset();
static void mmu_loop();
static void tool_change(const uint8_t index);
static void tool_change(const char* special);
static void tool_change(const char *special);
static uint8_t get_current_tool();
static void set_filament_type(const uint8_t index, const uint8_t type);
@ -56,10 +56,10 @@ public:
static bool eject_filament(const uint8_t index, const bool recover);
private:
static bool rx_str_P(const char* str);
static void tx_str_P(const char* str);
static void tx_printf_P(const char* format, const int argument);
static void tx_printf_P(const char* format, const int argument1, const int argument2);
static bool rx_str_P(const char *str);
static void tx_str_P(const char *str);
static void tx_printf_P(const char *format, const int argument);
static void tx_printf_P(const char *format, const int argument1, const int argument2);
static void clear_rx_buffer();
static bool rx_ok();

View File

@ -106,7 +106,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Handle a block completion. RunoutResponseDelayed uses this to
// add up the length of filament moved while the filament is out.
static inline void block_completed(const block_t* const b) {
static inline void block_completed(const block_t * const b) {
if (enabled) {
response.block_completed(b);
sensor.block_completed(b);
@ -273,7 +273,7 @@ class FilamentSensorBase {
}
public:
static inline void block_completed(const block_t* const b) {
static inline void block_completed(const block_t * const b) {
// If the sensor wheel has moved since the last call to
// this method reset the runout counter for the extruder.
if (TEST(motion_detected, b->extruder))
@ -307,7 +307,7 @@ class FilamentSensorBase {
}
public:
static inline void block_completed(const block_t* const) {}
static inline void block_completed(const block_t * const) {}
static inline void run() {
LOOP_L_N(s, NUM_RUNOUT_SENSORS) {
@ -368,7 +368,7 @@ class FilamentSensorBase {
runout_mm_countdown[extruder] = runout_distance_mm;
}
static inline void block_completed(const block_t* const b) {
static inline void block_completed(const block_t * const b) {
if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
const uint8_t e = b->extruder;
@ -403,7 +403,7 @@ class FilamentSensorBase {
return runout_flags;
}
static inline void block_completed(const block_t* const) { }
static inline void block_completed(const block_t * const) { }
static inline void filament_present(const uint8_t extruder) {
runout_count[extruder] = runout_threshold;

View File

@ -99,7 +99,7 @@ void GCodeQueue::RingBuffer::commit_command(bool skip_ok
* Return true if the command was successfully added.
* Return false for a full buffer, or if the 'command' is a comment.
*/
bool GCodeQueue::RingBuffer::enqueue(const char* cmd, bool skip_ok/*=true*/
bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/
#if HAS_MULTI_SERIAL
, serial_index_t serial_ind/*=-1*/
#endif
@ -118,7 +118,7 @@ bool GCodeQueue::RingBuffer::enqueue(const char* cmd, bool skip_ok/*=true*/
* Enqueue with Serial Echo
* Return true if the command was consumed
*/
bool GCodeQueue::enqueue_one(const char* cmd) {
bool GCodeQueue::enqueue_one(const char *cmd) {
//SERIAL_ECHOLNPAIR("enqueue_one(\"", cmd, "\")");
if (*cmd == 0 || ISEOL(*cmd)) return true;
@ -187,7 +187,7 @@ bool GCodeQueue::process_injected_command() {
* Enqueue and return only when commands are actually enqueued.
* Never call this from a G-code handler!
*/
void GCodeQueue::enqueue_one_now(const char* cmd) { while (!enqueue_one(cmd)) idle(); }
void GCodeQueue::enqueue_one_now(const char *cmd) { while (!enqueue_one(cmd)) idle(); }
/**
* Attempt to enqueue a single G-code command

View File

@ -85,7 +85,7 @@ public:
#endif
);
bool enqueue(const char* cmd, bool skip_ok = true
bool enqueue(const char *cmd, bool skip_ok = true
#if HAS_MULTI_SERIAL
, serial_index_t serial_ind = serial_index_t()
#endif
@ -143,7 +143,7 @@ public:
/**
* Enqueue and return only when commands are actually enqueued
*/
static void enqueue_one_now(const char* cmd);
static void enqueue_one_now(const char *cmd);
/**
* Attempt to enqueue a single G-code command
@ -219,7 +219,7 @@ private:
* Enqueue with Serial Echo
* Return true on success
*/
static bool enqueue_one(const char* cmd);
static bool enqueue_one(const char *cmd);
static void gcode_line_error(PGM_P const err, const serial_index_t serial_ind);

View File

@ -1076,7 +1076,7 @@ void MarlinUI::draw_status_screen() {
}
// Draw a menu item with a (potentially) editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const inStr, const bool pgm) {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm) {
const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
uint8_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen);
@ -1088,7 +1088,7 @@ void MarlinUI::draw_status_screen() {
}
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
ui.encoder_direction_normal();
uint8_t n = lcd_put_u8str_ind_P(0, 1, pstr, itemIndex, itemString, LCD_WIDTH - 1);
if (value) {

View File

@ -835,7 +835,7 @@ void MarlinUI::draw_status_screen() {
}
// Draw a menu item with a (potentially) editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const data, const bool pgm) {
if (!PanelDetected) return;
const uint8_t vlen = data ? (pgm ? utf8_strlen_P(data) : utf8_strlen(data)) : 0;
lcd.setCursor(0, row);
@ -851,7 +851,7 @@ void MarlinUI::draw_status_screen() {
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
// This line moves to the last line of the screen for UBL plot screen on the panel side
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
if (!PanelDetected) return;
ui.encoder_direction_normal();
const uint8_t y = TERN0(AUTO_BED_LEVELING_UBL, ui.external_control) ? LCD_HEIGHT - 1 : MIDDLE_Y;

View File

@ -385,7 +385,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
// Draw a menu item with an editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const inStr, const bool pgm) {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm) {
if (mark_as_selected(row, sel)) {
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen((char*)inStr)),
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), (char*)inStr));
@ -400,7 +400,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
}
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
ui.encoder_direction_normal();
const u8g_uint_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);

View File

@ -311,7 +311,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
// Used to fill RGB565 (16bits) background
inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
uint16_t* wptr = (uint16_t*)ptr;
uint16_t *wptr = (uint16_t*)ptr;
for (size_t i = 0; i < cnt; i += 2) { *wptr = fill; wptr++; }
}
@ -346,7 +346,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
#if HAS_LCD_IO
static uint16_t bufferA[WIDTH * sq(GRAPHICAL_TFT_UPSCALE)], bufferB[WIDTH * sq(GRAPHICAL_TFT_UPSCALE)];
uint16_t* buffer = &bufferA[0];
uint16_t *buffer = &bufferA[0];
#else
uint16_t buffer[WIDTH * GRAPHICAL_TFT_UPSCALE]; // 16-bit RGB 565 pixel line buffer
#endif
@ -404,7 +404,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
tftio.WriteSequence(buffer, COUNT(bufferA));
#else
uint8_t* bufptr = (uint8_t*) buffer;
uint8_t *bufptr = (uint8_t*) buffer;
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) {
LOOP_S_L_N(n, 0, GRAPHICAL_TFT_UPSCALE * 2) {
u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH * n]);

View File

@ -148,8 +148,8 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
uint8_t* ptr;
u8g_pb_t* pb = (u8g_pb_t*)(dev->dev_mem);
uint8_t *ptr;
u8g_pb_t *pb = (u8g_pb_t*)(dev->dev_mem);
y = pb->p.page_y0;
ptr = (uint8_t*)pb->buf;

View File

@ -62,7 +62,7 @@ void (*DGUSScreenHandler::confirm_action_cb)() = nullptr;
filament_data_t filament_data;
#endif
void DGUSScreenHandler::sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) {
void DGUSScreenHandler::sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) {
DGUS_VP_Variable ramcopy;
if (populate_VPVar(VP_MSGSTR1, &ramcopy)) {
ramcopy.memadr = (void*) line1;
@ -82,7 +82,7 @@ void DGUSScreenHandler::sendinfoscreen(const char* line1, const char* line2, con
}
}
void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1, bool l2, bool l3, bool l4) {
void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1, bool l2, bool l3, bool l4) {
if (current_screen == DGUSLCD_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first.
PopToOldScreen();

View File

@ -37,12 +37,12 @@ public:
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
// The bools specifing whether the strings are in RAM or FLASH.
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
// "M117" Message -- msg is a RAM ptr.
static void setstatusmessage(const char* msg);
static void setstatusmessage(const char *msg);
// The same for messages from Flash
static void setstatusmessagePGM(PGM_P const msg);
// Callback for VP "Display wants to change screen on idle printer"

View File

@ -37,12 +37,12 @@ public:
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
// The bools specifing whether the strings are in RAM or FLASH.
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
// "M117" Message -- msg is a RAM ptr.
static void setstatusmessage(const char* msg);
static void setstatusmessage(const char *msg);
// The same for messages from Flash
static void setstatusmessagePGM(PGM_P const msg);
// Callback for VP "Display wants to change screen on idle printer"

View File

@ -61,14 +61,14 @@ uint8_t DGUSLanguageSwitch = 0; // Switch language for MKS DGUS
uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
#if 0
void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) {
void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) {
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
dgusdisplay.WriteVariable(VP_MSGSTR3, line3, 32, true);
dgusdisplay.WriteVariable(VP_MSGSTR4, line4, 32, true);
}
void DGUSScreenHandler::sendinfoscreen_en_mks(const char* line1, const char* line2, const char* line3, const char* line4) {
void DGUSScreenHandler::sendinfoscreen_en_mks(const char *line1, const char *line2, const char *line3, const char *line4) {
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
dgusdisplay.WriteVariable(VP_MSGSTR3, line3, 32, true);

View File

@ -37,18 +37,18 @@ public:
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
// The bools specifing whether the strings are in RAM or FLASH.
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
#if 0
static void sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4);
static void sendinfoscreen_en_mks(const char* line1, const char* line2, const char* line3, const char* line4) ;
static void sendinfoscreen_ch_mks(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4);
static void sendinfoscreen_en_mks(const char *line1, const char *line2, const char *line3, const char *line4) ;
static void sendinfoscreen_mks(const void* line1, const void* line2, const void* line3, const void* line4,uint16_t language);
#endif
// "M117" Message -- msg is a RAM ptr.
static void setstatusmessage(const char* msg);
static void setstatusmessage(const char *msg);
// The same for messages from Flash
static void setstatusmessagePGM(PGM_P const msg);
// Callback for VP "Display wants to change screen on idle printer"

View File

@ -37,12 +37,12 @@ public:
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
// The bools specifing whether the strings are in RAM or FLASH.
static void sendinfoscreen(const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char* line1, const char* line2, const char* line3, const char* line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
// "M117" Message -- msg is a RAM ptr.
static void setstatusmessage(const char* msg);
static void setstatusmessage(const char *msg);
// The same for messages from Flash
static void setstatusmessagePGM(PGM_P const msg);
// Callback for VP "Display wants to change screen on idle printer"

View File

@ -26,7 +26,7 @@
#include "media_file_reader.h"
#if ENABLED(SDSUPPORT)
bool MediaFileReader::open(const char* filename) {
bool MediaFileReader::open(const char *filename) {
card.init(SD_SPI_SPEED, SDSS);
volume.init(&card);
root.openRoot(&volume);

View File

@ -38,7 +38,7 @@ class MediaFileReader {
#endif
public:
bool open(const char* filename);
bool open(const char *filename);
int16_t read(void *buff, size_t bytes);
uint32_t size();
void rewind();

View File

@ -103,12 +103,12 @@ namespace FTDI {
#endif
void SPI::spi_read_bulk(void *data, uint16_t len) {
uint8_t* p = (uint8_t *)data;
uint8_t *p = (uint8_t *)data;
while (len--) *p++ = spi_recv();
}
bool SPI::spi_verify_bulk(const void *data, uint16_t len) {
const uint8_t* p = (const uint8_t *)data;
const uint8_t *p = (const uint8_t *)data;
while (len--) if (*p++ != spi_recv()) return false;
return true;
}

View File

@ -116,14 +116,14 @@ namespace FTDI {
template<bulk_write_op byte_op>
void spi_write_bulk(const void *data, uint16_t len, uint8_t padding) {
const uint8_t* p = (const uint8_t *)data;
const uint8_t *p = (const uint8_t *)data;
while (len--) spi_send(byte_op(p++));
while (padding--) spi_send(0);
}
template<bulk_write_op byte_op>
void spi_write_bulk(const void *data, uint16_t len) {
const uint8_t* p = (const uint8_t *)data;
const uint8_t *p = (const uint8_t *)data;
while (len--) spi_send(byte_op(p++));
}

View File

@ -24,7 +24,7 @@
class SoundList {
private:
static PROGMEM const struct list_t {
const char *const PROGMEM name;
const char * const PROGMEM name;
const FTDI::SoundPlayer::sound_t* data;
} list[];
public:

View File

@ -62,7 +62,7 @@ namespace FTDI {
timer.start();
}
void SoundPlayer::play(const sound_t* seq, play_mode_t mode) {
void SoundPlayer::play(const sound_t *seq, play_mode_t mode) {
sequence = seq;
wait = 250; // Adding this delay causes the note to not be clipped, not sure why.
timer.start();

View File

@ -55,7 +55,7 @@ namespace FTDI {
static void play(effect_t effect, note_t note = NOTE_C4);
static bool is_sound_playing();
void play(const sound_t* seq, play_mode_t mode = PLAY_SYNCHRONOUS);
void play(const sound_t *seq, play_mode_t mode = PLAY_SYNCHRONOUS);
void play_tone(const uint16_t frequency_hz, const uint16_t duration_ms);
bool has_more_notes() {return sequence != 0;};

View File

@ -47,7 +47,7 @@ namespace FTDI {
break;
}
#else
for (char* c = str; *c; c++) {
for (char *c = str; *c; c++) {
lineWidth += fm.get_char_width(*c);
if (lineWidth + ellipsisWidth < w)
breakPoint = c;

View File

@ -71,7 +71,7 @@ namespace ExtUI {
AlertDialogBox::showError(F("Unable to read media."));
}
void onStatusChanged(const char* lcd_msg) {
void onStatusChanged(const char *lcd_msg) {
StatusScreen::setStatusMessage(lcd_msg);
}

View File

@ -34,7 +34,7 @@ using namespace Theme;
#define GRID_COLS 2
#define GRID_ROWS 9
void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char* message) {
void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *message) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(COLOR_RGB(bg_text_enabled))
@ -113,7 +113,7 @@ void BioPrintingDialogBox::setStatusMessage(progmem_str message) {
setStatusMessage(buff);
}
void BioPrintingDialogBox::setStatusMessage(const char* message) {
void BioPrintingDialogBox::setStatusMessage(const char *message) {
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(bg_color))

View File

@ -56,7 +56,7 @@ void ConfirmUserRequestAlertBox::onIdle() {
}
}
void ConfirmUserRequestAlertBox::show(const char* msg) {
void ConfirmUserRequestAlertBox::show(const char *msg) {
drawMessage(msg);
storeBackground();
screen_data.AlertDialogBox.isError = false;

View File

@ -76,7 +76,7 @@ uint16_t FilesScreen::getFileForTag(uint8_t tag) {
#define GRID_ROWS (files_per_page + header_h + footer_h)
#endif
void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted) {
void FilesScreen::drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted) {
const uint8_t line = getLineForTag(tag)+1;
CommandProcessor cmd;
cmd.tag(tag);

View File

@ -60,7 +60,7 @@ class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, F
inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);}
static const char *getSelectedFilename(bool longName);
static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
static void drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted);
static void drawFileList();
static void drawHeader();
static void drawFooter();

View File

@ -324,7 +324,7 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
#undef GRID_COLS
}
void StatusScreen::draw_status_message(draw_mode_t what, const char* message) {
void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
#define GRID_COLS 1
#if ENABLED(TOUCH_UI_PORTRAIT)
@ -350,7 +350,7 @@ void StatusScreen::setStatusMessage(progmem_str message) {
setStatusMessage((const char *) buff);
}
void StatusScreen::setStatusMessage(const char* message) {
void StatusScreen::setStatusMessage(const char *message) {
if (CommandProcessor::is_processing()) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_MSG("Cannot update status message, command processor busy");

View File

@ -167,7 +167,7 @@ void SPIFlashStorage::endWrite() {
#endif
}
void SPIFlashStorage::savePage(uint8_t* buffer) {
void SPIFlashStorage::savePage(uint8_t *buffer) {
W25QXX.SPI_FLASH_BufferWrite(buffer, m_startAddress + (SPI_FLASH_PageSize * m_currentPage), SPI_FLASH_PageSize);
// Test env
// char fname[256];
@ -177,7 +177,7 @@ void SPIFlashStorage::savePage(uint8_t* buffer) {
// fclose(fp);
}
void SPIFlashStorage::loadPage(uint8_t* buffer) {
void SPIFlashStorage::loadPage(uint8_t *buffer) {
W25QXX.SPI_FLASH_BufferRead(buffer, m_startAddress + (SPI_FLASH_PageSize * m_currentPage), SPI_FLASH_PageSize);
// Test env
// char fname[256];
@ -256,7 +256,7 @@ void SPIFlashStorage::readPage() {
#endif
}
uint16_t SPIFlashStorage::inData(uint8_t* data, uint16_t size) {
uint16_t SPIFlashStorage::inData(uint8_t *data, uint16_t size) {
// Don't write more than we can
NOMORE(size, pageDataFree());
memcpy(m_pageData + m_pageDataUsed, data, size);
@ -264,7 +264,7 @@ uint16_t SPIFlashStorage::inData(uint8_t* data, uint16_t size) {
return size;
}
void SPIFlashStorage::writeData(uint8_t* data, uint16_t size) {
void SPIFlashStorage::writeData(uint8_t *data, uint16_t size) {
// Flush a page if needed
if (pageDataFree() == 0) flushPage();
@ -289,7 +289,7 @@ void SPIFlashStorage::beginRead(uint32_t startAddress) {
#endif
}
uint16_t SPIFlashStorage::outData(uint8_t* data, uint16_t size) {
uint16_t SPIFlashStorage::outData(uint8_t *data, uint16_t size) {
// Don't read more than we have
NOMORE(size, pageDataFree());
memcpy(data, m_pageData + m_pageDataUsed, size);
@ -297,7 +297,7 @@ uint16_t SPIFlashStorage::outData(uint8_t* data, uint16_t size) {
return size;
}
void SPIFlashStorage::readData(uint8_t* data, uint16_t size) {
void SPIFlashStorage::readData(uint8_t *data, uint16_t size) {
// Read a page if needed
if (pageDataFree() == 0) readPage();

View File

@ -77,21 +77,21 @@ public:
// Write operation
static void beginWrite(uint32_t startAddress);
static void endWrite();
static void writeData(uint8_t* data, uint16_t size);
static void writeData(uint8_t *data, uint16_t size);
// Read operation
static void beginRead(uint32_t startAddress);
static void readData(uint8_t* data, uint16_t size);
static void readData(uint8_t *data, uint16_t size);
static uint32_t getCurrentPage() { return m_currentPage; }
private:
static void flushPage();
static void savePage(uint8_t* buffer);
static void loadPage(uint8_t* buffer);
static void savePage(uint8_t *buffer);
static void loadPage(uint8_t *buffer);
static void readPage();
static uint16_t inData(uint8_t* data, uint16_t size);
static uint16_t outData(uint8_t* data, uint16_t size);
static uint16_t inData(uint8_t *data, uint16_t size);
static uint16_t outData(uint8_t *data, uint16_t size);
static uint8_t m_pageData[SPI_FLASH_PageSize];
static uint32_t m_currentPage;

View File

@ -649,7 +649,7 @@ char *creat_title_text() {
if (gPicturePreviewStart <= 0) {
while (1) {
uint32_t br = card.read(public_buf, 400);
uint32_t* p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
uint32_t *p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
if (p1) {
gPicturePreviewStart += (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
break;
@ -1173,7 +1173,7 @@ void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style) {
}
// Create a screen
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char *title) {
lv_obj_t *scr = lv_obj_create(nullptr, nullptr);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
@ -1348,19 +1348,19 @@ lv_obj_t* lv_screen_menu_item(lv_obj_t *par, const char *text, lv_coord_t x, lv_
}
lv_obj_t* lv_screen_menu_item_1_edit(lv_obj_t *par, const char *text, lv_coord_t x, lv_coord_t y, lv_event_cb_t cb, const int id, const int index, const char *editValue) {
lv_obj_t* btn = lv_screen_menu_item(par, text, x, y, cb, -1, index, false);
lv_obj_t* btnValue = lv_btn_create(par, PARA_UI_VALUE_POS_X, y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, cb, id);
lv_obj_t* labelValue = lv_label_create_empty(btnValue);
lv_obj_t *btn = lv_screen_menu_item(par, text, x, y, cb, -1, index, false);
lv_obj_t *btnValue = lv_btn_create(par, PARA_UI_VALUE_POS_X, y + PARA_UI_VALUE_V, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, cb, id);
lv_obj_t *labelValue = lv_label_create_empty(btnValue);
lv_label_set_text(labelValue, editValue);
lv_obj_align(labelValue, btnValue, LV_ALIGN_CENTER, 0, 0);
return btn;
}
lv_obj_t* lv_screen_menu_item_2_edit(lv_obj_t *par, const char *text, lv_coord_t x, lv_coord_t y, lv_event_cb_t cb, const int id, const int index, const char *editValue, const int idEdit2, const char *editValue2) {
lv_obj_t* btn = lv_screen_menu_item(par, text, x, y, cb, -1, index, false);
lv_obj_t *btn = lv_screen_menu_item(par, text, x, y, cb, -1, index, false);
lv_obj_t* btnValue = lv_btn_create(par, PARA_UI_VALUE_POS_X_2, y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, cb, idEdit2);
lv_obj_t* labelValue = lv_label_create_empty(btnValue);
lv_obj_t *btnValue = lv_btn_create(par, PARA_UI_VALUE_POS_X_2, y + PARA_UI_VALUE_V_2, PARA_UI_VALUE_BTN_X_SIZE, PARA_UI_VALUE_BTN_Y_SIZE, cb, idEdit2);
lv_obj_t *labelValue = lv_label_create_empty(btnValue);
lv_label_set_text(labelValue, editValue2);
lv_obj_align(labelValue, btnValue, LV_ALIGN_CENTER, 0, 0);
@ -1374,8 +1374,8 @@ lv_obj_t* lv_screen_menu_item_2_edit(lv_obj_t *par, const char *text, lv_coord_t
lv_obj_t* lv_screen_menu_item_onoff(lv_obj_t *par, const char *text, lv_coord_t x, lv_coord_t y, lv_event_cb_t cb, const int id, const int index, const bool curValue) {
lv_screen_menu_item(par, text, x, y, cb, -1, index, false);
lv_obj_t* btnValue = lv_imgbtn_create(par, curValue ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, y + PARA_UI_STATE_V, cb, id);
lv_obj_t* labelValue = lv_label_create_empty(btnValue);
lv_obj_t *btnValue = lv_imgbtn_create(par, curValue ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, y + PARA_UI_STATE_V, cb, id);
lv_obj_t *labelValue = lv_label_create_empty(btnValue);
lv_label_set_text(labelValue, curValue ? machine_menu.enable : machine_menu.disable);
lv_obj_align(labelValue, btnValue, LV_ALIGN_CENTER, 0, 0);
return btnValue;

View File

@ -482,7 +482,7 @@ void lv_btn_use_label_style(lv_obj_t *btn);
void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style);
// Create a screen
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title = nullptr);
lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char *title = nullptr);
// Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par);

View File

@ -370,7 +370,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
#if ENABLED(SDSUPPORT)
static void dosName2LongName(const char dosName[11], char* longName) {
static void dosName2LongName(const char dosName[11], char *longName) {
uint8_t j = 0;
LOOP_L_N(i, 11) {
if (i == 8) longName[j++] = '.';
@ -380,7 +380,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
longName[j] = '\0';
}
static int8_t arrayFindStr(const char arr[][LONG_FILENAME_LENGTH], uint8_t arraySize, const char* str) {
static int8_t arrayFindStr(const char arr[][LONG_FILENAME_LENGTH], uint8_t arraySize, const char *str) {
for (uint8_t a = 0; a < arraySize; a++) {
if (strcasecmp(arr[a], str) == 0)
return a;

View File

@ -53,7 +53,7 @@
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
extern uint8_t Explore_Disk (char* path , uint8_t recu_level);
extern uint8_t Explore_Disk (char *path , uint8_t recu_level);
extern uint8_t commands_in_queue;
extern uint8_t sel_id;
@ -566,7 +566,7 @@ static int cut_msg_head(uint8_t *msg, uint16_t msgLen, uint16_t cutLen) {
return msgLen - cutLen;
}
uint8_t Explore_Disk(char* path , uint8_t recu_level) {
uint8_t Explore_Disk(char *path , uint8_t recu_level) {
char tmp[200];
char Fstream[200];

View File

@ -101,14 +101,14 @@ void NextionTFT::PrintFinished() {
SEND_TXT_END("page printfinished");
}
void NextionTFT::ConfirmationRequest(const char *const msg) {
void NextionTFT::ConfirmationRequest(const char * const msg) {
SEND_VALasTXT("tmppage.M117", msg);
#if NEXDEBUG(N_MARLIN)
DEBUG_ECHOLNPAIR("ConfirmationRequest() ", msg, " printer_state:", printer_state);
#endif
}
void NextionTFT::StatusChange(const char *const msg) {
void NextionTFT::StatusChange(const char * const msg) {
#if NEXDEBUG(N_MARLIN)
DEBUG_ECHOLNPAIR("StatusChange() ", msg, "\nprinter_state:", printer_state);
#endif

View File

@ -118,7 +118,7 @@ void set_lcd_error_P(PGM_P const error, PGM_P const component=nullptr) {
*
* the command portion begins after the :
*/
void process_lcd_c_command(const char* command) {
void process_lcd_c_command(const char *command) {
const int target_val = command[1] ? atoi(command + 1) : -1;
if (target_val < 0) {
DEBUG_ECHOLNPAIR("UNKNOWN C COMMAND ", command);
@ -153,7 +153,7 @@ void process_lcd_c_command(const char* command) {
* time remaining (HH:MM:SS). The UI can't handle displaying a second hotend,
* but the stock firmware always sends it, and it's always zero.
*/
void process_lcd_eb_command(const char* command) {
void process_lcd_eb_command(const char *command) {
char elapsed_buffer[10];
static uint8_t iteration = 0;
duration_t elapsed;
@ -203,12 +203,12 @@ void process_lcd_eb_command(const char* command) {
* X, Y, Z, A (extruder)
*/
template<typename T>
void j_move_axis(const char* command, const T axis) {
void j_move_axis(const char *command, const T axis) {
const float dist = atof(command + 1) / 10.0;
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
};
void process_lcd_j_command(const char* command) {
void process_lcd_j_command(const char *command) {
switch (command[0]) {
case 'E': break;
case 'A': j_move_axis<ExtUI::extruder_t>(command, ExtUI::extruder_t::E0); break;
@ -241,7 +241,7 @@ void process_lcd_j_command(const char* command) {
* T:-2537.4 E:0
* Note only the curly brace stuff matters.
*/
void process_lcd_p_command(const char* command) {
void process_lcd_p_command(const char *command) {
switch (command[0]) {
case 'P':
@ -301,7 +301,7 @@ void process_lcd_p_command(const char* command) {
* {FILE:fcupdate.flg}
* {SYS:OK}
*/
void process_lcd_s_command(const char* command) {
void process_lcd_s_command(const char *command) {
switch (command[0]) {
case 'I': {
// temperature information
@ -348,7 +348,7 @@ void process_lcd_s_command(const char* command) {
* Currently {E:0} is not handled. Its function is unknown,
* but it occurs during the temp window after a sys build.
*/
void process_lcd_command(const char* command) {
void process_lcd_command(const char *command) {
const char *current = command;
byte command_code = *current++;

View File

@ -161,7 +161,7 @@ inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row
return lcd_put_u8str_ind_P(pstr, ind, inStr, maxlen);
}
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_u8str(const char *str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, PGM_P const str) {
lcd_moveto(col, row);
return lcd_put_u8str(str);

View File

@ -292,7 +292,7 @@ public:
static bool has_status();
static void reset_status(const bool no_welcome=false);
static void set_status(const char* const message, const bool persist=false);
static void set_status(const char * const message, const bool persist=false);
static void set_status_P(PGM_P const message, const int8_t level=0);
static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
static void set_alert_status_P(PGM_P const message);
@ -300,7 +300,7 @@ public:
#else
static constexpr bool has_status() { return false; }
static inline void reset_status(const bool=false) {}
static void set_status(const char* message, const bool=false);
static void set_status(const char *message, const bool=false);
static void set_status_P(PGM_P message, const int8_t=0);
static void status_printf_P(const uint8_t, PGM_P message, ...);
static inline void set_alert_status_P(PGM_P const) {}

View File

@ -172,14 +172,14 @@ class MenuEditItemBase : public MenuItemBase {
public:
// Implemented for HD44780 and DOGM
// Draw the current item at specified row with edit data
static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const inStr, const bool pgm=false);
static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm=false);
// Implemented for HD44780 and DOGM
// This low-level method is good to draw from anywhere
static void draw_edit_screen(PGM_P const pstr, const char* const value);
static void draw_edit_screen(PGM_P const pstr, const char * const value);
// This method is for the current menu item
static inline void draw_edit_screen(const char* const value) { draw_edit_screen(editLabel, value); }
static inline void draw_edit_screen(const char * const value) { draw_edit_screen(editLabel, value); }
};
#if ENABLED(SDSUPPORT)

View File

@ -326,7 +326,7 @@ void MarlinUI::draw_status_screen() {
}
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
ui.encoder_direction_normal();
TERN_(TOUCH_SCREEN, touch.clear());

View File

@ -326,7 +326,7 @@ void MarlinUI::draw_status_screen() {
}
// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
ui.encoder_direction_normal();
TERN_(TOUCH_SCREEN, touch.clear());
@ -779,7 +779,7 @@ static void disable_steppers() {
queue.inject_P(PSTR("M84"));
}
static void drawBtn(int x, int y, const char* label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
uint16_t width = Images[imgBtn52Rounded].width;
uint16_t height = Images[imgBtn52Rounded].height;

View File

@ -131,7 +131,7 @@ void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, co
}
// Draw a menu item with a (potentially) editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const data, const bool pgm) {
menu_item(row, sel);
tft_string.set(pstr, itemIndex, itemString);

View File

@ -106,7 +106,7 @@ uint8_t W25QXXFlash::spi_flash_read_write_byte(uint8_t data) {
*
* @details Uses DMA
*/
void W25QXXFlash::spi_flash_Read(uint8_t* buf, uint16_t nbyte) {
void W25QXXFlash::spi_flash_Read(uint8_t *buf, uint16_t nbyte) {
mySPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
}
@ -127,7 +127,7 @@ void W25QXXFlash::spi_flash_Send(uint8_t b) { mySPI.transfer(b); }
*
* @details Use DMA
*/
void W25QXXFlash::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
void W25QXXFlash::spi_flash_SendBlock(uint8_t token, const uint8_t *buf) {
mySPI.transfer(token);
mySPI.dmaSend(const_cast<uint8_t*>(buf), 512);
}
@ -257,7 +257,7 @@ void W25QXXFlash::SPI_FLASH_BulkErase(void) {
* Output : None
* Return : None
*******************************************************************************/
void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
// Enable the write access to the FLASH
SPI_FLASH_WriteEnable();
@ -300,7 +300,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint
* Output : None
* Return : None
*******************************************************************************/
void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
uint8_t NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0;
Addr = WriteAddr % SPI_FLASH_PageSize;
@ -364,7 +364,7 @@ void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, ui
* Output : None
* Return : None
*******************************************************************************/
void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
// Select the FLASH: Chip Select low
W25QXX_CS_L;

View File

@ -57,18 +57,18 @@ public:
void init(uint8_t spiRate);
static uint8_t spi_flash_Rec();
static uint8_t spi_flash_read_write_byte(uint8_t data);
static void spi_flash_Read(uint8_t* buf, uint16_t nbyte);
static void spi_flash_Read(uint8_t *buf, uint16_t nbyte);
static void spi_flash_Send(uint8_t b);
static void spi_flash_SendBlock(uint8_t token, const uint8_t* buf);
static void spi_flash_SendBlock(uint8_t token, const uint8_t *buf);
static uint16_t W25QXX_ReadID(void);
static void SPI_FLASH_WriteEnable(void);
static void SPI_FLASH_WaitForWriteEnd(void);
static void SPI_FLASH_SectorErase(uint32_t SectorAddr);
static void SPI_FLASH_BlockErase(uint32_t BlockAddr);
static void SPI_FLASH_BulkErase(void);
static void SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
static void SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
static void SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
};
extern W25QXXFlash W25QXX;

View File

@ -715,7 +715,7 @@ class SoftSPI {
FORCE_INLINE bool MODE_CPHA(uint8_t mode) { return bool(mode & 1); }
FORCE_INLINE bool MODE_CPOL(uint8_t mode) { return bool(mode & 2); }
FORCE_INLINE void receiveBit(uint8_t bit, uint8_t* data) {
FORCE_INLINE void receiveBit(uint8_t bit, uint8_t *data) {
if (MODE_CPHA(Mode)) fastDigitalWrite(SckPin, !MODE_CPOL(Mode));
nop;
nop;
@ -734,7 +734,7 @@ class SoftSPI {
if (!MODE_CPHA(Mode)) fastDigitalWrite(SckPin, MODE_CPOL(Mode));
}
FORCE_INLINE void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) {
FORCE_INLINE void transferBit(uint8_t bit, uint8_t *rxData, uint8_t txData) {
if (MODE_CPHA(Mode)) fastDigitalWrite(SckPin, !MODE_CPOL(Mode));
fastDigitalWrite(MosiPin, txData & _BV(bit));
fastDigitalWrite(SckPin,

View File

@ -381,7 +381,7 @@ void Planner::init() {
r9 = (d >> 8) & 0xFF,
r10 = (d >> 16) & 0xFF,
r2,r3,r4,r5,r6,r7,r11,r12,r13,r14,r15,r16,r17,r18;
const uint8_t* ptab = inv_tab;
const uint8_t *ptab = inv_tab;
__asm__ __volatile__(
// %8:%7:%6 = interval
@ -775,7 +775,7 @@ block_t* Planner::get_current_block() {
* is not and will not use the block while we modify it, so it is safe to
* alter its values.
*/
void Planner::calculate_trapezoid_for_block(block_t* const block, const float &entry_factor, const float &exit_factor) {
void Planner::calculate_trapezoid_for_block(block_t * const block, const float &entry_factor, const float &exit_factor) {
uint32_t initial_rate = CEIL(block->nominal_rate * entry_factor),
final_rate = CEIL(block->nominal_rate * exit_factor); // (steps per second)
@ -942,7 +942,7 @@ void Planner::calculate_trapezoid_for_block(block_t* const block, const float &e
*/
// The kernel called by recalculate() when scanning the plan from last to first entry.
void Planner::reverse_pass_kernel(block_t* const current, const block_t * const next) {
void Planner::reverse_pass_kernel(block_t * const current, const block_t * const next) {
if (current) {
// If entry speed is already at the maximum entry speed, and there was no change of speed
// in the next block, there is no need to recheck. Block is cruising and there is no need to
@ -1039,7 +1039,7 @@ void Planner::reverse_pass() {
}
// The kernel called by recalculate() when scanning the plan from first to last entry.
void Planner::forward_pass_kernel(const block_t* const previous, block_t* const current, const uint8_t block_index) {
void Planner::forward_pass_kernel(const block_t * const previous, block_t * const current, const uint8_t block_index) {
if (previous) {
// If the previous block is an acceleration block, too short to complete the full speed
// change, adjust the entry speed accordingly. Entry speeds have already been reset,
@ -1440,7 +1440,7 @@ void Planner::check_axes_activity() {
float high = 0.0;
for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) {
block_t* block = &block_buffer[b];
block_t *block = &block_buffer[b];
if (block->steps.x || block->steps.y || block->steps.z) {
const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec;
NOLESS(high, se);

View File

@ -993,10 +993,10 @@ class Planner {
}
#endif
static void calculate_trapezoid_for_block(block_t* const block, const float &entry_factor, const float &exit_factor);
static void calculate_trapezoid_for_block(block_t * const block, const float &entry_factor, const float &exit_factor);
static void reverse_pass_kernel(block_t* const current, const block_t * const next);
static void forward_pass_kernel(const block_t * const previous, block_t* const current, uint8_t block_index);
static void reverse_pass_kernel(block_t * const current, const block_t * const next);
static void forward_pass_kernel(const block_t * const previous, block_t * const current, uint8_t block_index);
static void reverse_pass();
static void forward_pass();

View File

@ -2362,7 +2362,7 @@ uint32_t Stepper::block_phase_isr() {
// Check if the given block is busy or not - Must not be called from ISR contexts
// The current_block could change in the middle of the read by an Stepper ISR, so
// we must explicitly prevent that!
bool Stepper::is_block_busy(const block_t* const block) {
bool Stepper::is_block_busy(const block_t * const block) {
#ifdef __AVR__
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() asm volatile("": : :"memory");
@ -2372,7 +2372,7 @@ bool Stepper::is_block_busy(const block_t* const block) {
// This works because stepper ISRs happen at a slower rate than
// successive reads of a variable, so 2 consecutive reads with
// the same value means no interrupt updated it.
block_t* vold, *vnew = current_block;
block_t *vold, *vnew = current_block;
sw_barrier();
do {
vold = vnew;

View File

@ -423,7 +423,7 @@ class Stepper {
#endif
// Check if the given block is busy or not - Must not be called from ISR contexts
static bool is_block_busy(const block_t* const block);
static bool is_block_busy(const block_t * const block);
// Get the position of a stepper, in steps
static int32_t position(const AxisEnum axis);
@ -529,7 +529,7 @@ class Stepper {
static void _set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
FORCE_INLINE static void _set_position(const abce_long_t &spos) { _set_position(spos.a, spos.b, spos.c, spos.e); }
FORCE_INLINE static uint32_t calc_timer_interval(uint32_t step_rate, uint8_t* loops) {
FORCE_INLINE static uint32_t calc_timer_interval(uint32_t step_rate, uint8_t *loops) {
uint32_t timer;
// Scale the frequency, as requested by the caller

View File

@ -830,11 +830,11 @@ void reset_trinamic_drivers() {
}
constexpr bool sc_hw_done(size_t start, size_t end) { return start == end; }
constexpr bool sc_hw_skip(const char* port_name) { return !(*port_name); }
constexpr bool sc_hw_match(const char* port_name, uint32_t address, size_t start, size_t end) {
constexpr bool sc_hw_skip(const char *port_name) { return !(*port_name); }
constexpr bool sc_hw_match(const char *port_name, uint32_t address, size_t start, size_t end) {
return !sc_hw_done(start, end) && !sc_hw_skip(port_name) && (address == sanity_tmc_hw_details[start].address && str_eq_ce(port_name, sanity_tmc_hw_details[start].port));
}
constexpr int count_tmc_hw_serial_matches(const char* port_name, uint32_t address, size_t start, size_t end) {
constexpr int count_tmc_hw_serial_matches(const char *port_name, uint32_t address, size_t start, size_t end) {
return sc_hw_done(start, end) ? 0 : ((sc_hw_skip(port_name) ? 0 : (sc_hw_match(port_name, address, start, end) ? 1 : 0)) + count_tmc_hw_serial_matches(port_name, address, start + 1, end));
}

View File

@ -63,7 +63,7 @@
0x0E,0x07,0x1C,0x15,0x2A,0x23,0x38,0x31,0x46,0x4F,0x54,0x5D,0x62,0x6B,0x70,0x79
};
static uint8_t CRC7(const uint8_t* data, uint8_t n) {
static uint8_t CRC7(const uint8_t *data, uint8_t n) {
uint8_t crc = 0;
while (n > 0) {
crc = pgm_read_byte(&crctab7[ (crc << 1) ^ *data++ ]);
@ -72,7 +72,7 @@
return (crc << 1) | 1;
}
#else
static uint8_t CRC7(const uint8_t* data, uint8_t n) {
static uint8_t CRC7(const uint8_t *data, uint8_t n) {
uint8_t crc = 0;
LOOP_L_N(i, n) {
uint8_t d = data[i];
@ -338,7 +338,7 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) {
* \param[out] dst Pointer to the location that will receive the data.
* \return true for success, false for failure.
*/
bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t *dst) {
#if IS_TEENSY_35_36 || IS_TEENSY_40_41
return 0 == SDHC_CardReadBlock(dst, blockNumber);
#endif
@ -378,7 +378,7 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
*
* \return true for success, false for failure.
*/
bool Sd2Card::readData(uint8_t* dst) {
bool Sd2Card::readData(uint8_t *dst) {
chipSelect();
return readData(dst, 512);
}
@ -421,7 +421,7 @@ bool Sd2Card::readData(uint8_t* dst) {
};
// faster CRC-CCITT
// uses the x^16,x^12,x^5,x^1 polynomial.
static uint16_t CRC_CCITT(const uint8_t* data, size_t n) {
static uint16_t CRC_CCITT(const uint8_t *data, size_t n) {
uint16_t crc = 0;
for (size_t i = 0; i < n; i++) {
crc = pgm_read_word(&crctab16[(crc >> 8 ^ data[i]) & 0xFF]) ^ (crc << 8);
@ -431,7 +431,7 @@ bool Sd2Card::readData(uint8_t* dst) {
#else
// slower CRC-CCITT
// uses the x^16,x^12,x^5,x^1 polynomial.
static uint16_t CRC_CCITT(const uint8_t* data, size_t n) {
static uint16_t CRC_CCITT(const uint8_t *data, size_t n) {
uint16_t crc = 0;
for (size_t i = 0; i < n; i++) {
crc = (uint8_t)(crc >> 8) | (crc << 8);
@ -445,7 +445,7 @@ bool Sd2Card::readData(uint8_t* dst) {
#endif
#endif // SD_CHECK_AND_RETRY
bool Sd2Card::readData(uint8_t* dst, const uint16_t count) {
bool Sd2Card::readData(uint8_t *dst, const uint16_t count) {
bool success = false;
const millis_t read_timeout = millis() + SD_READ_TIMEOUT;
@ -478,7 +478,7 @@ bool Sd2Card::readData(uint8_t* dst, const uint16_t count) {
/** read CID or CSR register */
bool Sd2Card::readRegister(const uint8_t cmd, void* buf) {
uint8_t* dst = reinterpret_cast<uint8_t*>(buf);
uint8_t *dst = reinterpret_cast<uint8_t*>(buf);
if (cardCommand(cmd, 0)) {
error(SD_CARD_ERROR_READ_REG);
chipDeselect();
@ -555,7 +555,7 @@ bool Sd2Card::waitNotBusy(const millis_t timeout_ms) {
* \param[in] src Pointer to the location of the data to be written.
* \return true for success, false for failure.
*/
bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t* src) {
bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t *src) {
if (ENABLED(SDCARD_READONLY)) return false;
#if IS_TEENSY_35_36 || IS_TEENSY_40_41
@ -586,7 +586,7 @@ bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t* src) {
* \param[in] src Pointer to the location of the data to be written.
* \return true for success, false for failure.
*/
bool Sd2Card::writeData(const uint8_t* src) {
bool Sd2Card::writeData(const uint8_t *src) {
if (ENABLED(SDCARD_READONLY)) return false;
bool success = true;
@ -601,7 +601,7 @@ bool Sd2Card::writeData(const uint8_t* src) {
}
// Send one block of data for write block or write multiple blocks
bool Sd2Card::writeData(const uint8_t token, const uint8_t* src) {
bool Sd2Card::writeData(const uint8_t token, const uint8_t *src) {
if (ENABLED(SDCARD_READONLY)) return false;
const uint16_t crc = TERN(SD_CHECK_AND_RETRY, CRC_CCITT(src, 512), 0xFFFF);

View File

@ -124,7 +124,7 @@ public:
*/
bool init(const uint8_t sckRateID, const pin_t chipSelectPin);
bool readBlock(uint32_t block, uint8_t* dst);
bool readBlock(uint32_t block, uint8_t *dst);
/**
* Read a card's CID register. The CID contains card identification
@ -135,7 +135,7 @@ public:
*
* \return true for success or false for failure.
*/
bool readCID(cid_t* cid) { return readRegister(CMD10, cid); }
bool readCID(cid_t *cid) { return readRegister(CMD10, cid); }
/**
* Read a card's CSD register. The CSD contains Card-Specific Data that
@ -145,9 +145,9 @@ public:
*
* \return true for success or false for failure.
*/
inline bool readCSD(csd_t* csd) { return readRegister(CMD9, csd); }
inline bool readCSD(csd_t *csd) { return readRegister(CMD9, csd); }
bool readData(uint8_t* dst);
bool readData(uint8_t *dst);
bool readStart(uint32_t blockNumber);
bool readStop();
bool setSckRate(const uint8_t sckRateID);
@ -157,8 +157,8 @@ public:
* \return 0 - SD V1, 1 - SD V2, or 3 - SDHC.
*/
int type() const {return type_;}
bool writeBlock(uint32_t blockNumber, const uint8_t* src);
bool writeData(const uint8_t* src);
bool writeBlock(uint32_t blockNumber, const uint8_t *src);
bool writeData(const uint8_t *src);
bool writeStart(uint32_t blockNumber, const uint32_t eraseCount);
bool writeStop();
@ -176,11 +176,11 @@ private:
}
uint8_t cardCommand(const uint8_t cmd, const uint32_t arg);
bool readData(uint8_t* dst, const uint16_t count);
bool readData(uint8_t *dst, const uint16_t count);
bool readRegister(const uint8_t cmd, void* buf);
void chipDeselect();
void chipSelect();
inline void type(const uint8_t value) { type_ = value; }
bool waitNotBusy(const millis_t timeout_ms);
bool writeData(const uint8_t token, const uint8_t* src);
bool writeData(const uint8_t token, const uint8_t *src);
};

View File

@ -43,7 +43,7 @@
SdBaseFile* SdBaseFile::cwd_ = 0; // Pointer to Current Working Directory
// callback function for date/time
void (*SdBaseFile::dateTime_)(uint16_t* date, uint16_t* time) = 0;
void (*SdBaseFile::dateTime_)(uint16_t *date, uint16_t *time) = 0;
// add a cluster to a file
bool SdBaseFile::addCluster() {
@ -118,7 +118,7 @@ bool SdBaseFile::close() {
* Reasons for failure include file is not contiguous, file has zero length
* or an I/O error occurred.
*/
bool SdBaseFile::contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock) {
bool SdBaseFile::contiguousRange(uint32_t *bgnBlock, uint32_t *endBlock) {
// error if no blocks
if (firstCluster_ == 0) return false;
@ -155,7 +155,7 @@ bool SdBaseFile::contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock) {
* a file is already open, the file already exists, the root
* directory is full or an I/O error.
*/
bool SdBaseFile::createContiguous(SdBaseFile* dirFile, const char* path, uint32_t size) {
bool SdBaseFile::createContiguous(SdBaseFile* dirFile, const char *path, uint32_t size) {
if (ENABLED(SDCARD_READONLY)) return false;
uint32_t count;
@ -186,8 +186,8 @@ bool SdBaseFile::createContiguous(SdBaseFile* dirFile, const char* path, uint32_
*
* \return true for success, false for failure.
*/
bool SdBaseFile::dirEntry(dir_t* dir) {
dir_t* p;
bool SdBaseFile::dirEntry(dir_t *dir) {
dir_t *p;
// make sure fields on SD are correct
if (!sync()) return false;
@ -207,7 +207,7 @@ bool SdBaseFile::dirEntry(dir_t* dir) {
* \param[in] dir The directory structure containing the name.
* \param[out] name A 13 byte char array for the formatted name.
*/
void SdBaseFile::dirName(const dir_t& dir, char* name) {
void SdBaseFile::dirName(const dir_t& dir, char *name) {
uint8_t j = 0;
LOOP_L_N(i, 11) {
if (dir.name[i] == ' ')continue;
@ -229,7 +229,7 @@ void SdBaseFile::dirName(const dir_t& dir, char* name) {
*
* \return true if the file exists else false.
*/
bool SdBaseFile::exists(const char* name) {
bool SdBaseFile::exists(const char *name) {
SdBaseFile file;
return file.open(this, name, O_READ);
}
@ -254,7 +254,7 @@ bool SdBaseFile::exists(const char* name) {
* \return For success fgets() returns the length of the string in \a str.
* If no data is read, fgets() returns zero for EOF or -1 if an error occurred.
**/
int16_t SdBaseFile::fgets(char* str, int16_t num, char* delim) {
int16_t SdBaseFile::fgets(char *str, int16_t num, char *delim) {
char ch;
int16_t n = 0;
int16_t r = -1;
@ -293,7 +293,7 @@ bool SdBaseFile::getDosName(char * const name) {
return true;
}
// cache entry
dir_t* p = cacheDirEntry(SdVolume::CACHE_FOR_READ);
dir_t *p = cacheDirEntry(SdVolume::CACHE_FOR_READ);
if (!p) return false;
// format name
@ -301,7 +301,7 @@ bool SdBaseFile::getDosName(char * const name) {
return true;
}
void SdBaseFile::getpos(filepos_t* pos) {
void SdBaseFile::getpos(filepos_t *pos) {
pos->position = curPosition_;
pos->cluster = curCluster_;
}
@ -386,7 +386,7 @@ int8_t SdBaseFile::lsPrintNext(uint8_t flags, uint8_t indent) {
}
// Format directory name field from a 8.3 name string
bool SdBaseFile::make83Name(const char* str, uint8_t* name, const char** ptr) {
bool SdBaseFile::make83Name(const char *str, uint8_t *name, const char** ptr) {
uint8_t n = 7, // Max index until a dot is found
i = 11;
while (i) name[--i] = ' '; // Set whole FILENAME.EXT to spaces
@ -423,7 +423,7 @@ bool SdBaseFile::make83Name(const char* str, uint8_t* name, const char** ptr) {
* Reasons for failure include this file is already open, \a parent is not a
* directory, \a path is invalid or already exists in \a parent.
*/
bool SdBaseFile::mkdir(SdBaseFile* parent, const char* path, bool pFlag) {
bool SdBaseFile::mkdir(SdBaseFile* parent, const char *path, bool pFlag) {
if (ENABLED(SDCARD_READONLY)) return false;
uint8_t dname[11];
@ -460,7 +460,7 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
uint32_t block;
dir_t d;
dir_t* p;
dir_t *p;
if (!parent->isDir()) return false;
@ -523,7 +523,7 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
*
* \return true for success, false for failure.
*/
bool SdBaseFile::open(const char* path, uint8_t oflag) {
bool SdBaseFile::open(const char *path, uint8_t oflag) {
return open(cwd_, path, oflag);
}
@ -577,7 +577,7 @@ bool SdBaseFile::open(const char* path, uint8_t oflag) {
* a directory, \a path is invalid, the file does not exist
* or can't be opened in the access mode specified by oflag.
*/
bool SdBaseFile::open(SdBaseFile* dirFile, const char* path, uint8_t oflag) {
bool SdBaseFile::open(SdBaseFile* dirFile, const char *path, uint8_t oflag) {
uint8_t dname[11];
SdBaseFile dir1, dir2;
SdBaseFile *parent = dirFile, *sub = &dir1;
@ -608,7 +608,7 @@ bool SdBaseFile::open(SdBaseFile* dirFile, const char* path, uint8_t oflag) {
bool SdBaseFile::open(SdBaseFile* dirFile, const uint8_t dname[11], uint8_t oflag) {
bool emptyFound = false, fileFound = false;
uint8_t index;
dir_t* p;
dir_t *p;
vol_ = dirFile->vol_;
@ -697,7 +697,7 @@ bool SdBaseFile::open(SdBaseFile* dirFile, const uint8_t dname[11], uint8_t ofla
* \return true for success or false for failure.
*/
bool SdBaseFile::open(SdBaseFile* dirFile, uint16_t index, uint8_t oflag) {
dir_t* p;
dir_t *p;
vol_ = dirFile->vol_;
@ -725,7 +725,7 @@ bool SdBaseFile::open(SdBaseFile* dirFile, uint16_t index, uint8_t oflag) {
// open a cached directory entry. Assumes vol_ is initialized
bool SdBaseFile::openCachedEntry(uint8_t dirIndex, uint8_t oflag) {
dir_t* p;
dir_t *p;
#if ENABLED(SDCARD_READONLY)
if (oflag & (O_WRITE | O_CREAT | O_TRUNC)) goto FAIL;
@ -785,7 +785,7 @@ bool SdBaseFile::openCachedEntry(uint8_t dirIndex, uint8_t oflag) {
* \return true for success or false for failure.
*/
bool SdBaseFile::openNext(SdBaseFile* dirFile, uint8_t oflag) {
dir_t* p;
dir_t *p;
uint8_t index;
if (!dirFile) return false;
@ -827,7 +827,7 @@ bool SdBaseFile::openNext(SdBaseFile* dirFile, uint8_t oflag) {
*/
bool SdBaseFile::openParent(SdBaseFile* dir) {
dir_t entry;
dir_t* p;
dir_t *p;
SdBaseFile file;
uint32_t c;
uint32_t cluster;
@ -1009,7 +1009,7 @@ int16_t SdBaseFile::read() {
* or an I/O error occurred.
*/
int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
uint8_t* dst = reinterpret_cast<uint8_t*>(buf);
uint8_t *dst = reinterpret_cast<uint8_t*>(buf);
uint16_t offset, toRead;
uint32_t block; // raw device block number
@ -1049,7 +1049,7 @@ int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
else {
// read block to cache and copy data to caller
if (!vol_->cacheRawBlock(block, SdVolume::CACHE_FOR_READ)) return -1;
uint8_t* src = vol_->cache()->data + offset;
uint8_t *src = vol_->cache()->data + offset;
memcpy(dst, src, n);
}
dst += n;
@ -1070,7 +1070,7 @@ int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
* readDir() called before a directory has been opened, this is not
* a directory file or an I/O error occurred.
*/
int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
int8_t SdBaseFile::readDir(dir_t *dir, char *longFilename) {
int16_t n;
// if not a directory file or miss-positioned return an error
if (!isDir() || (0x1F & curPosition_)) return -1;
@ -1096,7 +1096,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
// Fill the long filename if we have a long filename entry.
// Long filename entries are stored before the short filename.
if (longFilename && DIR_IS_LONG_NAME(dir)) {
vfat_t* VFAT = (vfat_t*)dir;
vfat_t *VFAT = (vfat_t*)dir;
// Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0
if (VFAT->firstClusterLow == 0) {
const uint8_t seq = VFAT->sequenceNumber & 0x1F;
@ -1199,7 +1199,7 @@ dir_t* SdBaseFile::readDirCache() {
bool SdBaseFile::remove() {
if (ENABLED(SDCARD_READONLY)) return false;
dir_t* d;
dir_t *d;
// free any clusters - will fail if read-only or directory
if (!truncate(0)) return false;
@ -1235,7 +1235,7 @@ bool SdBaseFile::remove() {
* \a dirFile is not a directory, \a path is not found
* or an I/O error occurred.
*/
bool SdBaseFile::remove(SdBaseFile* dirFile, const char* path) {
bool SdBaseFile::remove(SdBaseFile* dirFile, const char *path) {
if (ENABLED(SDCARD_READONLY)) return false;
SdBaseFile file;
@ -1252,13 +1252,13 @@ bool SdBaseFile::remove(SdBaseFile* dirFile, const char* path) {
* Reasons for failure include \a dirFile is not open or is not a directory
* file, newPath is invalid or already exists, or an I/O error occurs.
*/
bool SdBaseFile::rename(SdBaseFile* dirFile, const char* newPath) {
bool SdBaseFile::rename(SdBaseFile* dirFile, const char *newPath) {
if (ENABLED(SDCARD_READONLY)) return false;
dir_t entry;
uint32_t dirCluster = 0;
SdBaseFile file;
dir_t* d;
dir_t *d;
// must be an open file or subdirectory
if (!(isFile() || isSubDir())) return false;
@ -1356,7 +1356,7 @@ bool SdBaseFile::rmdir() {
// make sure directory is empty
while (curPosition_ < fileSize_) {
dir_t* p = readDirCache();
dir_t *p = readDirCache();
if (!p) return false;
// done if past last used entry
if (p->name[0] == DIR_NAME_FREE) break;
@ -1396,7 +1396,7 @@ bool SdBaseFile::rmRfStar() {
// remember position
index = curPosition_ / 32;
dir_t* p = readDirCache();
dir_t *p = readDirCache();
if (!p) return false;
// done if past last entry
@ -1438,7 +1438,7 @@ bool SdBaseFile::rmRfStar() {
* \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive
* OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t).
*/
SdBaseFile::SdBaseFile(const char* path, uint8_t oflag) {
SdBaseFile::SdBaseFile(const char *path, uint8_t oflag) {
type_ = FAT_FILE_TYPE_CLOSED;
writeError = false;
open(path, oflag);
@ -1481,7 +1481,7 @@ bool SdBaseFile::seekSet(const uint32_t pos) {
return true;
}
void SdBaseFile::setpos(filepos_t* pos) {
void SdBaseFile::setpos(filepos_t *pos) {
curPosition_ = pos->position;
curCluster_ = pos->cluster;
}
@ -1499,7 +1499,7 @@ bool SdBaseFile::sync() {
if (ENABLED(SDCARD_READONLY) || !isOpen()) goto FAIL;
if (flags_ & F_FILE_DIR_DIRTY) {
dir_t* d = cacheDirEntry(SdVolume::CACHE_FOR_WRITE);
dir_t *d = cacheDirEntry(SdVolume::CACHE_FOR_WRITE);
// check for deleted by another open file object
if (!d || d->name[0] == DIR_NAME_DELETED) goto FAIL;
@ -1537,7 +1537,7 @@ bool SdBaseFile::sync() {
* \return true for success, false for failure.
*/
bool SdBaseFile::timestamp(SdBaseFile* file) {
dir_t* d;
dir_t *d;
dir_t dir;
// get timestamps
@ -1599,7 +1599,7 @@ bool SdBaseFile::timestamp(uint8_t flags, uint16_t year, uint8_t month,
if (ENABLED(SDCARD_READONLY)) return false;
uint16_t dirDate, dirTime;
dir_t* d;
dir_t *d;
if (!isOpen()
|| year < 1980
@ -1716,7 +1716,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
#endif
// convert void* to uint8_t* - must be before goto statements
const uint8_t* src = reinterpret_cast<const uint8_t*>(buf);
const uint8_t *src = reinterpret_cast<const uint8_t*>(buf);
// number of bytes left to write - must be before goto statements
uint16_t nToWrite = nbyte;
@ -1782,7 +1782,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
// rewrite part of block
if (!vol_->cacheRawBlock(block, SdVolume::CACHE_FOR_WRITE)) goto FAIL;
}
uint8_t* dst = vol_->cache()->data + blockOffset;
uint8_t *dst = vol_->cache()->data + blockOffset;
memcpy(dst, src, n);
}
curPosition_ += n;

View File

@ -163,7 +163,7 @@ uint16_t const FAT_DEFAULT_TIME = (1 << 11);
class SdBaseFile {
public:
SdBaseFile() : writeError(false), type_(FAT_FILE_TYPE_CLOSED) {}
SdBaseFile(const char* path, uint8_t oflag);
SdBaseFile(const char *path, uint8_t oflag);
~SdBaseFile() { if (isOpen()) close(); }
/**
@ -179,18 +179,18 @@ class SdBaseFile {
* get position for streams
* \param[out] pos struct to receive position
*/
void getpos(filepos_t* pos);
void getpos(filepos_t *pos);
/**
* set position for streams
* \param[out] pos struct with value for new position
*/
void setpos(filepos_t* pos);
void setpos(filepos_t *pos);
bool close();
bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock);
bool contiguousRange(uint32_t *bgnBlock, uint32_t *endBlock);
bool createContiguous(SdBaseFile* dirFile,
const char* path, uint32_t size);
const char *path, uint32_t size);
/**
* \return The current cluster number for a file or directory.
*/
@ -213,7 +213,7 @@ class SdBaseFile {
* function is of the form:
*
* \code
* void dateTime(uint16_t* date, uint16_t* time) {
* void dateTime(uint16_t *date, uint16_t *time) {
* uint16_t year;
* uint8_t month, day, hour, minute, second;
*
@ -235,7 +235,7 @@ class SdBaseFile {
* See the timestamp() function.
*/
static void dateTimeCallback(
void (*dateTime)(uint16_t* date, uint16_t* time)) {
void (*dateTime)(uint16_t *date, uint16_t *time)) {
dateTime_ = dateTime;
}
@ -243,10 +243,10 @@ class SdBaseFile {
* Cancel the date/time callback function.
*/
static void dateTimeCallbackCancel() { dateTime_ = 0; }
bool dirEntry(dir_t* dir);
static void dirName(const dir_t& dir, char* name);
bool exists(const char* name);
int16_t fgets(char* str, int16_t num, char* delim = 0);
bool dirEntry(dir_t *dir);
static void dirName(const dir_t& dir, char *name);
bool exists(const char *name);
int16_t fgets(char *str, int16_t num, char *delim = 0);
/**
* \return The total number of bytes in a file or directory.
@ -286,10 +286,10 @@ class SdBaseFile {
bool getDosName(char * const name);
void ls(uint8_t flags = 0, uint8_t indent = 0);
bool mkdir(SdBaseFile* dir, const char* path, bool pFlag = true);
bool mkdir(SdBaseFile* dir, const char *path, bool pFlag = true);
bool open(SdBaseFile* dirFile, uint16_t index, uint8_t oflag);
bool open(SdBaseFile* dirFile, const char* path, uint8_t oflag);
bool open(const char* path, uint8_t oflag = O_READ);
bool open(SdBaseFile* dirFile, const char *path, uint8_t oflag);
bool open(const char *path, uint8_t oflag = O_READ);
bool openNext(SdBaseFile* dirFile, uint8_t oflag);
bool openRoot(SdVolume* vol);
int peek();
@ -298,15 +298,15 @@ class SdBaseFile {
bool printName();
int16_t read();
int16_t read(void* buf, uint16_t nbyte);
int8_t readDir(dir_t* dir, char* longFilename);
static bool remove(SdBaseFile* dirFile, const char* path);
int8_t readDir(dir_t *dir, char *longFilename);
static bool remove(SdBaseFile* dirFile, const char *path);
bool remove();
/**
* Set the file's current position to zero.
*/
void rewind() { seekSet(0); }
bool rename(SdBaseFile* dirFile, const char* newPath);
bool rename(SdBaseFile* dirFile, const char *newPath);
bool rmdir();
bool rmRfStar();
@ -348,7 +348,7 @@ class SdBaseFile {
static SdBaseFile* cwd_; // global pointer to cwd dir
// data time callback function
static void (*dateTime_)(uint16_t* date, uint16_t* time);
static void (*dateTime_)(uint16_t *date, uint16_t *time);
// bits defined in flags_
static uint8_t const F_OFLAG = (O_ACCMODE | O_APPEND | O_SYNC), // should be 0x0F
@ -376,7 +376,7 @@ class SdBaseFile {
bool addDirCluster();
dir_t* cacheDirEntry(uint8_t action);
int8_t lsPrintNext(uint8_t flags, uint8_t indent);
static bool make83Name(const char* str, uint8_t* name, const char** ptr);
static bool make83Name(const char *str, uint8_t *name, const char** ptr);
bool mkdir(SdBaseFile* parent, const uint8_t dname[11]);
bool open(SdBaseFile* dirFile, const uint8_t dname[11], uint8_t oflag);
bool openCachedEntry(uint8_t cacheIndex, uint8_t oflags);

View File

@ -571,7 +571,7 @@ uint8_t const DIR_NAME_0xE5 = 0x05, // escape for name[0] = 0xE5
*
* \return true if the entry is for part of a long name else false.
*/
static inline uint8_t DIR_IS_LONG_NAME(const dir_t* dir) {
static inline uint8_t DIR_IS_LONG_NAME(const dir_t *dir) {
return (dir->attributes & DIR_ATT_LONG_NAME_MASK) == DIR_ATT_LONG_NAME;
}
@ -584,7 +584,7 @@ uint8_t const DIR_ATT_FILE_TYPE_MASK = (DIR_ATT_VOLUME_ID | DIR_ATT_DIRECTORY);
*
* \return true if the entry is for a normal file else false.
*/
static inline uint8_t DIR_IS_FILE(const dir_t* dir) {
static inline uint8_t DIR_IS_FILE(const dir_t *dir) {
return (dir->attributes & DIR_ATT_FILE_TYPE_MASK) == 0;
}
@ -594,7 +594,7 @@ static inline uint8_t DIR_IS_FILE(const dir_t* dir) {
*
* \return true if the entry is for a subdirectory else false.
*/
static inline uint8_t DIR_IS_SUBDIR(const dir_t* dir) {
static inline uint8_t DIR_IS_SUBDIR(const dir_t *dir) {
return (dir->attributes & DIR_ATT_FILE_TYPE_MASK) == DIR_ATT_DIRECTORY;
}
@ -604,6 +604,6 @@ static inline uint8_t DIR_IS_SUBDIR(const dir_t* dir) {
*
* \return true if the entry is for a normal file or subdirectory else false.
*/
static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t *dir) {
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
}

View File

@ -43,7 +43,7 @@
* \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive
* OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t).
*/
SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) { }
SdFile::SdFile(const char *path, uint8_t oflag) : SdBaseFile(path, oflag) { }
/**
* Write data to an open file.
@ -78,7 +78,7 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) { return SdBaseFile::writ
* \param[in] str Pointer to the string.
* Use writeError to check for errors.
*/
void SdFile::write(const char* str) { SdBaseFile::write(str, strlen(str)); }
void SdFile::write(const char *str) { SdBaseFile::write(str, strlen(str)); }
/**
* Write a PROGMEM string to a file.

View File

@ -42,7 +42,7 @@
class SdFile : public SdBaseFile {
public:
SdFile() {}
SdFile(const char* name, uint8_t oflag);
SdFile(const char *name, uint8_t oflag);
#if ARDUINO >= 100
size_t write(uint8_t b);
#else
@ -50,7 +50,7 @@ class SdFile : public SdBaseFile {
#endif
int16_t write(const void* buf, uint16_t nbyte);
void write(const char* str);
void write(const char *str);
void write_P(PGM_P str);
void writeln_P(PGM_P str);
};

View File

@ -47,7 +47,7 @@
#endif // USE_MULTIPLE_CARDS
// find a contiguous group of clusters
bool SdVolume::allocContiguous(uint32_t count, uint32_t* curCluster) {
bool SdVolume::allocContiguous(uint32_t count, uint32_t *curCluster) {
if (ENABLED(SDCARD_READONLY)) return false;
// start of group
@ -149,7 +149,7 @@ bool SdVolume::cacheRawBlock(uint32_t blockNumber, bool dirty) {
}
// return the size in bytes of a cluster chain
bool SdVolume::chainSize(uint32_t cluster, uint32_t* size) {
bool SdVolume::chainSize(uint32_t cluster, uint32_t *size) {
uint32_t s = 0;
do {
if (!fatGet(cluster, &cluster)) return false;
@ -160,7 +160,7 @@ bool SdVolume::chainSize(uint32_t cluster, uint32_t* size) {
}
// Fetch a FAT entry
bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
bool SdVolume::fatGet(uint32_t cluster, uint32_t *value) {
uint32_t lba;
if (cluster > (clusterCount_ + 1)) return false;
if (FAT12_SUPPORT && fatType_ == 12) {
@ -328,7 +328,7 @@ int32_t SdVolume::freeClusterCount() {
*/
bool SdVolume::init(Sd2Card* dev, uint8_t part) {
uint32_t totalBlocks, volumeStartBlock = 0;
fat32_boot_t* fbs;
fat32_boot_t *fbs;
sdCard_ = dev;
fatType_ = 0;
@ -342,7 +342,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
if (part) {
if (part > 4) return false;
if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) return false;
part_t* p = &cacheBuffer_.mbr.part[part - 1];
part_t *p = &cacheBuffer_.mbr.part[part - 1];
if ((p->boot & 0x7F) != 0 || p->totalSectors < 100 || p->firstSector == 0)
return false; // not a valid partition
volumeStartBlock = p->firstSector;

View File

@ -124,7 +124,7 @@ class SdVolume {
* \param[out] v value of entry
* \return true for success or false for failure
*/
bool dbgFat(uint32_t n, uint32_t* v) { return fatGet(n, v); }
bool dbgFat(uint32_t n, uint32_t *v) { return fatGet(n, v); }
private:
// Allow SdBaseFile access to SdVolume private data.
@ -161,7 +161,7 @@ class SdVolume {
uint16_t rootDirEntryCount_; // number of entries in FAT16 root dir
uint32_t rootDirStart_; // root start block for FAT16, cluster for FAT32
bool allocContiguous(uint32_t count, uint32_t* curCluster);
bool allocContiguous(uint32_t count, uint32_t *curCluster);
uint8_t blockOfCluster(uint32_t position) const { return (position >> 9) & (blocksPerCluster_ - 1); }
uint32_t clusterStartBlock(uint32_t cluster) const { return dataStartBlock_ + ((cluster - 2) << clusterSizeShift_); }
uint32_t blockNumber(uint32_t cluster, uint32_t position) const { return clusterStartBlock(cluster) + blockOfCluster(position); }
@ -183,8 +183,8 @@ class SdVolume {
cacheBlockNumber_ = blockNumber;
}
void cacheSetDirty() { cacheDirty_ |= CACHE_FOR_WRITE; }
bool chainSize(uint32_t beginCluster, uint32_t* size);
bool fatGet(uint32_t cluster, uint32_t* value);
bool chainSize(uint32_t beginCluster, uint32_t *size);
bool fatGet(uint32_t cluster, uint32_t *value);
bool fatPut(uint32_t cluster, uint32_t value);
bool fatPutEOC(uint32_t cluster) { return fatPut(cluster, 0x0FFFFFFF); }
bool freeChain(uint32_t cluster);
@ -193,6 +193,6 @@ class SdVolume {
if (fatType_ == 16) return cluster >= FAT16EOC_MIN;
return cluster >= FAT32EOC_MIN;
}
bool readBlock(uint32_t block, uint8_t* dst) { return sdCard_->readBlock(block, dst); }
bool writeBlock(uint32_t block, const uint8_t* dst) { return sdCard_->writeBlock(block, dst); }
bool readBlock(uint32_t block, uint8_t *dst) { return sdCard_->readBlock(block, dst); }
bool writeBlock(uint32_t block, const uint8_t *dst) { return sdCard_->writeBlock(block, dst); }
};

View File

@ -122,7 +122,7 @@ public:
// Select a file
static void selectFileByIndex(const uint16_t nr);
static void selectFileByName(const char* const match);
static void selectFileByName(const char * const match);
// Print job
static void openAndPrintFile(const char *name); // (working directory)

View File

@ -295,7 +295,7 @@ uint32_t Sd2Card::cardSize() {
return lun0_capacity;
}
bool Sd2Card::readBlock(uint32_t block, uint8_t* dst) {
bool Sd2Card::readBlock(uint32_t block, uint8_t *dst) {
if (!isInserted()) return false;
#if USB_DEBUG >= 3
if (block >= lun0_capacity) {
@ -309,7 +309,7 @@ bool Sd2Card::readBlock(uint32_t block, uint8_t* dst) {
return bulk.Read(0, block, 512, 1, dst) == 0;
}
bool Sd2Card::writeBlock(uint32_t block, const uint8_t* src) {
bool Sd2Card::writeBlock(uint32_t block, const uint8_t *src) {
if (!isInserted()) return false;
#if USB_DEBUG >= 3
if (block >= lun0_capacity) {

View File

@ -60,15 +60,15 @@ class Sd2Card {
static void idle();
inline bool readStart(const uint32_t block) { pos = block; return isReady(); }
inline bool readData(uint8_t* dst) { return readBlock(pos++, dst); }
inline bool readData(uint8_t *dst) { return readBlock(pos++, dst); }
inline bool readStop() const { return true; }
inline bool writeStart(const uint32_t block, const uint32_t) { pos = block; return isReady(); }
inline bool writeData(uint8_t* src) { return writeBlock(pos++, src); }
inline bool writeData(uint8_t *src) { return writeBlock(pos++, src); }
inline bool writeStop() const { return true; }
bool readBlock(uint32_t block, uint8_t* dst);
bool writeBlock(uint32_t blockNumber, const uint8_t* src);
bool readBlock(uint32_t block, uint8_t *dst);
bool writeBlock(uint32_t blockNumber, const uint8_t *src);
bool readCSD(csd_t*) { return true; }

View File

@ -133,7 +133,7 @@ uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_l
/* 00 = success */
/* 01-0f = non-zero HRSLT */
uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) {
uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p) {
bool direction = false; // Request direction, IN or OUT
uint8_t rcode;
SETUP_PKT setup_pkt;
@ -201,7 +201,7 @@ uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bReque
* Keep sending INs and writes data to memory area pointed by 'data'
* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error, fe = USB xfer timeout
*/
uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval /*= 0*/) {
EpInfo *pep = nullptr;
uint16_t nak_limit = 0;
@ -215,7 +215,7 @@ uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t*
return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
}
uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval /*= 0*/) {
uint8_t rcode = 0;
uint8_t pktsize;
@ -286,7 +286,7 @@ uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, ui
* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer
* rcode 0 if no errors. rcode 01-0f is relayed from HRSL
*/
uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data) {
EpInfo *pep = nullptr;
uint16_t nak_limit = 0;
@ -743,12 +743,12 @@ uint8_t USB::ReleaseDevice(uint8_t addr) {
}
// Get device descriptor
uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr) {
return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, nullptr);
}
// Get configuration descriptor
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr) {
return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, nullptr);
}
@ -774,7 +774,7 @@ uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser
}
// Get string descriptor
uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t *dataptr) {
return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, nullptr);
}

View File

@ -250,19 +250,19 @@ public:
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
/* Control requests */
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr);
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
/**/
uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction);
uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr, bool direction);
uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit);
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0);
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0);
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data);
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
void Task();
@ -272,7 +272,7 @@ public:
uint8_t ReleaseDevice(uint8_t addr);
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p);
private:
void init();
@ -285,17 +285,17 @@ private:
#if 0 //defined(USB_METHODS_INLINE)
//get device descriptor
inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
}
//get configuration descriptor
inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
}
//get string descriptor
inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t *dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
}
//set address

View File

@ -51,7 +51,7 @@ void MAX3421e::regWr(uint8_t reg, uint8_t data) {
// multiple-byte write
// return a pointer to memory position after last written
uint8_t* MAX3421e::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
uint8_t* MAX3421e::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p) {
cs();
spiSend(reg | 0x02);
while (nbytes--) spiSend(*data_p++);
@ -79,7 +79,7 @@ uint8_t MAX3421e::regRd(uint8_t reg) {
// multiple-byte register read
// return a pointer to a memory position after last read
uint8_t* MAX3421e::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
uint8_t* MAX3421e::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p) {
cs();
spiSend(reg);
while (nbytes--) *data_p++ = spiRec();

View File

@ -37,10 +37,10 @@ class MAX3421e {
bool start();
void regWr(uint8_t reg, uint8_t data);
uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
void gpioWr(uint8_t data);
uint8_t regRd(uint8_t reg);
uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
uint8_t gpioRd();
bool reset();

View File

@ -594,7 +594,7 @@ void UHS_USB_HOST_BASE::ReleaseDevice(uint8_t addr) {
* @param dataptr pointer to the data to return
* @return status of the request, zero is success.
*/
uint8_t UHS_USB_HOST_BASE::getDevDescr(uint8_t addr, uint16_t nbytes, uint8_t* dataptr) {
uint8_t UHS_USB_HOST_BASE::getDevDescr(uint8_t addr, uint16_t nbytes, uint8_t *dataptr) {
return ( ctrlReq(addr, mkSETUP_PKT8(UHS_bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes), nbytes, dataptr));
}
@ -607,7 +607,7 @@ uint8_t UHS_USB_HOST_BASE::getDevDescr(uint8_t addr, uint16_t nbytes, uint8_t* d
* @param dataptr ointer to the data to return
* @return status of the request, zero is success.
*/
uint8_t UHS_USB_HOST_BASE::getConfDescr(uint8_t addr, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
uint8_t UHS_USB_HOST_BASE::getConfDescr(uint8_t addr, uint16_t nbytes, uint8_t conf, uint8_t *dataptr) {
return ( ctrlReq(addr, mkSETUP_PKT8(UHS_bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes), nbytes, dataptr));
}
@ -621,7 +621,7 @@ uint8_t UHS_USB_HOST_BASE::getConfDescr(uint8_t addr, uint16_t nbytes, uint8_t c
* @param dataptr pointer to the data to return
* @return status of the request, zero is success.
*/
uint8_t UHS_USB_HOST_BASE::getStrDescr(uint8_t addr, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
uint8_t UHS_USB_HOST_BASE::getStrDescr(uint8_t addr, uint16_t ns, uint8_t index, uint16_t langid, uint8_t *dataptr) {
return ( ctrlReq(addr, mkSETUP_PKT8(UHS_bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns), ns, dataptr));
}
@ -668,7 +668,7 @@ uint8_t UHS_USB_HOST_BASE::setConf(uint8_t addr, uint8_t conf_value) {
* @param data pointer to buffer to hold transfer
* @return zero for success or error code
*/
uint8_t UHS_USB_HOST_BASE::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
uint8_t UHS_USB_HOST_BASE::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data) {
UHS_EpInfo *pep = NULL;
uint16_t nak_limit = 0;
HOST_DEBUG("outTransfer: addr: 0x%2.2x ep: 0x%2.2x nbytes: 0x%4.4x data: 0x%p\r\n", addr, ep, nbytes, data);
@ -689,7 +689,7 @@ uint8_t UHS_USB_HOST_BASE::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes
* @param data pointer to buffer to hold transfer
* @return zero for success or error code
*/
uint8_t UHS_USB_HOST_BASE::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data) {
uint8_t UHS_USB_HOST_BASE::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data) {
UHS_EpInfo *pep = NULL;
uint16_t nak_limit = 0;
@ -980,7 +980,7 @@ uint8_t UHS_USB_HOST_BASE::eat(UHS_EpInfo *pep, uint16_t *left, uint16_t *read,
return rcode;
}
uint8_t UHS_USB_HOST_BASE::ctrlReq(uint8_t addr, uint64_t Request, uint16_t nbytes, uint8_t* dataptr) {
uint8_t UHS_USB_HOST_BASE::ctrlReq(uint8_t addr, uint64_t Request, uint16_t nbytes, uint8_t *dataptr) {
//bool direction = bmReqType & 0x80; //request direction, IN or OUT
uint8_t rcode = 0;

View File

@ -103,7 +103,7 @@ public:
return (current_state == usb_task_state);
};
virtual UHS_EpInfo * UHS_NI ctrlReqOpen(NOTUSED(uint8_t addr), NOTUSED(uint64_t Request), NOTUSED(uint8_t* dataptr)) {
virtual UHS_EpInfo * UHS_NI ctrlReqOpen(NOTUSED(uint8_t addr), NOTUSED(uint64_t Request), NOTUSED(uint8_t *dataptr)) {
return NULL;
};
@ -213,17 +213,17 @@ public:
uint8_t UHS_NI EPClearHalt(uint8_t addr, uint8_t ep);
uint8_t UHS_NI ctrlReq(uint8_t addr, uint64_t Request, uint16_t nbytes, uint8_t* dataptr);
uint8_t UHS_NI ctrlReq(uint8_t addr, uint64_t Request, uint16_t nbytes, uint8_t *dataptr);
uint8_t UHS_NI getDevDescr(uint8_t addr, uint16_t nbytes, uint8_t* dataptr);
uint8_t UHS_NI getDevDescr(uint8_t addr, uint16_t nbytes, uint8_t *dataptr);
uint8_t UHS_NI getConfDescr(uint8_t addr, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
uint8_t UHS_NI getConfDescr(uint8_t addr, uint16_t nbytes, uint8_t conf, uint8_t *dataptr);
uint8_t UHS_NI setAddr(uint8_t oldaddr, uint8_t newaddr);
uint8_t UHS_NI setConf(uint8_t addr, uint8_t conf_value);
uint8_t UHS_NI getStrDescr(uint8_t addr, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
uint8_t UHS_NI getStrDescr(uint8_t addr, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr);
void UHS_NI ReleaseDevice(uint8_t addr);
@ -262,8 +262,8 @@ public:
uint8_t enumerateInterface(ENUMERATION_INFO *ei);
uint8_t getNextInterface(ENUMERATION_INFO *ei, UHS_EpInfo *pep, uint8_t data[], uint16_t *left, uint16_t *read, uint8_t *offset);
uint8_t initDescrStream(ENUMERATION_INFO *ei, USB_FD_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset);
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data);
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data);
uint8_t doSoftReset(uint8_t parent, uint8_t port, uint8_t address);
uint8_t getone(UHS_EpInfo *pep, uint16_t *left, uint16_t *read, uint8_t *dataptr, uint8_t *offset);
uint8_t eat(UHS_EpInfo *pep, uint16_t *left, uint16_t *read, uint8_t *dataptr, uint8_t *offset, uint16_t *yum);

View File

@ -388,7 +388,7 @@ public:
return (!condet);
};
virtual UHS_EpInfo *ctrlReqOpen(uint8_t addr, uint64_t Request, uint8_t* dataptr);
virtual UHS_EpInfo *ctrlReqOpen(uint8_t addr, uint64_t Request, uint8_t *dataptr);
virtual void UHS_NI vbusPower(VBUS_t state) {
regWr(rPINCTL, (bmFDUPSPI | bmIRQ_SENSE) | (uint8_t)(state));
@ -483,8 +483,8 @@ public:
void gpioWr(uint8_t data);
uint8_t regRd(uint8_t reg);
uint8_t gpioRd();
uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
// ARM/NVIC specific, used to emulate reentrant ISR.
#ifdef SWI_IRQ_NUM

View File

@ -76,7 +76,7 @@ void UHS_NI MAX3421E_HOST::regWr(uint8_t reg, uint8_t data) {
/* multiple-byte write */
/* returns a pointer to memory position after last written */
uint8_t* UHS_NI MAX3421E_HOST::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
uint8_t* UHS_NI MAX3421E_HOST::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p) {
SPIclass.beginTransaction(MAX3421E_SPI_Settings);
MARLIN_UHS_WRITE_SS(LOW);
SPIclass.transfer(reg | 0x02);
@ -117,7 +117,7 @@ uint8_t UHS_NI MAX3421E_HOST::regRd(uint8_t reg) {
/* multiple-byte register read */
/* returns a pointer to a memory position after last read */
uint8_t* UHS_NI MAX3421E_HOST::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
uint8_t* UHS_NI MAX3421E_HOST::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p) {
SPIclass.beginTransaction(MAX3421E_SPI_Settings);
MARLIN_UHS_WRITE_SS(LOW);
SPIclass.transfer(reg);
@ -472,7 +472,7 @@ uint8_t UHS_NI MAX3421E_HOST::SetAddress(uint8_t addr, uint8_t ep, UHS_EpInfo **
* @param data pointer to data buffer
* @return 0 on success
*/
uint8_t UHS_NI MAX3421E_HOST::InTransfer(UHS_EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data) {
uint8_t UHS_NI MAX3421E_HOST::InTransfer(UHS_EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data) {
uint8_t rcode = 0;
uint8_t pktsize;

Some files were not shown because too many files have changed in this diff Show More