1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Disable device driver version, add myHal example

This commit is contained in:
peteGSX 2022-12-22 07:22:04 +10:00
parent 1c7103c21e
commit c44fb0ac44
4 changed files with 36 additions and 34 deletions

View File

@ -48,7 +48,6 @@
#include "DIAG.h" #include "DIAG.h"
#include "FSH.h" #include "FSH.h"
#include "EX-IOExpanderPins.h" #include "EX-IOExpanderPins.h"
#include "IO_EXIOExpander_version.h"
// Include user defined pin maps in myEX-IOExpander if defined // Include user defined pin maps in myEX-IOExpander if defined
#if __has_include ("myEX-IOExpander.h") #if __has_include ("myEX-IOExpander.h")
@ -141,7 +140,7 @@ private:
void _display() override { void _display() override {
DIAG(F("EX-IOExpander I2C:x%x Configured on Vpins:%d-%d %S"), _i2cAddress, _firstVpin, _firstVpin+_nPins-1, DIAG(F("EX-IOExpander I2C:x%x Configured on Vpins:%d-%d %S"), _i2cAddress, _firstVpin, _firstVpin+_nPins-1,
_deviceState == DEVSTATE_FAILED ? F("OFFLINE") : F("")); _deviceState == DEVSTATE_FAILED ? F("OFFLINE") : F(""));
DIAG(F("EX-IOExpander x%x using driver version %S"), _i2cAddress, EXIO_VERSION); // DIAG(F("EX-IOExpander x%x using driver version %S"), _i2cAddress, EXIO_VERSION);
DIAG(F("EX-IOExpander x%x: Digital Vpins %d-%d, Analogue Vpins %d-%d"), DIAG(F("EX-IOExpander x%x: Digital Vpins %d-%d, Analogue Vpins %d-%d"),
_i2cAddress, _firstVpin, _firstVpin + _numDigitalPins - 1, _firstVpin + _numDigitalPins, _i2cAddress, _firstVpin, _firstVpin + _numDigitalPins - 1, _firstVpin + _numDigitalPins,
_firstVpin + _nPins - 1); _firstVpin + _nPins - 1);

View File

@ -1,10 +0,0 @@
#ifndef IO_EXIOEXPANDER_VERSION_H
#define IO_EXIOEXPANDER_VERSION_H
#include "StringFormatter.h"
#define EXIO_VERSION "0.0.1alpha"
// 0.0.1 Initial version for alpha testing
#endif

View File

@ -1,22 +0,0 @@
/*
* © 2022 Peter Cole. All rights reserved.
*
* This is the example configuration file for a custom EX-IOExpander pin map file.
*
* It is highly recommended to copy this to "myEX-IOExpander.h" and modify to suit your specific
* requirements.
*
* If you are simply using a default definition for a defined microcontroller, then you don't
* need to use this file, and instead can use one of the existing definitions.
*
* Refer to https://dcc-ex.com for the full documentation.
*
* NOTE: Modifications to this file will be overwritten by future software updates.
*/
#ifndef MYEX_IOEXPANDER_H
#define MYEX_IOEXPANDER_H
#define MY_NANO_DIGITAL_PINMAP 2,3,4,5,6,7,8,9,10,11,12,13
#define MY_NANO_ANALOGUE_PINMAP A0,A1,A2,A3
#endif

View File

@ -20,6 +20,8 @@
#include "IO_HCSR04.h" // Ultrasonic range sensor #include "IO_HCSR04.h" // Ultrasonic range sensor
#include "IO_VL53L0X.h" // Laser time-of-flight sensor #include "IO_VL53L0X.h" // Laser time-of-flight sensor
#include "IO_DFPlayer.h" // MP3 sound player #include "IO_DFPlayer.h" // MP3 sound player
//#include "IO_EXTurntable.h" // Turntable-EX turntable controller
// #include "IO_EXIOExpander.h" // EX-IOExpander device driver
//========================================================================== //==========================================================================
@ -160,6 +162,39 @@ void halSetup() {
// DFPlayer::create(10000, 10, Serial1); // DFPlayer::create(10000, 10, Serial1);
//=======================================================================
// The following directive defines an EX-Turntable turntable instance.
//=======================================================================
// EXTurntable::create(VPIN, Number of VPINs, I2C Address)
//
// The parameters are:
// VPIN=600
// Number of VPINs=1 (Note there is no reason to change this)
// I2C address=0x60
//
// Note that the I2C address is defined in the EX-Turntable code, and 0x60 is the default.
//EXTurntable::create(600, 1, 0x60);
//=======================================================================
// The following directive defines an EX-IOExpander instance.
//=======================================================================
// EXIOExpander::create(VPIN, Number of VPINs, I2C Address, Digital pin count, Analogue pin count)
//
// The parameters are:
// VPIN=an available Vpin
// Number of VPINs=Digital pin count + Analogue pin count (must match device in use as per documentation)
// I2C address=an available I2C address (default 0x65)
//
// Note that the I2C address is defined in the EX-IOExpander code, and 0x65 is the default.
// The first example is for an Arduino Nano with the default pin allocations.
// The second example is for an Arduino Uno using all pins as digital only.
//EXIOExpander::create(800, 18, 0x65, EXIO_NANO_DIGITAL_PINS, EXIO_NANO_ANALOGUE_PINS);
//EXIOExpander::create(820, 16, 0x66, 16, 0);
} }
#endif #endif