added device n30.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
n27
|
||||
n28
|
||||
n29
|
||||
n30
|
||||
r06
|
||||
s03
|
||||
t03
|
||||
|
||||
3
avr/devices/n30/.gitignore
vendored
Normal file
3
avr/devices/n30/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.eep.hex
|
||||
*.obj
|
||||
n30-enclosure.stl
|
||||
18
avr/devices/n30/0BUILD
Normal file
18
avr/devices/n30/0BUILD
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<subdirs>
|
||||
boot
|
||||
main
|
||||
</subdirs>
|
||||
|
||||
<extradist>
|
||||
defs.asm
|
||||
eeprom.asm
|
||||
README
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
18
avr/devices/n30/README
Normal file
18
avr/devices/n30/README
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
N25
|
||||
===
|
||||
|
||||
- Role: LED strip controller
|
||||
- MCU: AtTiny84
|
||||
- Connection: RJ45
|
||||
- Predecessor: N22, N16
|
||||
- UART: uart_bitbang2
|
||||
- Periphery:
|
||||
- LED strip connection (SK6812)
|
||||
- OWI interface
|
||||
- DS18B20 temperature sensor
|
||||
- Apps:
|
||||
- NETWORK: Basic network functionality (address setup etc.)
|
||||
- REPORTSENSORS: report sensor data from temperature sensor etc.
|
||||
- STATS : periodically send stats data
|
||||
- MA_LIGHT : motion activated light
|
||||
32
avr/devices/n30/boot/0BUILD
Normal file
32
avr/devices/n30/boot/0BUILD
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n30_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>
|
||||
|
||||
|
||||
130
avr/devices/n30/boot/boot.asm
Normal file
130
avr/devices/n30/boot/boot.asm
Normal file
@@ -0,0 +1,130 @@
|
||||
; ***************************************************************************
|
||||
; 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 "devices/all/defs.asm"
|
||||
|
||||
.include "common/calls.asm"
|
||||
.include "common/utils_io.asm"
|
||||
.include "common/utils_wait.asm"
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; 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 main ; 1: Reset vector
|
||||
reti ; 2: EXT_INT0
|
||||
reti ; 3: PCI0
|
||||
reti ; 4: PCI1
|
||||
reti ; 5: WDT
|
||||
reti ; 6: TIM1_CAPT
|
||||
reti ; 7: TIM1_COMPA
|
||||
reti ; 8: TIM1_COMPB
|
||||
reti ; 9: TIM1_OVF
|
||||
reti ; 10: TIM0_COMPA
|
||||
reti ; 11: TIM0_COMPB
|
||||
reti ; 12: TIM0_OVF
|
||||
reti ; 13: ANA_COMP
|
||||
reti ; 14: ADC
|
||||
reti ; 15: EE_RDY
|
||||
reti ; 16: USI_STR
|
||||
reti ; 17: 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/flashxp.asm"
|
||||
.include "modules/flash/flash1p.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"
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
100
avr/devices/n30/defs.asm
Normal file
100
avr/devices/n30/defs.asm
Normal file
@@ -0,0 +1,100 @@
|
||||
; ***************************************************************************
|
||||
; 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
|
||||
; OWI PB0 2 13 PA0
|
||||
; LED_Mode (0 for SPI) PB1 3 12 PA1 COM-DATA
|
||||
; PB3 4 11 PA2
|
||||
; PB2 5 10 PA3 LED
|
||||
; COM_CLK PA7 6 9 PA4 LED_CLK
|
||||
; LED_DATA PA6 7 8 PA5
|
||||
; --------
|
||||
;
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
.equ BOOTLOADER_ADDR = 0xd00
|
||||
|
||||
|
||||
.equ FIRMWARE_VARIANT_BOOT = 0
|
||||
.equ FIRMWARE_VARIANT_LEDSTRIPS = 1
|
||||
|
||||
.equ DEVICEINFO_ID = 'N'
|
||||
.equ DEVICEINFO_VERSION = 30
|
||||
.equ DEVICEINFO_REVISION = 0
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED module
|
||||
|
||||
.equ LED_SIMPLE_ONTIME = 1
|
||||
.equ LED_SIMPLE_OFFTIME = 50
|
||||
.equ LED_SIMPLE_DDR = DDRA
|
||||
.equ LED_SIMPLE_PORT = PORTA
|
||||
.equ LED_SIMPLE_PORTIN = PINA
|
||||
.equ LED_SIMPLE_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 (PCINT7)
|
||||
.equ COM_IRQ_GIFR_CLK = PCIF0
|
||||
.equ COM_IRQ_GIMSK_CLK = PCIE0
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; 1-Wire Master
|
||||
;
|
||||
|
||||
.equ OWI_DDR = DDRB
|
||||
.equ OWI_PORTOUT = PORTB
|
||||
.equ OWI_PORTIN = PINB
|
||||
.equ OWI_PINNUM = PORTB0
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED mode pin
|
||||
|
||||
.equ LED_MODE_DDR = DDRB
|
||||
.equ LED_MODE_PORTOUT = PORTB
|
||||
.equ LED_MODE_PORTIN = PINB
|
||||
.equ LED_MODE_PINNUM = PORTB1
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; SK6812
|
||||
|
||||
.equ SK6812_DDR = DDRA
|
||||
.equ SK6812_PORT = PORTA
|
||||
.equ SK6812_PINNUM = PORTA6
|
||||
|
||||
|
||||
13
avr/devices/n30/eeprom.asm
Normal file
13
avr/devices/n30/eeprom.asm
Normal file
@@ -0,0 +1,13 @@
|
||||
; ***************************************************************************
|
||||
; 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
.equ EEPROM_OFFS_SK6812_RGBW = 26 ; 4 bytes
|
||||
|
||||
|
||||
242
avr/devices/n30/enclosure.scad
Normal file
242
avr/devices/n30/enclosure.scad
Normal file
@@ -0,0 +1,242 @@
|
||||
$fn = 50;
|
||||
|
||||
width = 45;
|
||||
length = 65;
|
||||
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;
|
||||
netconn_length = 6;
|
||||
netconn_height = 20;
|
||||
netconn_tolerance = .3;
|
||||
|
||||
powerconn_width = 10;
|
||||
powerconn_height = 10;
|
||||
powerconn_length = 6;
|
||||
powerconn_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);
|
||||
}
|
||||
|
||||
// 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([-8, -(length/2), i])
|
||||
cube([18, 10, airslit_height], center=true);
|
||||
}
|
||||
|
||||
|
||||
// network connector hole 1
|
||||
translate([(netconn_width-netconn_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netconn_tolerance,
|
||||
netconn_length,
|
||||
netconn_height],
|
||||
center=true);
|
||||
|
||||
// network connector hole 2
|
||||
translate([-(netconn_width-netconn_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netconn_tolerance,
|
||||
netconn_length,
|
||||
netconn_height],
|
||||
center=true);
|
||||
|
||||
// power connector hole
|
||||
translate([9.75 /*(powerconn_width+powerconn_tolerance)/2*/,
|
||||
-(length/2),
|
||||
wall_thickness+2+(powerconn_height/2)])
|
||||
cube([powerconn_width+powerconn_tolerance,
|
||||
powerconn_length,
|
||||
powerconn_height+powerconn_tolerance*2],
|
||||
center=true);
|
||||
|
||||
// cable hole
|
||||
translate([(width/2)-3, -12, wall_thickness+10])
|
||||
rotate([00, 90, 0])
|
||||
cylinder(r = 11/2, h = 6);
|
||||
|
||||
// holes for cable binders
|
||||
translate([(width/2)-3, length/4, wall_thickness+12])
|
||||
rotate([00, 90, 0])
|
||||
cylinder(r = 4/2, h = 6);
|
||||
|
||||
translate([(width/2)-3, length/4, wall_thickness+6])
|
||||
rotate([00, 90, 0])
|
||||
cylinder(r = 4/2, h = 6);
|
||||
|
||||
|
||||
// LED hole
|
||||
translate([12, -12.5, -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), 0, 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);
|
||||
}
|
||||
*/
|
||||
33
avr/devices/n30/main/0BUILD
Normal file
33
avr/devices/n30/main/0BUILD
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n30_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>
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
|
||||
221
avr/devices/n30/main/main.asm
Normal file
221
avr/devices/n30/main/main.asm
Normal file
@@ -0,0 +1,221 @@
|
||||
; ***************************************************************************
|
||||
; 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; Source file for LED controller node on AtTiny 84
|
||||
;
|
||||
; This is for the full system (i.e. not the boot loader).
|
||||
; ***************************************************************************
|
||||
|
||||
.equ clock=8000000 ; Define the clock frequency
|
||||
|
||||
|
||||
|
||||
.nolist
|
||||
.include "include/tn84def.inc" ; Define device ATtiny84
|
||||
.list
|
||||
|
||||
.include "version.asm"
|
||||
.include "../defs.asm"
|
||||
.include "../eeprom.asm"
|
||||
;.include "./data.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_CLOCK
|
||||
#define MODULES_LED_SIMPLE
|
||||
#define MODULES_NETWORK
|
||||
#define MODULES_COM2W
|
||||
#define MODULES_OWI_MASTER
|
||||
#define MODULES_DS18B20
|
||||
#define MODULES_SK6812
|
||||
;#define MODULES_MOTION_LIGHT
|
||||
|
||||
#define APPS_NETWORK
|
||||
#define APPS_REPORTSENSORS
|
||||
#define APPS_STATS
|
||||
#define APPS_MA_LIGHT
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for modules
|
||||
|
||||
;.equ VALUE_ID_SI7021_TEMP = 0x01
|
||||
;.equ VALUE_ID_SI7021_HUM = 0x02
|
||||
|
||||
;.equ VALUE_ID_ADC = 0x03
|
||||
;.equ VALUE_ID_REED1 = 0x04
|
||||
;.equ VALUE_ID_REED2 = 0x05
|
||||
.equ VALUE_ID_DS18B20_TEMP = 0x06
|
||||
.equ VALUE_ID_MAL_STATE = 0x07
|
||||
|
||||
|
||||
;.equ VALUE_ID_REED_CONF = 0x81
|
||||
.equ VALUE_ID_LED_STATE = 0x81
|
||||
.equ VALUE_ID_LED_NUMLEDS = 0x82
|
||||
.equ VALUE_ID_LED_RGBW_VALUE = 0x83
|
||||
.equ VALUE_ID_MAL_RGBW_VALUE = 0x84
|
||||
.equ VALUE_ID_MAL_ONTIME = 0x85
|
||||
.equ VALUE_ID_MAL_SOURCE1 = 0x86
|
||||
.equ VALUE_ID_MAL_SOURCE2 = 0x87
|
||||
.equ VALUE_ID_MAL_BSOURCE = 0x89
|
||||
.equ VALUE_ID_MAL_BVALUE = 0x8a
|
||||
.equ VALUE_ID_LED_MODE = 0x8b
|
||||
|
||||
.equ VALUE_ID_LEDSIMPLE_TIMING = 0x88
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code segment
|
||||
|
||||
.cseg
|
||||
.org 000000
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Reset and interrupt vectors
|
||||
|
||||
rjmp BOOTLOADER_ADDR ; 1: Reset vector ; use this for flashed system
|
||||
reti ; 2: EXT_INT0
|
||||
rjmp com2wPcintIsr ; 3: PCI0
|
||||
reti ; 4: PCI1
|
||||
reti ; 5: WDT
|
||||
reti ; 6: TIM1_CAPT
|
||||
reti ; 7: TIM1_COMPA
|
||||
reti ; 8: TIM1_COMPB
|
||||
reti ; 9: TIM1_OVF
|
||||
rjmp baseTimerIrqOC0A ; 10: TIM0_COMPA
|
||||
reti ; 11: TIM0_COMPB
|
||||
reti ; 12: TIM0_OVF
|
||||
reti ; 13: ANA_COMP
|
||||
reti ; 14: ADC
|
||||
reti ; 15: EE_RDY
|
||||
reti ; 16: USI_STR
|
||||
reti ; 17: 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_LEDSTRIPS, 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:
|
||||
onEveryMinute:
|
||||
onEveryHour:
|
||||
onEveryDay:
|
||||
ret
|
||||
; @end
|
||||
|
||||
onEverySecond:
|
||||
ret
|
||||
#if 0
|
||||
; debug
|
||||
ldi r19, 0x00 ; G
|
||||
ldi r18, 0xff ; R
|
||||
ldi r20, 0x55 ; B
|
||||
ldi r21, 0xaa ; W
|
||||
rcall SK6812_SetAllColor ; r23 (r16, r17)
|
||||
#endif
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @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"
|
||||
;.include "common/debug.asm"
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for network interface
|
||||
|
||||
.equ netInterfaceData = com2w_iface
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user