Apply pointer formatting
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user