# File: leds_autoprog.h

Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.

           1: // This file contains the DCC and LED definitions.
           2: //
           3: // It was automatically generated by the program ProgGenerator Ver. 3.3.2G      by Hardi
           4: // File creation: 05/04/25 09:43:56
           5: // (Attention: The display in the Arduino IDE is not updated if Options/External Editor is disabled)
           6:
           7: #ifndef __LEDS_AUTOPROG_H__
           8: #define __LEDS_AUTOPROG_H__
           9:
          10: #include "MobaLedLib.h"
          11:
          12: #define START_MSG "LEDs_AutoProg Ver 3: AM328 3.3.2G 05.04.25 09:43"
          13:
          14: #define TWO_BUTTONS_PER_ADDRESS 1      // Two buttons (Red/Green) are used (DCC/LNet/CAN)
          15: #ifdef NUM_LEDS
          16:   #warning "'NUM_LEDS' definition in the main program is replaced by the included 'LEDs_AutoProg.h' with 32"
          17:   #undef NUM_LEDS
          18: #endif
          19:
          20: #define NUM_LEDS 32                    // Number of LEDs (Maximal 256 RGB LEDs could be used)
          21:
          22: #define LEDS_PER_CHANNEL ",32"
          23:
          24: #define USE_PROTOCOL_DCC
          25:
          26: #define RECEIVE_LED_COLOR_PER_RS232
          27:
          28: #define GEN_BUTTON_RELEASE
          29: #define GEN_BUTTON_RELEASE_COM GEN_OFF
          30: #define USE_EXT_ADDR
          31: #define USE_RS232_OR_SPI_AS_INPUT      // Use the RS232 or SPI Input to read DCC/SX commands from the second Arduino and from the PC (The SPI is only used if enabled with USE_SPI_COM)
          32: #define ADDR_OFFSET 0
          33:
          34: #define ADDR_MSK  0x3FFF  // 14 Bits are used for the Address
          35:
          36: #define S_ONOFF   (uint16_t)0
          37: #define B_RED     (uint16_t)(1<<14)
          38: #define B_GREEN   (uint16_t)(2<<14)
          39: #define O_RET_MSG (uint16_t)(3<<14)    // Return messages (Rueckmelder)
          40: #define B_TAST    B_RED
          41:
          42:
          43: typedef struct
          44:     {
          45:     uint16_t AddrAndTyp; // Addr range: 0..16383. The upper two bytes are used for the type
          46:     uint8_t  InCnt;
          47:     } __attribute__ ((packed)) Ext_Addr_T;
          48:
          49: // Definition of external adresses
          50: #ifdef CONFIG_ONLY
          51: const Ext_Addr_T Ext_Addr[] __attribute__ ((section (".MLLAddressConfig"))) =
          52: #else
          53: const PROGMEM Ext_Addr_T Ext_Addr[] =
          54: #endif
          55:          { // Addr & Typ    InCnt
          56:            { 100  + S_ONOFF,   1 },      // Excel row 10
          57:          };
          58:
          59:
          60: // Input channel defines for local inputs and expert users
          61: #define INCH_DCC_100_ONOFF      0      // Excel row 10
          62:
          63:
          64: //*** Output Channels ***
          65: #define START_VARIABLES   1                                        // Define the start number for the variables.
          66: #define V1                      1                                        // Z21-RM-Rückmelder: Adresse:1 Eingang:1
          67:
          68:
          69: #define START_SEND_INPUTS 1                                        // Start address of all switches/variables
          70: #define TOTAL_SEND_INPUTS 1                                        // Number of used switches/variables
          71: #define TOTAL_SWITCHES_A  0                                        // Number of used inputs for analog keyboard
          72: #define TOTAL_SWITCHES_B  0                                        // Number of used inputs for keyboard 1
          73: #define TOTAL_SWITCHES_C  0                                        // Number of used inputs for keyboard 2
          74: #define TOTAL_SWITCHES_D  0                                        // Number of used inputs for main board switches
          75: #define TOTAL_VARIABLES   1                                        // Number of used variables
          76: /*********************/
          77: #define SETUP_FASTLED()                                                      \
          78: /*********************/                                                      \
          79:   CLEDController& controller0 = FastLED.addLeds<NEOPIXEL,  6>(leds+  0, 32); \
          80:                                                                              \
          81:   controller0.clearLeds(256);                                                \
          82:   FastLED.setDither(DISABLE_DITHER);       // avoid sending slightly modified brightness values
          83: /*End*/
          84:
          85: // ----- LED to Var -----
          86:   #define USE_LED_TO_VAR
          87:
          88:   #define T_EQUAL_THEN     0
          89:   #define T_NOT_EQUAL_THEN 1
          90:   #define T_LESS_THEN      2
          91:   #define T_GREATER_THAN   3
          92:   #define T_BIN_MASK       4
          93:   #define T_NOT_BIN_MASK   5
          94:
          95:   typedef struct
          96:       {
          97:       uint8_t  Var_Nr;
          98:       uint8_t  LED_Nr;
          99:       uint8_t  Offset_and_Typ; // ---oottt    Offset: 0..2
         100:       uint8_t  Val;
         101:       } __attribute__ ((packed)) LED2Var_Tab_T;
         102:
         103: #ifdef CONFIG_ONLY
         104:   const LED2Var_Tab_T LED2Var_Tab[] __attribute__ ((section (".MLLL2VConfig"))) =
         105: #else
         106:   const PROGMEM LED2Var_Tab_T LED2Var_Tab[] =
         107: #endif
         108:       {
         109:         // Var name           LED_Nr LED Offset   Typ                Compare value
         110:         { V1,                 0,     (0   << 3) | T_GREATER_THAN,    100 }
         111:       };
         112:
         113:
         114:
         115:
         116: //*******************************************************************
         117: // *** Configuration array which defines the behavior of the LEDs ***
         118: MobaLedLib_Configuration()
         119:   {
         120:   RGB_Heartbeat(0)                                                                                            /* LED auf dem Mainboard                                                                                                                                                                       */
         121:   // LED_to_Var(V1, 0, >, 100)                                                                                /* Excel row 4                                                                                                                                                                                 */
         122:   ConstRGB(1, V1, 0, 0, 0, 127, 127, 127)                                                                     /* Excel row 5                                                                                                                                                                                 */
         123:   // #xLEDColorAnim(0,0,500,1000,1000,0,1,0,1,3)                                                              /* Excel row 9                                                                                                                                                                                 */
         124:   APatternT1(2,28,SI_1,3,0,128,0,PM_NORMAL,500,0,0,0,0,0,0,0,0,0)                                             /*     "                                                                                                                                                                                       */
         125:   // Activation: Binary #ServoAnim(2,0,500,20,220,2500,2500,0,0,0,0,1,0,0,0,1)                                /* Excel row 10                                                                                                                                                                                */
         126:   Bin_InCh_to_TmpVar(0, 1)                                                                                    /*     "                                                                                                                                                                                       */
         127:   #define ENABLE_STORE_STATUS()                                                                               /*     "                                                                                                                                                                                       */
         128:   APatternT1(3,28,SI_LocalVar,1,0,128,0,PM_NORMAL,500,20,60,100,140,180,220,180,140,100,60,20  ,0,0,0,0,0,63,128,0,0,0,63) /*     "                                                                                                                                                                          */
         129:   HouseT(4, SI_1, 2, 5, 5, 15, ROOM_DARK, ROOM_WARM_W, NEON_LIGHT, NEON_LIGHTD, GAS_LIGHT2, CANDLE, ROOM_RED) /* Excel row 11                                                                                                                                                                                */
         130:   HouseT(11, SI_1, 2, 5, 5, 15, ROOM_DARK, ROOM_WARM_W, NEON_LIGHT, NEON_LIGHTD, GAS_LIGHT2, CANDLE, ROOM_RED) /* Excel row 12                                                                                                                                                                               */
         131:   HouseT(18, SI_1, 2, 3, 5, 15, ROOM_DARK, ROOM_WARM_W, NEON_LIGHT, NEON_LIGHTD, GAS_LIGHT2, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT, NEON_LIGHT) /* Excel row 13                                                                                     */
         132:
         133:   EndCfg // End of the configuration
         134:   };
         135: //*******************************************************************
         136:
         137: #ifndef COPYLED_OFF
         138: #define COPYLED_OFF 0
         139: #endif
         140:
         141: #ifndef COPYLED_OFF_ONCE
         142: #define COPYLED_OFF_ONCE 1
         143: #endif
         144:
         145: //---------------------------------------------
         146: void Set_Start_Values(MobaLedLib_C &MobaLedLib)
         147: //---------------------------------------------
         148: {
         149: }
         150:
         151:
         152: // if function returns TRUE the calling loop stops
         153: typedef bool(*HandleValue_t) (uint8_t CallbackType, uint8_t ValueId, uint8_t* Value, uint16_t EEPromAddr, uint8_t TargetValueId, uint8_t Options);
         154:
         155:
         156: #define InCnt_MSK  0x003F  // 6 bits are used for the InCnt, 2 bits for the type ttcc cccc => Max InCnt=63
         157: #define IS_COUNTER (uint8_t)0x80
         158: #define IS_PULSE   (uint8_t)0x40
         159: #define IS_TOGGLE  (uint8_t)0x00
         160: #define COUNTER_ID
         161:
         162: typedef struct
         163:     {
         164:     uint8_t TypAndInCnt; // Type bits 7 & 6, InCnt 0..5
         165:     uint8_t Channel;
         166:     } __attribute__ ((packed)) Store_Channel_T;
         167:
         168: // Definition of channels and counters that need to store state in EEProm
         169: const PROGMEM Store_Channel_T Store_Values[] =
         170:          { // Mode + InCnt , Channel
         171:            { IS_TOGGLE + 1 , INCH_DCC_100_ONOFF  },      // Excel row 10
         172:          };
         173:
         174: #ifndef CONFIG_ONLY
         175: #endif // CONFIG_ONLY
         176:
         177:
         178:
         179:
         180:
         181: #endif // __LEDS_AUTOPROG_H__
         182: