Skip to content

Commit

Permalink
version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminius committed Mar 15, 2022
1 parent ba0fa35 commit e7034a8
Show file tree
Hide file tree
Showing 25 changed files with 1,508 additions and 5,397 deletions.
54 changes: 33 additions & 21 deletions ALEDD1.ino
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
/* ---------------------------------------------------------------------------------------------
ALEDD 0.4.0 beta (work in progress)
Hardware/Firmware/Sketch/kdevice.xml by E.Burkowski / [email protected], GPL Licensed
Compatible with: KONNEKTING Device Library 1.0.0 beta 4b
Compatible with: KONNEKTING Device Library 1.0.0 RC1
*/

//Board: Arduino Zero (Native USB Port) (Core Version 1.8.11)

/* this libraries are required (click on link and download with library manager):
FlashStorage: http://librarymanager/All#FlashStorage
DimmerControl: http://librarymanager/All#DimmerControl
Adafruit Neopixel: http://librarymanager/All#Adafruit_Neopixel
Adafruit_ZeroDMA: http://librarymanager/All#Zero_DMA
Adafruit Neopixel ZeroDMA 1.0.8: http://librarymanager/All#Adafruit_DMA_neopixel_library
NeoPixel Painter: http://librarymanager/All#NeoPixel_Painter
KONNEKTING Device Library: http://librarymanager/All#Konnekting
KonnektingFlashStorage 1.0.1: http://librarymanager/All#KonnektingFlashStorage //do not install other FlashStorage library!
DimmerControl 1.2.0: http://librarymanager/All#DimmerControl
Adafruit Neopixel 1.10.0: http://librarymanager/All#Adafruit_Neopixel
Adafruit Zero DMA Library 1.1.0: http://librarymanager/All#Zero_DMA
Adafruit DMA neopixel library 1.2.3: http://librarymanager/All#Adafruit_DMA_neopixel_library
NeoPixel Painter 1.0.0: http://librarymanager/All#NeoPixel_Painter
KONNEKTING Device Library 1.0.0-RC1: http://librarymanager/All#Konnekting_device
*/

//developer settings
//#define DEVELOPMENT
//#define FAKE_EEPROM //don't use this ;)
//#define KDEBUG // comment this line to disable DEBUG mode



//#define VIRTUAL_EEPROM //don't use this ;)
#define KDEBUG // comment this line to disable DEBUG mode


#include <DimmerControl.h>
#include <FlashAsEEPROM.h>
#include <Adafruit_NeoPixel_ZeroDMA.h>
#include <NeoPixelPainter.h>

#include "src/KonnektingDeviceLibrary/KonnektingDevice.h"
#include <KonnektingDevice.h>

#include "aledd1.h"
#include "kdevice_ALEDD1.h"
#include "defines.h"

#ifdef KDEBUG
#include "src/KonnektingDeviceLibrary/DebugUtil.h"
#include <DebugUtil.h>
#endif

#ifdef FAKE_EEPROM
#include "fakeEEPROM.h"
#ifdef VIRTUAL_EEPROM
#include "virtualEEPROM.h"
#else
Flash(my_eeprom_storage, 2048);
#endif

//global variables
Expand Down Expand Up @@ -156,7 +162,7 @@ HSV brushcolor;
DimmerControl dimmer;

//make functions known
void showPixels ();
void showPixels();

#include "hsvrgb.h"
#include "animations.h"
Expand All @@ -166,6 +172,7 @@ void showPixels ();
#include "button.h"
#include "knx_events.h"


void setup() {
pinMode(PROG_LED_PIN, OUTPUT);
pinMode(PROG_BUTTON_PIN, INPUT_PULLUP);
Expand All @@ -174,21 +181,26 @@ void setup() {

#ifdef KDEBUG
SerialUSB.begin(115200);
while (!SerialUSB);
while (!SerialUSB);
Debug.setPrintStream(&SerialUSB);
#endif
#ifdef FAKE_EEPROM
initFakeEeprom();
#ifdef VIRTUAL_EEPROM
initVirtualEeprom();
#else
EEPROM.setStorage(&my_eeprom_storage);
#endif

Konnekting.setMemoryReadFunc(&readMemory);
Konnekting.setMemoryWriteFunc(&writeMemory);
Konnekting.setMemoryUpdateFunc(&updateMemory);
Konnekting.setMemoryCommitFunc(&commitMemory);
#ifndef DEVELOPMENT
Konnekting.setPrepareSerialFunc(&prepareSerial);
#endif
Konnekting.init(SerialKNX, &progLed, MANUFACTURER_ID, DEVICE_ID, REVISION);

#ifndef FAKE_EEPROM
for (int i = 0; i < Konnekting.getFreeEepromOffset(); i++) {
#ifndef VIRTUAL_EEPROM
for (int i = 0; i < Konnekting.getMemoryUserSpaceStart(); i++) {
Debug.println(F("\t\twriteMemory(%d,0x%02X);"), i, EEPROM.read(i));
}
#endif
Expand Down
16 changes: 8 additions & 8 deletions KONNEKTING_ALEDD1.kdevice.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KonnektingDevice xmlns="http://konnekting.de/xml/KonnektingDevice/v0">
<Device ManufacturerId="7070" DeviceId="50" Revision="1">
<Device ManufacturerId="7070" DeviceId="50" Revision="1" SystemType="1">
<ManufacturerName>KONNEKTING</ManufacturerName>
<DeviceName>ALEDD1</DeviceName>
<Parameters>
Expand Down Expand Up @@ -493,12 +493,12 @@
<Flags>43</Flags>
</CommObject>
</CommObjects>
<Dependencies>
<!--rgb only-->
<!-- <Dependencies>
<!- -rgb only- ->
<ParameterDependency ParamId="8" TestParamId="0" Test="le" TestValue="52"/>
<ParameterDependency ParamId="9" TestParamId="0" Test="le" TestValue="52"/>
<ParameterDependency ParamId="10" TestParamId="0" Test="le" TestValue="52"/>
<!--rgbw only-->
<!- -rgbw only- ->
<ParameterDependency ParamId="6" TestParamId="0" Test="ge" TestValue="53"/>
<ParameterDependency ParamId="20" TestParamId="0" Test="ge" TestValue="53"/>
<ParameterDependency ParamId="24" TestParamId="0" Test="ge" TestValue="53"/>
Expand All @@ -509,17 +509,17 @@
<ParameterDependency ParamId="48" TestParamId="0" Test="ge" TestValue="53"/>
<ParameterDependency ParamId="54" TestParamId="0" Test="ge" TestValue="53"/>
<ParameterDependency ParamId="60" TestParamId="0" Test="ge" TestValue="53"/>
<!--power supply-->
<!- -power supply- ->
<ParameterDependency ParamId="62" TestParamId="61" Test="eq" TestValue="01"/>
<!--rgbw only-->
<!- -rgbw only- ->
<CommObjectDependency CommObjId="9" TestParamId="0" Test="ge" TestValue="53"/>
<CommObjectDependency CommObjId="11" TestParamId="0" Test="ge" TestValue="53"/>
<CommObjectDependency CommObjId="20" TestParamId="0" Test="ge" TestValue="53"/>
<CommObjectDependency CommObjId="24" TestParamId="0" Test="ge" TestValue="53"/>
<CommObjectDependency CommObjId="28" TestParamId="0" Test="ge" TestValue="53"/>
<CommObjectDependency CommObjId="32" TestParamId="0" Test="ge" TestValue="53"/>
<!--power supply-->
<!- -power supply- ->
<CommObjectDependency CommObjId="33" TestParamId="61" Test="eq" TestValue="01"/>
</Dependencies>
</Dependencies>-->
</Device>
</KonnektingDevice>
19 changes: 16 additions & 3 deletions aledd1.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#ifndef DEVELOPMENT //ALEDD

#include "wiring_private.h" //for pinPeripheral

//create a new Serial on Pins 1=TX and 3=RX
Uart SerialKNX (&sercom2, 3, 1, SERCOM_RX_PAD_1, UART_TX_PAD_2); //+pinPeripheral
//Interrupt handler for SerialKNX
void SERCOM2_Handler()
{
SerialKNX.IrqHandler();
SerialKNX.IrqHandler();
}

//Hardware settings
Expand All @@ -14,19 +17,29 @@ void SERCOM2_Handler()
#define POWER_SUPPLY_PIN 38 //active low
#define EEPROM_EMULATION_SIZE 2048

// custom serial port preparation function
void prepareSerial(){
Debug.println(F("Prepare serial"));
SerialKNX.begin(19200, SERIAL_8E1);
pinPeripheral(3, PIO_SERCOM_ALT);
pinPeripheral(1, PIO_SERCOM_ALT);
Debug.println(F("Prepare serial *DONE*"));
}


#else //test board
//Hardware settings
#define PROG_BUTTON_PIN 7 //active low
#define PROG_LED_PIN 13
#define LED_STRIP_PIN 6 //LED shield
#define POWER_SUPPLY_PIN 8 //active low
#define EEPROM_EMULATION_SIZE 2048
#define SerialKNX Serial
#define SerialKNX Serial1
#endif



#ifndef FAKE_EEPROM
#ifndef VIRTUAL_EEPROM
byte readMemory(int index) {
Debug.println(F("FLASH read on index %d"),index);
return EEPROM.read(index);
Expand Down
9 changes: 4 additions & 5 deletions button.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ void taskOnShortClick(){

//if already programmed, show LED settings
if(!Konnekting.isFactorySetting() && !ledTestMode){
if(Konnekting.isProgState())
showProgrammedLeds();
else
neopixels->clear();
neopixels->show();
neopixels->clear();
neopixels->show();
if(Konnekting.isProgState()) showProgrammedLeds();

}
Debug.println(F("free ram: %d bytes"), Debug.freeRam());
}
Expand Down
Loading

0 comments on commit e7034a8

Please sign in to comment.