1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Run new astyle formatter against all the examples

This commit is contained in:
Federico Fissore
2013-10-21 09:58:40 +02:00
parent 3c6ee46828
commit b4c68b3dff
259 changed files with 5160 additions and 5217 deletions

View File

@ -21,17 +21,17 @@ void dump(decode_results *results) {
int count = results->rawlen;
if (results->decode_type == UNKNOWN) {
Serial.println("Could not decode message");
}
}
else {
if (results->decode_type == NEC) {
Serial.print("Decoded NEC: ");
}
}
else if (results->decode_type == SONY) {
Serial.print("Decoded SONY: ");
}
}
else if (results->decode_type == RC5) {
Serial.print("Decoded RC5: ");
}
}
else if (results->decode_type == RC6) {
Serial.print("Decoded RC6: ");
}
@ -47,7 +47,7 @@ void dump(decode_results *results) {
for (int i = 0; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
}
else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
@ -59,61 +59,61 @@ void dump(decode_results *results) {
IRrecv irrecv(0);
decode_results results;
class IRsendDummy :
public IRsend
class IRsendDummy :
public IRsend
{
public:
// For testing, just log the marks/spaces
public:
// For testing, just log the marks/spaces
#define SENDLOG_LEN 128
int sendlog[SENDLOG_LEN];
int sendlogcnt;
IRsendDummy() :
IRsend() {
}
void reset() {
sendlogcnt = 0;
}
void mark(int time) {
sendlog[sendlogcnt] = time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
}
void space(int time) {
sendlog[sendlogcnt] = -time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
}
// Copies the dummy buf into the interrupt buf
void useDummyBuf() {
int last = SPACE;
irparams.rcvstate = STATE_STOP;
irparams.rawlen = 1; // Skip the gap
for (int i = 0 ; i < sendlogcnt; i++) {
if (sendlog[i] < 0) {
if (last == MARK) {
// New space
irparams.rawbuf[irparams.rawlen++] = (-sendlog[i] - MARK_EXCESS) / USECPERTICK;
last = SPACE;
}
else {
// More space
irparams.rawbuf[irparams.rawlen - 1] += -sendlog[i] / USECPERTICK;
int sendlog[SENDLOG_LEN];
int sendlogcnt;
IRsendDummy() :
IRsend() {
}
void reset() {
sendlogcnt = 0;
}
void mark(int time) {
sendlog[sendlogcnt] = time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
}
void space(int time) {
sendlog[sendlogcnt] = -time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
}
// Copies the dummy buf into the interrupt buf
void useDummyBuf() {
int last = SPACE;
irparams.rcvstate = STATE_STOP;
irparams.rawlen = 1; // Skip the gap
for (int i = 0 ; i < sendlogcnt; i++) {
if (sendlog[i] < 0) {
if (last == MARK) {
// New space
irparams.rawbuf[irparams.rawlen++] = (-sendlog[i] - MARK_EXCESS) / USECPERTICK;
last = SPACE;
}
else {
// More space
irparams.rawbuf[irparams.rawlen - 1] += -sendlog[i] / USECPERTICK;
}
}
}
else if (sendlog[i] > 0) {
if (last == SPACE) {
// New mark
irparams.rawbuf[irparams.rawlen++] = (sendlog[i] + MARK_EXCESS) / USECPERTICK;
last = MARK;
}
else {
// More mark
irparams.rawbuf[irparams.rawlen - 1] += sendlog[i] / USECPERTICK;
else if (sendlog[i] > 0) {
if (last == SPACE) {
// New mark
irparams.rawbuf[irparams.rawlen++] = (sendlog[i] + MARK_EXCESS) / USECPERTICK;
last = MARK;
}
else {
// More mark
irparams.rawbuf[irparams.rawlen - 1] += sendlog[i] / USECPERTICK;
}
}
}
if (irparams.rawlen % 2) {
irparams.rawlen--; // Remove trailing space
}
}
if (irparams.rawlen % 2) {
irparams.rawlen--; // Remove trailing space
}
}
};
IRsendDummy irsenddummy;
@ -125,12 +125,12 @@ void verify(unsigned long val, int bits, int type) {
Serial.print(val, HEX);
if (results.value == val && results.bits == bits && results.decode_type == type) {
Serial.println(": OK");
}
}
else {
Serial.println(": Error");
dump(&results);
}
}
}
void testNEC(unsigned long val, int bits) {
irsenddummy.reset();