Improved M3 firmware try 5

This commit is contained in:
Jonas Niesner
2023-08-28 13:04:11 +02:00
parent 66a6a204c1
commit bfe3561553
20 changed files with 19828 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
/appstate.json
**/.cache/*

View File

@@ -0,0 +1,6 @@
**/tool-bossac-nordicnrf52/*
**/tool-jlink/*
**/tool-openocd/*
**/tool-scons/*
**/tool-sreccat/*
**/toolchain-gccarmnoneeabi/*

View File

@@ -0,0 +1,5 @@
--- /home/jonas/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/none/hex/none_nrf51__softdevice.hex 2020-12-05 15:15:55.000000000 +0100
+++ /home/jonas/Documents/OpenEPaperLink/ARM_Tag_FW/nrf52811_Platformio_2.9/core/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/none/hex/none_nrf51__softdevice.hex 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-:020000040000FA
-:00000001FF

View File

@@ -0,0 +1,5 @@
--- /home/jonas/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/none/hex/none_nrf52__softdevice.hex 2020-12-05 15:15:55.000000000 +0100
+++ /home/jonas/Documents/OpenEPaperLink/ARM_Tag_FW/nrf52811_Platformio_2.9/core/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/none/hex/none_nrf52__softdevice.hex 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-:020000040000FA
-:00000001FF

View File

@@ -0,0 +1,91 @@
--- /home/jonas/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s110/hex/s110_nrf51_8.0.0_licence_agreement.txt 2020-12-09 13:36:16.150521039 +0100
+++ /home/jonas/Documents/OpenEPaperLink/ARM_Tag_FW/nrf52811_Platformio_2.9/core/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s110/hex/s110_nrf51_8.0.0_licence_agreement.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,88 +0,0 @@
-S110/S120 license agreement
-
-NORDIC SEMICONDUCTOR ASA SOFTDEVICE LICENSE AGREEMENT
-License Agreement for the Nordic Semiconductor ASA ("Nordic") S110 and S120 Bluetooth SoftDevice software packages ("SoftDevice").
-You ("You" "Licensee") must carefully and thoroughly read this License Agreement ("Agreement"), and accept to adhere to this Agreement before
-downloading, installing and/or using any software or content in the SoftDevice provided herewith.
-
-YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS
-OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE SOFTDEVICE, IN THIS CASE YOU AGREE THAT THE USE OF
-THE SOFTDEVICE CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS.
-IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE
-INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE SOFTDEVICE.
-
-1. Grant of License
-Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license
-("License"): (a) to use the SoftDevice solely in connection with a Nordic integrated circuit, and (b) to distribute the SoftDevice solely as integrated
-in Licensee Product. Licensee shall not use the SoftDevice for any purpose other than specifically authorized herein. It is a material breach of this
-agreement to use or modify the SoftDevice for use on any wireless connectivity integrated circuit other than a Nordic integrated circuit.
-
-2. Title
-Nordic retains full rights, title, and ownership to the SoftDevice and any and all patents, copyrights, trade secrets, trade names, trademarks, and
-other intellectual property rights in and to the SoftDevice.
-
-3. No Modifications or Reverse Engineering
-Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code
-parts of the SoftDevice including, but not limited to pre-compiled hex files, binaries and object code.
-
-4. Distribution Restrictions
-Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the SoftDevice to any third party.
-Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the SoftDevice as proscribed herein.
-Licensee also agrees that use of and access to the SoftDevice will be strictly limited to the employees and subcontractors of the Licensee
-necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making
-such employees and subcontractors comply with the obligations concerning use and non-disclosure of the SoftDevice.
-
-5. No Other Rights
-Licensee shall use the SoftDevice only in compliance with this Agreement and shall refrain from using the SoftDevice in any way that may be
-contrary to this Agreement.
-
-6. Fees
-Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to
-comply with the Agreement.
-
-7. DISCLAIMER OF WARRANTY
-THE SOFTDEVICE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS
-LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR
-THAT THE SOFTDEVICE WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THERE
-IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE SOFTDEVICE WILL MEET THE
-REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE SOFTDEVICE WILL BE UNINTERRUPTED OR ERROR-FREE.
-LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTDEVICE TO ACHIEVE LICENSEE’S
-INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT.
-
-8. No Support
-Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how,
-bug-fixes or support. Nordic reserves the right to make changes to the SoftDevice without further notice.
-
-9. Limitation of Liability
-In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of
-procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any
-special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract,
-tort, negligence, or other theory of liability arising out of the use of or inability to use the SoftDevice, even if Nordic or its employees or suppliers,
-licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the exclusion or
-limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates’ liability shall be limited to
-USD 50.
-
-10. Breach of Contract
-Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably
-attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both
-direct and indirect costs for Nordic and its licensors.
-
-11. Indemnity
-Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and
-agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensee’s execution of the License and which
-is not due to causes for which Nordic is responsible.
-
-12. Governing Law
-This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett.
-
-13. Assignment
-Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic.
-
-14. Termination
-Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this
-Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any
-other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology.
-
-15. Third party beneficiaries
-Nordic’s licensors are intended third party beneficiaries under this Agreement.

View File

@@ -0,0 +1,99 @@
--- /home/jonas/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s130/hex/s130_nrf51_2.0.1_license-agreement.txt 2020-12-09 13:36:26.965534210 +0100
+++ /home/jonas/Documents/OpenEPaperLink/ARM_Tag_FW/nrf52811_Platformio_2.9/core/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s130/hex/s130_nrf51_2.0.1_license-agreement.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,96 +0,0 @@
-S110/S120/S130/S132 license agreement
-
-
-NORDIC SEMICONDUCTOR ASA SOFTDEVICE LICENSE AGREEMENT
-
-License Agreement for the Nordic Semiconductor ASA ("Nordic") S110, S120, S130 and S132 Bluetooth SoftDevice software packages
-("SoftDevice").
-
-You ("You" "Licensee") must carefully and thoroughly read this License Agreement ("Agreement"), and accept to adhere to this Agreement before
-downloading, installing and/or using any software or content in the SoftDevice provided herewith.
-
-YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS
-OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE SOFTDEVICE, IN THIS CASE YOU AGREE THAT THE USE OF
-THE SOFTDEVICE CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS.
-
-IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE
-INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE SOFTDEVICE.
-
-1. Grant of License
-Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license
-("License"): (a) to use the SoftDevice solely in connection with a Nordic integrated circuit, and (b) to distribute the SoftDevice solely as integrated
-in Licensee Product. Licensee shall not use the SoftDevice for any purpose other than specifically authorized herein. It is a material breach of this
-agreement to use or modify the SoftDevice for use on any wireless connectivity integrated circuit other than a Nordic integrated circuit.
-
-2. Title
-Nordic retains full rights, title, and ownership to the SoftDevice and any and all patents, copyrights, trade secrets, trade names, trademarks, and
-other intellectual property rights in and to the SoftDevice.
-
-3. No Modifications or Reverse Engineering
-Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code
-parts of the SoftDevice including, but not limited to pre-compiled hex files, binaries and object code.
-
-4. Distribution Restrictions
-Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the SoftDevice to any third party.
-Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the SoftDevice as proscribed herein.
-Licensee also agrees that use of and access to the SoftDevice will be strictly limited to the employees and subcontractors of the Licensee
-necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making
-such employees and subcontractors comply with the obligations concerning use and non-disclosure of the SoftDevice.
-
-5. No Other Rights
-Licensee shall use the SoftDevice only in compliance with this Agreement and shall refrain from using the SoftDevice in any way that may be
-contrary to this Agreement.
-
-6. Fees
-Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to
-comply with the Agreement.
-
-7. DISCLAIMER OF WARRANTY
-THE SOFTDEVICE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS
-LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR
-THAT THE SOFTDEVICE WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THERE
-IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE SOFTDEVICE WILL MEET THE
-REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE SOFTDEVICE WILL BE UNINTERRUPTED OR ERROR-FREE.
-LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTDEVICE TO ACHIEVE LICENSEE’S
-INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT.
-
-
-8. No Support
-Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how,
-bug-fixes or support. Nordic reserves the right to make changes to the SoftDevice without further notice.
-
-9. Limitation of Liability
-In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of
-procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any
-special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract,
-tort, negligence, or other theory of liability arising out of the use of or inability to use the SoftDevice, even if Nordic or its employees or suppliers,
-licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the exclusion or
-limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates’ liability shall be limited to
-USD 50.
-
-10. Breach of Contract
-Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably
-attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both
-direct and indirect costs for Nordic and its licensors.
-
-11. Indemnity
-Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and
-agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensee’s execution of the License and which
-is not due to causes for which Nordic is responsible.
-
-12. Governing Law
-This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett.
-
-13. Assignment
-Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic.
-
-14. Termination
-Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this
-Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any
-other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology.
-
-15. Third party beneficiaries
-Nordic’s licensors are intended third party beneficiaries under this Agreement.
-
-

View File

@@ -0,0 +1,99 @@
--- /home/jonas/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s132/hex/s132_nrf52_2.0.1_license-agreement.txt 2020-12-09 13:35:06.338490724 +0100
+++ /home/jonas/Documents/OpenEPaperLink/ARM_Tag_FW/nrf52811_Platformio_2.9/core/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s132/hex/s132_nrf52_2.0.1_license-agreement.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,96 +0,0 @@
-S110/S120/S130/S132 license agreement
-
-
-NORDIC SEMICONDUCTOR ASA SOFTDEVICE LICENSE AGREEMENT
-
-License Agreement for the Nordic Semiconductor ASA ("Nordic") S110, S120, S130 and S132 Bluetooth SoftDevice software packages
-("SoftDevice").
-
-You ("You" "Licensee") must carefully and thoroughly read this License Agreement ("Agreement"), and accept to adhere to this Agreement before
-downloading, installing and/or using any software or content in the SoftDevice provided herewith.
-
-YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS
-OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE SOFTDEVICE, IN THIS CASE YOU AGREE THAT THE USE OF
-THE SOFTDEVICE CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS.
-
-IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE
-INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE SOFTDEVICE.
-
-1. Grant of License
-Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license
-("License"): (a) to use the SoftDevice solely in connection with a Nordic integrated circuit, and (b) to distribute the SoftDevice solely as integrated
-in Licensee Product. Licensee shall not use the SoftDevice for any purpose other than specifically authorized herein. It is a material breach of this
-agreement to use or modify the SoftDevice for use on any wireless connectivity integrated circuit other than a Nordic integrated circuit.
-
-2. Title
-Nordic retains full rights, title, and ownership to the SoftDevice and any and all patents, copyrights, trade secrets, trade names, trademarks, and
-other intellectual property rights in and to the SoftDevice.
-
-3. No Modifications or Reverse Engineering
-Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code
-parts of the SoftDevice including, but not limited to pre-compiled hex files, binaries and object code.
-
-4. Distribution Restrictions
-Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the SoftDevice to any third party.
-Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the SoftDevice as proscribed herein.
-Licensee also agrees that use of and access to the SoftDevice will be strictly limited to the employees and subcontractors of the Licensee
-necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making
-such employees and subcontractors comply with the obligations concerning use and non-disclosure of the SoftDevice.
-
-5. No Other Rights
-Licensee shall use the SoftDevice only in compliance with this Agreement and shall refrain from using the SoftDevice in any way that may be
-contrary to this Agreement.
-
-6. Fees
-Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to
-comply with the Agreement.
-
-7. DISCLAIMER OF WARRANTY
-THE SOFTDEVICE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS
-LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR
-THAT THE SOFTDEVICE WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THERE
-IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE SOFTDEVICE WILL MEET THE
-REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE SOFTDEVICE WILL BE UNINTERRUPTED OR ERROR-FREE.
-LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTDEVICE TO ACHIEVE LICENSEE’S
-INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT.
-
-
-8. No Support
-Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how,
-bug-fixes or support. Nordic reserves the right to make changes to the SoftDevice without further notice.
-
-9. Limitation of Liability
-In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of
-procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any
-special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract,
-tort, negligence, or other theory of liability arising out of the use of or inability to use the SoftDevice, even if Nordic or its employees or suppliers,
-licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the exclusion or
-limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates’ liability shall be limited to
-USD 50.
-
-10. Breach of Contract
-Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably
-attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both
-direct and indirect costs for Nordic and its licensors.
-
-11. Indemnity
-Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and
-agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensee’s execution of the License and which
-is not due to causes for which Nordic is responsible.
-
-12. Governing Law
-This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett.
-
-13. Assignment
-Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic.
-
-14. Termination
-Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this
-Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any
-other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology.
-
-15. Third party beneficiaries
-Nordic’s licensors are intended third party beneficiaries under this Agreement.
-
-

View File

@@ -0,0 +1,109 @@
#include <Arduino.h>
#include "hal.h"
#include "wdt.h"
int8_t startHFCLK(void) {
if (!isHFCLKstable()) {
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1U;
while (!isHFCLKstable())
;
return 0;
} else {
return -1;
}
}
uint8_t isHFCLKstable(void) {
uint32_t stable = (uint32_t)(CLOCK_HFCLKSTAT_STATE_Running << CLOCK_HFCLKSTAT_STATE_Pos) | (CLOCK_HFCLKSTAT_SRC_Xtal << CLOCK_HFCLKSTAT_SRC_Pos);
if (NRF_CLOCK->HFCLKSTAT == stable) {
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
return 1;
} else {
return 0;
}
}
void boardGetOwnMac(uint8_t *mac) {
mac[0] = MAC_ID_1;
mac[1] = MAC_ID_0;
mac[2] = (NRF_UICR->CUSTOMER[0]) & 0xFF;
mac[3] = (NRF_UICR->CUSTOMER[0] >> 8) & 0xFF;
mac[4] = (NRF_UICR->CUSTOMER[0] >> 16) & 0xFF;
mac[5] = (NRF_UICR->CUSTOMER[0] >> 24);
mac[6] = 0;
mac[7] = 0;
uint8_t cksum = 0;
for (uint8_t c = 0; c < 8; c++) {
cksum ^= mac[c];
cksum ^= mac[c] >> 4;
}
mac[0] += cksum & 0x0F;
}
void watchdog_enable(int timeout) {
NRF_WDT->CONFIG = NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | (WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos);
NRF_WDT->CRV = (32768 * timeout) / 1000;
NRF_WDT->RREN |= WDT_RREN_RR0_Msk;
NRF_WDT->TASKS_START = 1;
NRF_WDT->RR[0] = WDT_RR_RR_Reload;
}
uint32_t sleepMsEntry = 0;
void sleepForMs(uint32_t ms) {
// Turn everything off for minimal deep sleep current
radioRxEnable(0);
NRF_CLOCK->TASKS_HFCLKSTOP = 1U;
while ((NRF_CLOCK->HFCLKSTAT & 0x10001) == 0x10001)
;
Serial.end();
yield();
// here we set the rtc to sleep for the time we want
initRTC0(ms);
sleepMsEntry = millis();
while (millis() - sleepMsEntry < ms) {
__WFE();
__SEV();
__WFE();
}
Serial.begin(115200);
}
#define LF_FREQUENCY 32768UL
#define SECONDS(x) ((uint32_t)((LF_FREQUENCY * (float)((float)x / (float)1000)) + 0.5))
uint32_t wakeUpSeconds = 500;
void initRTC0(uint32_t ms) {
NVIC_DisableIRQ(RTC0_IRQn);
NVIC_ClearPendingIRQ(RTC0_IRQn);
NVIC_SetPriority(RTC0_IRQn, 15);
NRF_RTC0->PRESCALER = 0;
NRF_RTC0->INTENSET = RTC_EVTENSET_COMPARE0_Enabled << RTC_EVTENSET_COMPARE0_Pos;
NRF_RTC0->EVTENSET = RTC_INTENSET_COMPARE0_Enabled << RTC_INTENSET_COMPARE0_Pos;
wakeUpSeconds = ms;
NRF_RTC0->CC[0] = NRF_RTC0->COUNTER + SECONDS(wakeUpSeconds);
NVIC_EnableIRQ(RTC0_IRQn);
NRF_RTC0->TASKS_START = 1;
}
#ifdef __cplusplus
extern "C" {
#endif
void RTC0_IRQHandler(void) {
volatile uint32_t dummy;
if (NRF_RTC0->EVENTS_COMPARE[0] == 1) {
NRF_RTC0->EVENTS_COMPARE[0] = 0;
NRF_RTC0->CC[0] = NRF_RTC0->COUNTER + SECONDS(wakeUpSeconds);
dummy = NRF_RTC0->EVENTS_COMPARE[0];
dummy;
NRF_RTC0->TASKS_STOP = 1;
}
}
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,54 @@
#include "zigbee.h"
#include "epd_spi.h"
#define RADIO_FIRST_CHANNEL (11) //2.4-GHz channels start at 11
#define eepromByte spiByte
#define eepromPrvSelect() \
do { \
digitalWrite(FLASH_CS, LOW); \
} while (0)
#define eepromPrvDeselect() \
do { \
digitalWrite(FLASH_CS, HIGH); \
} while (0)
#define LED_RED 16
#define LED_GREEN 17
#define LED_BLUE 18
#define BUTTON1 28
#define BUTTON2 29
#define EPD_RST 4
#define EPD_BS 2
#define EPD_CS 6
#define EPD_DC 5
#define EPD_BUSY 3
#define EPD_CLK 19
#define EPD_MOSI 20
#define NFC_I2C_SDA 8
#define NFC_I2C_SCL 9
#define NFC_POWER 10
#define NFC_IRQ 11
#define FLASH_CS 12
#define FLASH_MISO 13
#define FLASH_CLK 14
#define FLASH_MOSI 15
#define EPD_POWER 7
// Can be used as wanted UART RXD and TXD are used for Debug output
#define DBG_RST 21
#define DBG_DL 22
#define DBG_TXD 25
#define DBG_RXD 26
#define DBG_TEST 27
void initRTC0(uint32_t ms);
int8_t startHFCLK(void);
uint8_t isHFCLKstable(void);
void boardGetOwnMac(uint8_t *mac);
void sleepForMs(uint32_t ms);