-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathslaveupdate.h
More file actions
35 lines (28 loc) · 1.21 KB
/
slaveupdate.h
File metadata and controls
35 lines (28 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/////////////////////////////////////////////
//slave reflasher code -- it can reflash an I2C slave over I2C! You must set fuses and install twiboot:
/*
the commands would be something like this for Atmega328p
.\avrdude.exe -c usbtiny -p m328p -U lfuse:w:0xC2:m -U hfuse:w:0xD8:m -U efuse:w:0xFD:m
.\avrdude.exe -c usbtiny -p m328p -U flash:w:twiboot.hex:i
*/
/////////////////////////////////////////////
#ifndef SLAVEUPDATE_CONFIG_H
#define SLAVEUPDATE_CONFIG_H
#include "i2cslave.h"
#include "globals.h"
#include "utilities.h"
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266HTTPClient.h>
extern bool pagePending; // true when current page has unsent data
uint8_t hexToByte(String hex);
bool sendFlashPage(uint32_t pageAddr, uint8_t *data, int totalBytes, bool debug);
void flushLastPage(uint8_t *pageBuffer, bool debug);
void processHexLine(String line, uint8_t *pageBuffer, bool debug);
void streamHexFile(Stream *stream, uint8_t *pageBuffer, uint32_t flashFileSize, bool debug);
void updateSlaveFirmware(String url);
void finalizeBootloaderUpdate(uint8_t *pageBuffer, bool debug);
void runSlaveSketch();
void enterSlaveBootloader();
void leaveSlaveBootloader();
#endif