mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge branch 'Links2004-esp8266' into esp8266
* Links2004-esp8266: add hexdump function for easy debugging. add some notes to the SPI functions (aligned to 32Bit) - Fatal exception (9)
This commit is contained in:
commit
b330cb794a
@ -229,6 +229,9 @@ long random(long, long);
|
||||
void randomSeed(unsigned int);
|
||||
long map(long, long, long, long, long);
|
||||
|
||||
// Debugging functions
|
||||
void hexdump(uint8_t *mem, uint32_t len, uint8_t cols = 16);
|
||||
|
||||
#endif
|
||||
|
||||
#include "pins_arduino.h"
|
||||
|
21
cores/esp8266/debug.cpp
Normal file
21
cores/esp8266/debug.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* debug.c
|
||||
*
|
||||
* Created on: 13.05.2015
|
||||
* Author: Markus Sattler
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
|
||||
os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", mem, len, len);
|
||||
for(uint32_t i = 0; i < len; i++) {
|
||||
if(i % cols == 0) {
|
||||
os_printf("\n[0x%08X] 0x%08X: ", mem, i);
|
||||
}
|
||||
os_printf("%02X ", *mem);
|
||||
mem++;
|
||||
}
|
||||
os_printf("\n");
|
||||
}
|
||||
|
@ -308,6 +308,13 @@ void SPIClass::write32(uint32_t data, bool msb) {
|
||||
while(SPI1CMD & SPIBUSY) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Note:
|
||||
* data need to be aligned to 32Bit
|
||||
* or you get an Fatal exception (9)
|
||||
* @param data uint8_t *
|
||||
* @param size uint32_t
|
||||
*/
|
||||
void SPIClass::writeBytes(uint8_t * data, uint32_t size) {
|
||||
while(size) {
|
||||
if(size > 64) {
|
||||
@ -340,6 +347,15 @@ void SPIClass::writeBytes_(uint8_t * data, uint8_t size) {
|
||||
while(SPI1CMD & SPIBUSY) {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Note:
|
||||
* data need to be aligned to 32Bit
|
||||
* or you get an Fatal exception (9)
|
||||
* @param data uint8_t *
|
||||
* @param size uint8_t max for size is 64Byte
|
||||
* @param repeat uint32_t
|
||||
*/
|
||||
void SPIClass::writePattern(uint8_t * data, uint8_t size, uint32_t repeat) {
|
||||
if(size > 64) return; //max Hardware FIFO
|
||||
|
||||
@ -376,6 +392,14 @@ void SPIClass::writePattern_(uint8_t * data, uint8_t size, uint8_t repeat) {
|
||||
writeBytes(&buffer[0], bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note:
|
||||
* in and out need to be aligned to 32Bit
|
||||
* or you get an Fatal exception (9)
|
||||
* @param out uint8_t *
|
||||
* @param in uint8_t *
|
||||
* @param size uint32_t
|
||||
*/
|
||||
void SPIClass::transferBytes(uint8_t * out, uint8_t * in, uint32_t size) {
|
||||
while(size) {
|
||||
if(size > 64) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user