mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
examples: format all .ino files
This formats all the example source files using Arduino style rules.
This commit is contained in:
committed by
Ivan Grokhotkov
parent
e226251b27
commit
61cd8d8385
@ -12,57 +12,57 @@ const uint8_t reset_pin = 5;
|
||||
ESP8266AVRISP avrprog(port, reset_pin);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("");
|
||||
Serial.println("Arduino AVR-ISP over TCP");
|
||||
avrprog.setReset(false); // let the AVR run
|
||||
Serial.begin(115200);
|
||||
Serial.println("");
|
||||
Serial.println("Arduino AVR-ISP over TCP");
|
||||
avrprog.setReset(false); // let the AVR run
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(ssid, pass);
|
||||
while (WiFi.waitForConnectResult() != WL_CONNECTED);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(ssid, pass);
|
||||
while (WiFi.waitForConnectResult() != WL_CONNECTED);
|
||||
|
||||
MDNS.begin(host);
|
||||
MDNS.addService("avrisp", "tcp", port);
|
||||
MDNS.begin(host);
|
||||
MDNS.addService("avrisp", "tcp", port);
|
||||
|
||||
IPAddress local_ip = WiFi.localIP();
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(local_ip);
|
||||
Serial.println("Use your avrdude:");
|
||||
Serial.print("avrdude -c arduino -p <device> -P net:");
|
||||
Serial.print(local_ip);
|
||||
Serial.print(":");
|
||||
Serial.print(port);
|
||||
Serial.println(" -t # or -U ...");
|
||||
IPAddress local_ip = WiFi.localIP();
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(local_ip);
|
||||
Serial.println("Use your avrdude:");
|
||||
Serial.print("avrdude -c arduino -p <device> -P net:");
|
||||
Serial.print(local_ip);
|
||||
Serial.print(":");
|
||||
Serial.print(port);
|
||||
Serial.println(" -t # or -U ...");
|
||||
|
||||
// listen for avrdudes
|
||||
avrprog.begin();
|
||||
// listen for avrdudes
|
||||
avrprog.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static AVRISPState_t last_state = AVRISP_STATE_IDLE;
|
||||
AVRISPState_t new_state = avrprog.update();
|
||||
if (last_state != new_state) {
|
||||
switch (new_state) {
|
||||
case AVRISP_STATE_IDLE: {
|
||||
Serial.printf("[AVRISP] now idle\r\n");
|
||||
// Use the SPI bus for other purposes
|
||||
break;
|
||||
}
|
||||
case AVRISP_STATE_PENDING: {
|
||||
Serial.printf("[AVRISP] connection pending\r\n");
|
||||
// Clean up your other purposes and prepare for programming mode
|
||||
break;
|
||||
}
|
||||
case AVRISP_STATE_ACTIVE: {
|
||||
Serial.printf("[AVRISP] programming mode\r\n");
|
||||
// Stand by for completion
|
||||
break;
|
||||
}
|
||||
static AVRISPState_t last_state = AVRISP_STATE_IDLE;
|
||||
AVRISPState_t new_state = avrprog.update();
|
||||
if (last_state != new_state) {
|
||||
switch (new_state) {
|
||||
case AVRISP_STATE_IDLE: {
|
||||
Serial.printf("[AVRISP] now idle\r\n");
|
||||
// Use the SPI bus for other purposes
|
||||
break;
|
||||
}
|
||||
case AVRISP_STATE_PENDING: {
|
||||
Serial.printf("[AVRISP] connection pending\r\n");
|
||||
// Clean up your other purposes and prepare for programming mode
|
||||
break;
|
||||
}
|
||||
case AVRISP_STATE_ACTIVE: {
|
||||
Serial.printf("[AVRISP] programming mode\r\n");
|
||||
// Stand by for completion
|
||||
break;
|
||||
}
|
||||
last_state = new_state;
|
||||
}
|
||||
// Serve the client
|
||||
if (last_state != AVRISP_STATE_IDLE) {
|
||||
avrprog.serve();
|
||||
}
|
||||
last_state = new_state;
|
||||
}
|
||||
// Serve the client
|
||||
if (last_state != AVRISP_STATE_IDLE) {
|
||||
avrprog.serve();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user