Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Firmware/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build*
31 changes: 31 additions & 0 deletions Firmware/Zero2Go-Omini/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:19.10

RUN apt-get -yq update \
&& apt-get -yq --no-install-suggests --no-install-recommends install \
wget \
git \
avrdude \
python-serial \
xz-utils \
ca-certificates \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://downloads.arduino.cc/arduino-1.8.10-linux64.tar.xz \
&& tar xf *.tar.xz -C /opt \
&& rm *.tar.xz

RUN git clone https://github.com/sudar/Arduino-Makefile -b 1.5.2 /opt/arduino-mk

RUN git clone https://github.com/SpenceKonde/ATTinyCore.git -b v1.1.4 /opt/ATTinyCore

RUN git clone https://github.com/orangkucing/WireS.git /opt/WireS \
&& cd /opt/WireS \
&& git reset --hard 776ffa23b6b9b8ae17b21e10357e22b09e7e9510

RUN git clone https://github.com/orangkucing/analogComp /opt/analogComp

WORKDIR /src

CMD ["make"]
16 changes: 16 additions & 0 deletions Firmware/Zero2Go-Omini/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TARGET = Zero2Go-Omini.ino
ARDUINO_DIR = /opt/arduino-1.8.10
USER_LIB_PATH = /opt

# Programmer type:
ISP_PROG = usbasp

# https://github.com/SpenceKonde/ATTinyCore (1.5+)
ALTERNATE_CORE = ATTinyCore
ALTERNATE_CORE_PATH = /opt/ATTinyCore
BOARD_TAG = attinyx41
BOARD_SUB = 841
F_CPU = 8000000L

# Path to the Arduino Makefile
include /opt/arduino-mk/Arduino.mk
18 changes: 18 additions & 0 deletions Firmware/Zero2Go-Omini/Zero2Go-Omini.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ volatile unsigned long buttonStateChangeTime = 0;

volatile unsigned long voltageQueryTime = 0;

void timer1_enable();
void cutPower();
void powerOn();
void redLightOn();
void suggestShutdown();
void redLightOff();
void initializeRegisters();
void updateRegister(int index, byte value);
float getVoltage(int pin);
int getIntegerPart(float v);
int getDecimalPart(float v);
unsigned int getPowerCutPreloadTimer();
void receiveEvent(int count);
boolean addressEvent(uint16_t slaveAddress, uint8_t startCount);
void requestEvent();
void comparatorStatusChanged();
void sleep();

void setup() {

// initialize pin states and make sure power is cut
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@ The firmware is compiled and uploaded to Zero2Go Omini via Arduino IDE (with ATT
The software is written in BASH.

More information about the firmware and software can be found in the user manual: http://www.uugear.com/doc/Zero2Go_Omini_UserManual.pdf

# Firmware build instructions

You can use the provided Dockerfile and Makefile (made with [Arduino-Makefile](https://github.com/sudar/Arduino-Makefile/)) to quickly set up a build environment with all the required dependencies.:

```
cd Firmware/Zero2Go-Omini
docker build -t zero2go-omini .
```

The firmware can then be built with:

```
cd Firmware/Zero2Go-Omini
docker run -ti -v $(pwd):/src zero2go-omini:latest
```