mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-01 19:45:24 +02:00
commit 2bbb5c111907cab37e5c068dc18e084f404f2a2e Author: Asbelos <asbelos@btinternet.com> Date: Fri Sep 20 12:13:21 2024 +0100 EXRAIL use neopixel range instead of loop commit 3aabb51888d61d88c3c26a3617eccaa74e3f64d4 Author: Asbelos <asbelos@btinternet.com> Date: Wed Sep 18 17:06:00 2024 +0100 Neopixel signals with blue-tint See Release Notes file commit 8e6fe6df21bc758ee1b715d97c254a4c1488ffe2 Author: Asbelos <asbelos@btinternet.com> Date: Thu Sep 12 08:35:26 2024 +0100 HAL write range commit 66e57b5ab2e7938bf5f97960ab73017749d8fc4b Author: Asbelos <asbelos@btinternet.com> Date: Sun Sep 8 09:26:37 2024 +0100 Killblink on neopixel set. commit 360c42667500fdd93e35e688c7461731bc8dc50d Merge: dd16e0d b026417 Author: Asbelos <asbelos@btinternet.com> Date: Sat Sep 7 16:45:29 2024 +0100 Merge branch 'devel' into devel-pauls-i2c-devices commit dd16e0da972a414cac66755b61b6922691f88030 Author: Asbelos <asbelos@btinternet.com> Date: Sat Sep 7 13:00:26 2024 +0100 Notes commit e823db3d244919f5529d22c71de8f4de834e21dd Author: Asbelos <asbelos@btinternet.com> Date: Sat Sep 7 11:16:30 2024 +0100 Neopixel change to 8,8,8 commit d3d6cc97fb68ee2314a3d4a3e10f92542044c124 Author: Asbelos <asbelos@btinternet.com> Date: Fri Sep 6 13:25:44 2024 +0100 Neopixel <o> cmd commit 03d8d5f93d477246e8ceecf6500133845a0d5129 Author: Asbelos <asbelos@btinternet.com> Date: Fri Sep 6 08:08:18 2024 +0100 Its working!! commit 235f3c82b5c8e94106bc63dfd5f2957b423f1601 Author: Asbelos <asbelos@btinternet.com> Date: Thu Sep 5 22:02:29 2024 +0100 Update IO_NeoPixel.h commit 530b77bbab4605a3fdfdec735ef01d0b56ef543c Author: Asbelos <asbelos@btinternet.com> Date: Tue Sep 3 15:04:40 2024 +0100 NEOPIXEL driver and macros commit 2a895fbbd531e3ee778962eec59144a602cba9bc Author: Asbelos <asbelos@btinternet.com> Date: Tue Sep 3 11:26:17 2024 +0100 First compile neopixel driver commit c6f2db79094d3b0a0c5322c859868e9025bcb6eb Merge: a7df84b 7395aa4 Author: Asbelos <asbelos@btinternet.com> Date: Tue Sep 3 10:07:12 2024 +0100 Merge branch 'devel' into devel-pauls-i2c-devices commit a7df84b01cc474c31356456bc1db220c800743cb Author: Asbelos <asbelos@btinternet.com> Date: Tue Sep 3 09:56:05 2024 +0100 NEOPIXEL EXRAIL commit ead6e5afa11d526d9a366eeb6013e7eaa16bcb76 Author: Asbelos <asbelos@btinternet.com> Date: Tue Sep 3 09:55:36 2024 +0100 NEOPIXEL EXRAIL commit 0cb175544e4771415c22d6bdc5ed0c331ce76f95 Author: pmantoine <pma-github@milleng.com.au> Date: Sat Feb 24 17:29:10 2024 +0800 More TCA8418 commit 208205180193aec382fcc25423fb6a81a078e407 Author: pmantoine <pma-github@milleng.com.au> Date: Sat Feb 24 13:02:34 2024 +0800 TCA8418 initial HAL driver scaffolding
103 lines
3.6 KiB
C
103 lines
3.6 KiB
C
/*
|
|
* © 2022 Paul M. Antoine
|
|
* © 2021 Neil McKechnie
|
|
* © 2021 Harald Barth
|
|
* © 2021 Fred Decker
|
|
* All rights reserved.
|
|
*
|
|
* This file is part of CommandStation-EX
|
|
*
|
|
* This is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* It is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef FSH_h
|
|
#define FSH_h
|
|
|
|
/* This is an architecture support file to manage the differences
|
|
* between the nano/uno.mega and the later nanoEvery, unoWifiRev2 etc
|
|
*
|
|
* IMPORTANT:
|
|
* To maintain portability the main code should NOT contain ANY references
|
|
* to the following:
|
|
*
|
|
* __FlashStringHelper Use FSH instead.
|
|
* PROGMEM use FLASH instead
|
|
* pgm_read_byte_near use GETFLASH instead.
|
|
* pgm_read_word_near use GETFLASHW instead.
|
|
*
|
|
* Also:
|
|
* HIGHFLASH - PROGMEM forced to end of link so needs far pointers.
|
|
* GETHIGHFLASH,GETHIGHFLASHW to access them
|
|
*
|
|
*/
|
|
#include <Arduino.h>
|
|
#ifdef ARDUINO_ARCH_AVR
|
|
// AVR devices have flash memory mapped differently
|
|
// progmem can be accessed by _near functions or _far
|
|
typedef __FlashStringHelper FSH;
|
|
#define FLASH PROGMEM
|
|
#define GETFLASH(addr) pgm_read_byte_near(addr)
|
|
#define STRCPY_P strcpy_P
|
|
#define STRCMP_P strcmp_P
|
|
#define STRNCPY_P strncpy_P
|
|
#define STRNCMP_P strncmp_P
|
|
#define STRLEN_P strlen_P
|
|
|
|
#if defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560)
|
|
// AVR_MEGA memory deliberately placed at end of link may need _far functions
|
|
#define HIGHFLASH __attribute__((section(".fini2")))
|
|
#define HIGHFLASH3 __attribute__((section(".fini3")))
|
|
#define GETFARPTR(data) pgm_get_far_address(data)
|
|
#define GETHIGHFLASH(data,offset) pgm_read_byte_far(GETFARPTR(data)+offset)
|
|
#define GETHIGHFLASHW(data,offset) pgm_read_word_far(GETFARPTR(data)+offset)
|
|
#define COPYHIGHFLASH(target,base,offset,length) \
|
|
memcpy_PF(target,GETFARPTR(base) + offset,length)
|
|
#else
|
|
// AVR_UNO/NANO runtime does not support _far functions so just use _near equivalent
|
|
// as there is no progmem above 32kb anyway.
|
|
#define HIGHFLASH PROGMEM
|
|
#define HIGHFLASH3 PROGMEM
|
|
#define GETFARPTR(data) ((uint32_t)(data))
|
|
#define GETHIGHFLASH(data,offset) pgm_read_byte_near(GETFARPTR(data)+(offset))
|
|
#define GETHIGHFLASHW(data,offset) pgm_read_word_near(GETFARPTR(data)+(offset))
|
|
#define COPYHIGHFLASH(target,base,offset,length) \
|
|
memcpy_P(target,(byte *)base + offset,length)
|
|
#endif
|
|
|
|
#else
|
|
// Non-AVR Flat-memory devices have no need of this support so can be remapped to normal memory access
|
|
#ifdef F
|
|
#undef F
|
|
#endif
|
|
#ifdef FLASH
|
|
#undef FLASH
|
|
#endif
|
|
#define F(str) (str)
|
|
typedef char FSH;
|
|
#define FLASH
|
|
#define HIGHFLASH
|
|
#define HIGHFLASH3
|
|
#define GETFARPTR(data) ((uint32_t)(data))
|
|
#define GETFLASH(addr) (*(const byte *)(addr))
|
|
#define GETHIGHFLASH(data,offset) (*(const byte *)(GETFARPTR(data)+offset))
|
|
#define GETHIGHFLASHW(data,offset) (*(const uint16_t *)(GETFARPTR(data)+offset))
|
|
#define COPYHIGHFLASH(target,base,offset,length) \
|
|
memcpy(target,(byte *)&base + offset,length)
|
|
#define STRCPY_P strcpy
|
|
#define STRCMP_P strcmp
|
|
#define STRNCPY_P strncpy
|
|
#define STRNCMP_P strncmp
|
|
#define STRLEN_P strlen
|
|
#endif
|
|
#endif
|