Skip to content

Commit

Permalink
Add loconet turnout decoder rev a board
Browse files Browse the repository at this point in the history
  • Loading branch information
markatk committed Jul 7, 2024
1 parent 8bae0c6 commit 7d3e4c3
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
71 changes: 71 additions & 0 deletions Arcrail/boards/loconet-turnout-decoder-rev-a.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pragma once

#include "Arduino.h"

//===========================================================================
//======================== Loconet ==========================================
//===========================================================================

#define USE_LOCONET
#define PIN_LOCONET_RX 8
#define PIN_LOCONET_TX 6

//===========================================================================
//======================== Outputs ==========================================
//===========================================================================

#define USE_OUTPUTS
#define OUTPUT_COUNT 20

// outputs 1-20 (no output number 0 because they are labelled on the pcb)
#define OUTPUT_1 10
#define OUTPUT_2 11
#define OUTPUT_3 12
#define OUTPUT_4 13
#define OUTPUT_5 25
#define OUTPUT_6 26
#define OUTPUT_7 14
#define OUTPUT_8 15
#define OUTPUT_9 16
#define OUTPUT_10 17
#define OUTPUT_11 18
#define OUTPUT_12 19
#define OUTPUT_13 0
#define OUTPUT_14 1
#define OUTPUT_15 2
#define OUTPUT_16 7
#define OUTPUT_17 3
#define OUTPUT_18 4
#define OUTPUT_19 23
#define OUTPUT_20 24

// create output pin array
// TODO: Create array in configuration.h with C preprocessor macro
const uint8_t OUTPUTS[OUTPUT_COUNT] = {
OUTPUT_1,
OUTPUT_2,
OUTPUT_3,
OUTPUT_4,
OUTPUT_5,
OUTPUT_6,
OUTPUT_7,
OUTPUT_8,
OUTPUT_9,
OUTPUT_10,
OUTPUT_11,
OUTPUT_12,
OUTPUT_13,
OUTPUT_14,
OUTPUT_15,
OUTPUT_16,
OUTPUT_17,
OUTPUT_18,
OUTPUT_19,
OUTPUT_20};

//===========================================================================
//======================== LEDs =============================================
//===========================================================================

#define STATUS_LED
#define PIN_STATUS_LED 5
3 changes: 3 additions & 0 deletions Arcrail/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// #define BOARD_LOCONET_ACCESSORY_DECODER_REV_D
// #define BOARD_LOCONET_FEEDBACK_DECODER_REV_A
// #define BOARD_LOCONET_FEEDBACK_DECODER_REV_B
// #define BOARD_LOCONET_TURNOUT_DECODER_REV_A

#ifdef BOARD_ARDUINO_UNO
#include "boards/arduino-uno.h"
Expand All @@ -24,6 +25,8 @@
#include "boards/loconet-feedback-decoder-rev-a.h"
#elif defined BOARD_LOCONET_FEEDBACK_DECODER_REV_B
#include "boards/loconet-feedback-decoder-rev-b.h"
#elif defined BOARD_LOCONET_TURNOUT_DECODER_REV_A
#include "boards/loconet-turnout-decoder-rev-a.h"
#else
#error No board defined
#endif
Expand Down
35 changes: 35 additions & 0 deletions boards/loconet-turnout-decoder-rev-a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"build": {
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328pb",
"variant": "standard"
},
"bootloader": {
"efuse": "0xFD",
"file": "optiboot/optiboot_atmega328.hex",
"hfuse": "0xDE",
"lock_bits": "0x0F",
"lfuse": "0xFF",
"unlock_bits": "0x3F"
},
"debug": {
"simavr_target": "atmega328pb",
"avr-stub": {
"speed": 115200
}
},
"frameworks": [
"arduino"
],
"name": "Loconet Turnout Decoder Rev A",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"require_upload_port": true,
"speed": 115200
},
"url": "https://github.com/markatk/loconet-turnout-decoder",
"vendor": "MarkAtk"
}
4 changes: 4 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ build_flags = -D BOARD_LOCONET_FEEDBACK_DECODER_REV_B
[env:loconet-feedback-decoder-rev-b-168A]
board = loconet-feedback-decoder-rev-b-168A
build_flags = -D BOARD_LOCONET_FEEDBACK_DECODER_REV_B

[env:loconet-turnout-decoder-rev-a]
board = loconet-turnout-decoder-rev-a
build_flags = -D BOARD_LOCONET_TURNOUT_DECODER_REV_A

0 comments on commit 7d3e4c3

Please sign in to comment.