avr: added device n31.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
n28
|
||||
n29
|
||||
n30
|
||||
n31
|
||||
r06
|
||||
s03
|
||||
t03
|
||||
|
||||
4
avr/devices/n31/.gitignore
vendored
Normal file
4
avr/devices/n31/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.eep.hex
|
||||
*.obj
|
||||
n29-enclosure.stl
|
||||
n29-enclosure-2.stl
|
||||
19
avr/devices/n31/0BUILD
Normal file
19
avr/devices/n31/0BUILD
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<subdirs>
|
||||
boot
|
||||
main
|
||||
</subdirs>
|
||||
|
||||
<extradist>
|
||||
defs.asm
|
||||
README
|
||||
enclosure.scad
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
|
||||
17
avr/devices/n31/README
Normal file
17
avr/devices/n31/README
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
N31
|
||||
===
|
||||
|
||||
- Role: Air quality sensors
|
||||
- MCU: AtTiny84
|
||||
- Frequency: 1MHz
|
||||
- Connection: RJ45
|
||||
- Predecessor: N26
|
||||
- COM: COM2W
|
||||
- Periphery:
|
||||
- TWI interface
|
||||
- SGP-30/40 air quality sensor
|
||||
- Apps:
|
||||
- NETWORK: Basic network functionality (address setup etc.)
|
||||
- REPORTSENSORS: report sensor data from temperature sensor etc.
|
||||
- STATS : periodically send stats data
|
||||
32
avr/devices/n31/boot/0BUILD
Normal file
32
avr/devices/n31/boot/0BUILD
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n31_boot" >
|
||||
|
||||
<includes type="avrasm" >
|
||||
-I $(builddir)
|
||||
-I $(srcdir)
|
||||
-I $(topsrcdir)/avr
|
||||
-I $(topbuilddir)/avr
|
||||
</includes>
|
||||
|
||||
|
||||
<sources type="avrasm" >
|
||||
boot.asm
|
||||
</sources>
|
||||
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<subdirs>
|
||||
</subdirs>
|
||||
|
||||
<extradist>
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
|
||||
157
avr/devices/n31/boot/boot.asm
Normal file
157
avr/devices/n31/boot/boot.asm
Normal file
@@ -0,0 +1,157 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2026 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; Source file for base system node on AtTiny 84
|
||||
;
|
||||
; This is for the maintenance system (i.e. the flash loader).
|
||||
;
|
||||
; All definitions and changes should go into this file.
|
||||
; ***************************************************************************
|
||||
|
||||
.equ clock=1000000 ; Define the clock frequency
|
||||
|
||||
.nolist
|
||||
.include "include/tn84def.inc" ; Define device ATtiny84
|
||||
.list
|
||||
|
||||
.include "version.asm"
|
||||
.include "../defs.asm"
|
||||
|
||||
.include "common/calls.asm"
|
||||
.include "common/utils_io.asm"
|
||||
.include "devices/all/defs.asm"
|
||||
|
||||
|
||||
#define COM_ACCEPT_ALL_DEST
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; generic
|
||||
|
||||
.include "common/utils_wait.asm"
|
||||
.include "modules/com2/defs.asm"
|
||||
.include "modules/comproto/defs.asm"
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; firmware settings
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED
|
||||
|
||||
.equ LED_DDR = DDRA
|
||||
.equ LED_PORT = PORTA
|
||||
.equ LED_PIN = PINA
|
||||
.equ LED_PINNUM = PORTA3
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code segment
|
||||
|
||||
.cseg
|
||||
.org 0x0000
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Reset and interrupt vectors
|
||||
; rjmp start ; Reset vector
|
||||
rjmp main ; Reset vector
|
||||
reti ; EXT_INT0
|
||||
reti ; PCI0
|
||||
reti ; PCI1
|
||||
reti ; WATCHDOG
|
||||
reti ; ICP1
|
||||
reti ; OC1A
|
||||
reti ; OC1B
|
||||
reti ; OVF1
|
||||
reti ; OC0A
|
||||
reti ; OC0B
|
||||
reti ; OVF0
|
||||
reti ; ACI
|
||||
reti ; ADCC
|
||||
reti ; ERDY
|
||||
reti ; USI_STR
|
||||
reti ; USI_OVF
|
||||
|
||||
|
||||
devInfoBlock: ; 12 bytes
|
||||
devInfoManufacturer: .db 'A', 'Q', 'U', 'A'
|
||||
devInfoId: .db DEVICEINFO_ID, 0
|
||||
devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision
|
||||
firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
|
||||
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
||||
|
||||
firmwareStart: rjmp main ; will be overwritten when flashing
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; main code
|
||||
|
||||
|
||||
.org BOOTLOADER_ADDR
|
||||
|
||||
|
||||
main:
|
||||
rjmp bootLoader ; this routine is in modules/bootloader/main.asm
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; includes
|
||||
|
||||
.include "common/utils_wait_fixed.asm"
|
||||
.include "common/utils_copy_from_flash.asm"
|
||||
.include "common/utils_copy_sdram.asm"
|
||||
|
||||
.include "modules/flash/defs.asm"
|
||||
.include "modules/flash/eeprom.asm"
|
||||
.include "modules/flash/io.asm"
|
||||
.include "modules/flash/io_com2w.asm"
|
||||
.include "modules/flash/flash1p.asm"
|
||||
.include "modules/flash/flashxp.asm"
|
||||
.include "modules/flash/flashprocess.asm"
|
||||
.include "modules/flash/wait.asm"
|
||||
.include "modules/bootloader/main.asm"
|
||||
.include "modules/network/msg/defs.asm"
|
||||
.include "modules/network/msg/crc.asm"
|
||||
|
||||
;.include "common/debug.asm"
|
||||
|
||||
|
||||
|
||||
systemSetSpeed:
|
||||
.if clock == 8000000
|
||||
ldi r16, (1<<CLKPCE)
|
||||
ldi r17, 0
|
||||
out CLKPR, r16
|
||||
out CLKPR, r17
|
||||
.endif
|
||||
|
||||
.if clock == 1000000
|
||||
ldi r16, (1<<CLKPCE)
|
||||
ldi r17, (1<<CLKPS1) | (1<<CLKPS0)
|
||||
out CLKPR, r16
|
||||
out CLKPR, r17
|
||||
.endif
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
114
avr/devices/n31/defs.asm
Normal file
114
avr/devices/n31/defs.asm
Normal file
@@ -0,0 +1,114 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2026 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
;
|
||||
; AtTiny84
|
||||
; --------
|
||||
; VCC 1 14 GND
|
||||
; PB0 2 13 PA0 LED_YELLOW
|
||||
; PB1 3 12 PA1 COM-DATA
|
||||
; /RESET PB3 4 11 PA2 LED_RED
|
||||
; PB2 5 10 PA3 LED_GREEN
|
||||
; COM_CLK PA7 6 9 PA4 TWI-SCL
|
||||
; TWI-SDA PA6 7 8 PA5
|
||||
; --------
|
||||
;
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
.equ BOOTLOADER_ADDR = 0xd00
|
||||
|
||||
.equ FIRMWARE_VARIANT_BOOT = 0
|
||||
.equ FIRMWARE_VARIANT_TEMP_WINDOW = 1
|
||||
|
||||
.equ DEVICEINFO_ID = 'N'
|
||||
.equ DEVICEINFO_VERSION = 31
|
||||
.equ DEVICEINFO_REVISION = 0
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED module
|
||||
|
||||
.equ LED_SIMPLE_ONTIME = 1 ; shorter
|
||||
.equ LED_SIMPLE_OFFTIME = 99 ; longer
|
||||
.equ LED_SIMPLE_DDR = DDRA
|
||||
.equ LED_SIMPLE_PORT = PORTA
|
||||
.equ LED_SIMPLE_PORTIN = PINA
|
||||
.equ LED_SIMPLE_PINNUM = PORTA3
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED Activity module
|
||||
|
||||
.equ LED_ACTIVITY_DDR = DDRA
|
||||
.equ LED_ACTIVITY_PORT = PORTA
|
||||
.equ LED_ACTIVITY_PORTIN = PINA
|
||||
.equ LED_ACTIVITY_PINNUM = PORTA3
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; COM module
|
||||
|
||||
.equ COM_BIT_LENGTH = 52000 ; 104000ns=9600, 52000ns=19200, 26000ns=38400
|
||||
.equ COM_HALFBIT_LENGTH = 26000 ; see https://de.wikipedia.org/wiki/Universal_Asynchronous_Receiver_Transmitter
|
||||
|
||||
.equ COM_DATA_DDR = DDRA
|
||||
.equ COM_DATA_INPUT = PINA
|
||||
.equ COM_DATA_OUTPUT = PORTA
|
||||
.equ COM_DATA_PIN = PORTA1
|
||||
|
||||
.equ COM_CLK_DDR = DDRA
|
||||
.equ COM_CLK_INPUT = PINA
|
||||
.equ COM_CLK_OUTPUT = PORTA
|
||||
.equ COM_CLK_PIN = PORTA7
|
||||
|
||||
.equ COM_IRQ_ADDR_CLK = PCMSK0
|
||||
.equ COM_IRQ_BIT_CLK = PCINT7 ; bit 7 in PCMSK0
|
||||
.equ COM_IRQ_GIFR_CLK = PCIF0
|
||||
.equ COM_IRQ_GIMSK_CLK = PCIE0
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; TWI master module
|
||||
|
||||
;.equ TWI_BIT_LENGTH = 10000 ; 100000 and 200000 works for display: 10000, 100000, 200000
|
||||
.equ TWI_BIT_LENGTH = 1 ; 10, 100, 500, 100000 and 200000 works for display: 10000, 100000, 200000
|
||||
|
||||
.equ TWI_DDR_SCL = DDRA
|
||||
.equ TWI_PORT_SCL = PORTA
|
||||
.equ TWI_PIN_SCL = PINA
|
||||
.equ TWI_PINNUM_SCL = PORTA4
|
||||
|
||||
.equ TWI_DDR_SDA = DDRA
|
||||
.equ TWI_PORT_SDA = PORTA
|
||||
.equ TWI_PIN_SDA = PINA
|
||||
.equ TWI_PINNUM_SDA = PORTA6
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; SGB 30
|
||||
|
||||
.equ SGP30_ADDR = 0x58
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; SGB 40
|
||||
|
||||
.equ SGP40_ADDR = 0x59
|
||||
|
||||
|
||||
244
avr/devices/n31/enclosure.scad
Normal file
244
avr/devices/n31/enclosure.scad
Normal file
@@ -0,0 +1,244 @@
|
||||
$fn = 50;
|
||||
|
||||
width = 45;
|
||||
length = 60;
|
||||
height = 20;
|
||||
|
||||
corner_radius = 2;
|
||||
wall_thickness = 1.5;
|
||||
post_diameter = 8;
|
||||
post_height = 0;
|
||||
|
||||
hole_diameter = 3;
|
||||
|
||||
lid_height = 4;
|
||||
lid_tolerance = .3;
|
||||
|
||||
hook_height = 1;
|
||||
hook_tolerance = 0.75;
|
||||
hook_slit_height = 2.5;
|
||||
|
||||
airslit_height = 1.75;
|
||||
|
||||
ridge_height = 16;
|
||||
ridge_width = 1;
|
||||
ridge_depth = 2.5;
|
||||
|
||||
netconn_width = 17;
|
||||
netcomm_length = 6;
|
||||
netcomm_height = 20;
|
||||
netcomm_tolerance = .3;
|
||||
|
||||
|
||||
|
||||
module posts(x, y, z, h, r){
|
||||
translate([x, y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([-x, y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([-x, -y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([x, -y, z])
|
||||
cylinder(r = r, h = h);
|
||||
}
|
||||
|
||||
|
||||
union() {
|
||||
difference() {
|
||||
// box
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius),
|
||||
y=(length/2 - corner_radius),
|
||||
z=0,
|
||||
h=height,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// hollow
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius - wall_thickness),
|
||||
y=(length/2 - corner_radius - wall_thickness),
|
||||
z=wall_thickness,
|
||||
h=height,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// lip inside box
|
||||
*hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius - lid_lip),
|
||||
y=(length/2 - corner_radius - lid_lip),
|
||||
z=(height - lid_thickness),
|
||||
h=(lid_thickness + 1),
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// ventilation slits left 1
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([(-width/2)-wall_thickness, (-length/4), i])
|
||||
cube([10, length/5, airslit_height], center=true);
|
||||
}
|
||||
|
||||
// ventilation slits top
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([0, -(length/2), i])
|
||||
cube([width/2, 10, airslit_height], center=true);
|
||||
}
|
||||
|
||||
// ventilation slits right 1
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([(width/2)-wall_thickness, (-length/4), i])
|
||||
cube([10, length/5, 1.75], center=true);
|
||||
}
|
||||
|
||||
// network connector hole 1
|
||||
translate([(netconn_width-netcomm_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netcomm_tolerance,
|
||||
netcomm_length,
|
||||
netcomm_height],
|
||||
center=true);
|
||||
|
||||
// network connector hole 2
|
||||
translate([-(netconn_width-netcomm_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netcomm_tolerance,
|
||||
netcomm_length,
|
||||
netcomm_height],
|
||||
center=true);
|
||||
|
||||
// LED holes
|
||||
translate([12, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
translate([4.254, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
translate([-3.484, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// hooks upward facing side
|
||||
translate([-(width/2)-0.25, length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
translate([-(width/2)-0.25, -length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
|
||||
// hooks downward facing side
|
||||
translate([(width/2)+0.25, length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
translate([(width/2)+0.25, -length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
|
||||
// ridges to hold the pcb
|
||||
translate([(width/2)-wall_thickness, 0, ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
translate([-((width/2)-wall_thickness),
|
||||
length/8,
|
||||
ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
translate([-((width/2)-wall_thickness),
|
||||
-length/8,
|
||||
ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* lid */
|
||||
translate([0, 0, 50]) { /* match at Z=16.5, otherwise 50*/
|
||||
difference() {
|
||||
union() {
|
||||
difference() {
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius + wall_thickness + lid_tolerance),
|
||||
y=(length/2 - corner_radius + lid_tolerance),
|
||||
z=0,
|
||||
h=lid_height+wall_thickness,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius ),
|
||||
y=(length/2 - corner_radius)+5,
|
||||
z=-(wall_thickness),
|
||||
h=lid_height+wall_thickness,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// slits for hooks (upward facing side)
|
||||
translate([-((width/2)+wall_thickness/2),
|
||||
length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
translate([-((width/2)+wall_thickness/2),
|
||||
-length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
|
||||
// slits for hooks (downward facing side)
|
||||
translate([(width/2)+(wall_thickness/2),
|
||||
length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
translate([(width/2)+(wall_thickness/2),
|
||||
-length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
}
|
||||
|
||||
|
||||
// hooks downward facing side
|
||||
*translate([(width/2)-lid_lip, 0, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
*translate([(width/2)-lid_lip, length/4, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
*translate([(width/2)-lid_lip, -length/4, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
|
||||
}
|
||||
|
||||
// drilling holes
|
||||
translate([0, 0, -wall_thickness])
|
||||
cylinder(r = hole_diameter, h = 10);
|
||||
|
||||
translate([0, -(length/3), -wall_thickness])
|
||||
cylinder(r = hole_diameter, h = 10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// support posts for pcb
|
||||
/*difference() {
|
||||
translate([0, length/4, wall_thickness])
|
||||
cylinder(r = post_diameter/2, h = post_height);
|
||||
|
||||
translate([0, length/4, wall_thickness])
|
||||
cylinder(r = hole_diameter/2, h = post_height+3);
|
||||
}
|
||||
|
||||
|
||||
difference() {
|
||||
translate([0, -length/4, wall_thickness])
|
||||
cylinder(r = post_diameter/2, h = post_height);
|
||||
|
||||
translate([0, -length/4, wall_thickness])
|
||||
cylinder(r = hole_diameter/2, h = post_height+3);
|
||||
}
|
||||
*/
|
||||
34
avr/devices/n31/main/0BUILD
Normal file
34
avr/devices/n31/main/0BUILD
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n31_firmware" >
|
||||
|
||||
<includes type="avrasm" >
|
||||
-I $(builddir)
|
||||
-I $(srcdir)
|
||||
-I $(topsrcdir)/avr
|
||||
-I $(topbuilddir)/avr
|
||||
</includes>
|
||||
|
||||
|
||||
<sources type="avrasm" >
|
||||
main.asm
|
||||
</sources>
|
||||
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<subdirs>
|
||||
</subdirs>
|
||||
|
||||
<extradist>
|
||||
data.asm
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
|
||||
14
avr/devices/n31/main/data.asm
Normal file
14
avr/devices/n31/main/data.asm
Normal file
@@ -0,0 +1,14 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2025 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
.dseg
|
||||
|
||||
|
||||
215
avr/devices/n31/main/main.asm
Normal file
215
avr/devices/n31/main/main.asm
Normal file
@@ -0,0 +1,215 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2026 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; Source file for temperature sensor node on AtTiny 84
|
||||
;
|
||||
; This is for the full system (i.e. not the boot loader).
|
||||
;
|
||||
; All definitions and changes should go into this file.
|
||||
;
|
||||
;
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
.equ clock=1000000 ; Define the clock frequency
|
||||
;.equ clock=8000000 ; Define the clock frequency
|
||||
|
||||
|
||||
|
||||
.nolist
|
||||
.include "include/tn84def.inc" ; Define device ATtiny84
|
||||
.list
|
||||
|
||||
.include "../defs.asm"
|
||||
.include "./data.asm"
|
||||
|
||||
.include "version.asm"
|
||||
.include "devices/all/defs.asm"
|
||||
.include "common/calls.asm"
|
||||
.include "common/utils_io.asm"
|
||||
.include "common/utils_wait.asm"
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; generic
|
||||
|
||||
.equ NET_BUFFERS_NUM = 6
|
||||
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
|
||||
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; firmware settings including list of modules used
|
||||
|
||||
; #define MODULES_TIMER
|
||||
#define MODULES_CLOCK
|
||||
#define MODULES_LED_SIMPLE
|
||||
;#define MODULES_LED_ACTIVITY
|
||||
#define MODULES_NETWORK
|
||||
;#define MODULES_UART_BITBANG
|
||||
#define MODULES_COM2W
|
||||
#define MODULES_TWI_MASTER
|
||||
;#define MODULES_LCD
|
||||
;#define LCD_MINIMAL_FONT
|
||||
;#define MODULES_SI7021
|
||||
#define MODULES_SGP30
|
||||
;#define MODULES_SGP40
|
||||
;#define MODULES_STATS
|
||||
;#define MODULES_OWI_MASTER
|
||||
;#define MODULES_DS18B20
|
||||
;#define MODULES_MOTION
|
||||
;#define MODULES_CCS811
|
||||
;#define MODULES_BRIGHTNESS
|
||||
|
||||
#define APPS_NETWORK
|
||||
;#define APPS_MOTION
|
||||
#define APPS_REPORTSENSORS
|
||||
#define APPS_STATS
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for values
|
||||
|
||||
;.equ VALUE_ID_SGP40_TVOC = 0x08
|
||||
|
||||
.equ VALUE_ID_SGP30_TVOC = 0x09
|
||||
.equ VALUE_ID_SGP30_CO2 = 0x0a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code segment
|
||||
|
||||
.cseg
|
||||
.org 000000
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Reset and interrupt vectors
|
||||
|
||||
rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system
|
||||
reti ; EXT_INT0
|
||||
rjmp com2wPcintIsr ; PCI0
|
||||
reti ; PCI1
|
||||
reti ; WATCHDOG
|
||||
reti ; ICP1
|
||||
reti ; OC1A
|
||||
reti ; OC1B
|
||||
reti ; OVF1
|
||||
rjmp baseTimerIrqOC0A ; OC0A
|
||||
reti ; OC0B
|
||||
reti ; OVF0
|
||||
reti ; ACI
|
||||
reti ; ADCC
|
||||
reti ; ERDY
|
||||
reti ; USI_STR
|
||||
reti ; USI_OVF
|
||||
|
||||
|
||||
devInfoBlock: ; 12 bytes
|
||||
devInfoManufacturer: .db 'A', 'Q', 'U', 'A'
|
||||
devInfoId: .db DEVICEINFO_ID, 0
|
||||
devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision
|
||||
firmwareVersion: .db FIRMWARE_VARIANT_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR
|
||||
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine firmwareStart @global
|
||||
|
||||
firmwareStart:
|
||||
rjmp main
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine onSystemStart
|
||||
|
||||
onSystemStart:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine onMessageReceived
|
||||
;
|
||||
; Called on every message received
|
||||
|
||||
onMessageReceived:
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine onEvery100ms
|
||||
;
|
||||
; Called every 100ms. Add your routine calls here. No arguments, no results.
|
||||
|
||||
onEvery100ms:
|
||||
onEverySecond:
|
||||
onEveryMinute:
|
||||
onEveryHour:
|
||||
onEveryDay:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine onEveryLoop
|
||||
;
|
||||
; Called on every loop (i.e. after awakening from sleep).
|
||||
;
|
||||
onEveryLoop:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; includes
|
||||
|
||||
.include "devices/all/hw_tn84.asm"
|
||||
.include "devices/all/includes.asm"
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for network interface
|
||||
|
||||
.equ netInterfaceData = com2w_iface
|
||||
|
||||
|
||||
|
||||
deviceCodeEnd:
|
||||
.if deviceCodeEnd >= BOOTLOADER_ADDR
|
||||
.warning "Code reaches into boot loader!"
|
||||
.endif
|
||||
|
||||
BIN
avr/devices/n31/n31-enclosure.stl
Normal file
BIN
avr/devices/n31/n31-enclosure.stl
Normal file
Binary file not shown.
@@ -27,6 +27,7 @@
|
||||
aqua_n28.xml
|
||||
aqua_n29.xml
|
||||
aqua_n30.xml
|
||||
aqua_n31.xml
|
||||
aqua_r05.xml
|
||||
aqua_r06.xml
|
||||
aqua_s03.xml
|
||||
|
||||
12
devices/nodes/aqua_n31.xml
Normal file
12
devices/nodes/aqua_n31.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
<device name="aqua_n31" driver="nodes">
|
||||
<manufacturer>AQUA</manufacturer>
|
||||
<devicetype>N</devicetype>
|
||||
<deviceversion>31</deviceversion>
|
||||
|
||||
<values>
|
||||
<value name="SGP30_TVOC" id="0x09" type="sensor" dataType="rational" modality="tvoc" denom="1" />
|
||||
<value name="SGP30_CO2" id="0x0a" type="sensor" dataType="rational" modality="co2" denom="1" />
|
||||
</values>
|
||||
|
||||
</device>
|
||||
Reference in New Issue
Block a user