aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-04-11 19:27:43 +0530
committerAkshay Nair <phenax5@gmail.com>2026-04-11 19:27:43 +0530
commit829d9e438f4eedf9dfb15aec59510ecc14be583c (patch)
treefce8a6e3101a56a5786db2f2adeb6d01bbed051b
downloadtemperature-sensor-attiny84a-829d9e438f4eedf9dfb15aec59510ecc14be583c.tar.gz
temperature-sensor-attiny84a-829d9e438f4eedf9dfb15aec59510ecc14be583c.zip
Init commit with boilerplate shit
-rw-r--r--.clangd5
-rw-r--r--.envrc1
-rw-r--r--.gitignore7
-rw-r--r--LICENSE21
-rw-r--r--README.md3
-rw-r--r--compile_flags.txt12
-rw-r--r--flake.lock61
-rw-r--r--flake.nix46
-rw-r--r--justfile44
-rw-r--r--src/main.c9
10 files changed, 209 insertions, 0 deletions
diff --git a/.clangd b/.clangd
new file mode 100644
index 0000000..f162070
--- /dev/null
+++ b/.clangd
@@ -0,0 +1,5 @@
+CompileFlags:
+ Compiler: avr-gcc
+Diagnostics:
+ Suppress: unknown-attributes
+ Add: bugprone-*, readability-*
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0e2f1ed
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.clang_complete
+.ccls
+a.out
+out/
+*.zip
+fp-info-cache
+*.lck
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..713d8cf
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 Akshay Nair
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e3fe1c9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Temperature display for my soldering gun
+
+Solder gun hot. Me not know how hot. Look at display. Me know how hot.
diff --git a/compile_flags.txt b/compile_flags.txt
new file mode 100644
index 0000000..8d56fa5
--- /dev/null
+++ b/compile_flags.txt
@@ -0,0 +1,12 @@
+-g
+-Os
+-std=gnu99
+-Isrc
+-mmcu=attiny84a
+-I/nix/store/ivhsczriimr31rrmly0bcj03gv4qa3q7-avr-libc-avr-2.2.1/avr/include
+-L/nix/store/ivhsczriimr31rrmly0bcj03gv4qa3q7-avr-libc-avr-2.2.1/avr/lib
+-funsigned-char
+-funsigned-bitfields
+-fpack-struct
+-fshort-enums
+-Wall
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..af8f58f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1771369470,
+ "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "0182a361324364ae3f436a63005877674cf45efb",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..d88e5a1
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,46 @@
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ flake-utils,
+ ...
+ }:
+ let
+ shell =
+ { pkgs }:
+ pkgs.mkShell rec {
+ buildInputs = with pkgs; [
+ pkgs.pkgsCross.avr.buildPackages.gcc
+ pkgs.pkgsCross.avr.avrlibc
+ arduino-core
+ avrdude
+
+ # dev
+ openocd
+ clang-tools
+ unixtools.xxd
+ just
+ pkg-config
+ ];
+
+ AVR_LIBC = "${pkgs.pkgsCross.avr.avrlibc}";
+ ARDUINO_LIB = "${pkgs.arduino}";
+ LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
+ };
+ in
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in
+ {
+ devShells.default = shell { inherit pkgs; };
+ }
+ );
+}
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..567f3c6
--- /dev/null
+++ b/justfile
@@ -0,0 +1,44 @@
+set export
+# set unstable
+
+default:
+ echo -
+
+AVR_LIBC := env("AVR_LIBC", "/usr/lib/avr")
+# F_CPU := "32768"
+MCU := "attiny84a"
+MCU_PART := "attiny84"
+SRCS := "src/main.c src/display.c"
+OUTDIR := "./out"
+PROGRAMMER := "arduino"
+UPLOAD_SPEED := "19200"
+SERIAL_PORT := "/dev/ttyUSB0"
+
+CFLAGS := f"-g -Os -std=gnu99 -Isrc -mmcu={{MCU}} \
+-I{{AVR_LIBC}}/avr/include -L{{AVR_LIBC}}/avr/lib \
+-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall"
+
+AVRDUDE := f"avrdude -v -p {{MCU_PART}} -c {{PROGRAMMER}} -b {{UPLOAD_SPEED}}"
+
+build: compile-flags
+ mkdir -p {{OUTDIR}}
+ avr-gcc {{CFLAGS}} {{SRCS}} -o {{OUTDIR}}/out.elf
+ avr-objcopy -O ihex -R .eeprom {{OUTDIR}}/out.elf {{OUTDIR}}/out.hex
+ du -bh "{{OUTDIR}}/out.hex"
+
+write: build flash
+
+flash port=SERIAL_PORT: check-hexfile-exists
+ {{AVRDUDE}} -P {{port}} -F -U "flash:w:{{OUTDIR}}/out.hex:i"
+
+clean:
+ rm -rf {{OUTDIR}}
+
+format:
+ find src/ -iname '*.h' -o -iname '*.c' | xargs clang-format -i
+
+@check-hexfile-exists:
+ [ -f "{{OUTDIR}}/out.hex" ] || (echo "No out.hex. Run build first"; exit 1);
+
+@compile-flags:
+ echo '{{CFLAGS}}' | tr ' ' '\n' > ./compile_flags.txt
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..cd3f0be
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,9 @@
+#include <util/delay.h>
+
+int main(void) {
+ while (1) {
+ _delay_ms(1000);
+ }
+
+ return 0;
+}