mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 04:06:29 +01:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ad847eb53 | ||
|
|
f268c48717 | ||
|
|
a0ebf0d255 | ||
|
|
6fcfe02b28 | ||
|
|
2edbf27033 | ||
|
|
46fb23b70f | ||
|
|
fce6c16153 | ||
|
|
a31e1453d0 | ||
|
|
d17502cb63 | ||
|
|
828679b6f3 | ||
|
|
bff6794303 | ||
|
|
2f86ea54d0 | ||
|
|
80e0d9e5dd | ||
|
|
4d8cfeae63 | ||
|
|
3271f399c9 | ||
|
|
862c08c00b | ||
|
|
77cbf92281 | ||
|
|
c4022e45f9 | ||
|
|
a13c220565 |
4
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/.gitignore
vendored
Normal file
4
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
build
|
||||
*.axf
|
||||
# Allow
|
||||
!*.bin
|
||||
6
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/CMakeLists.txt
Normal file
6
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(OpenEPaperLink_esp32_C6)
|
||||
Binary file not shown.
1
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/flash.bat
Normal file
1
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/flash.bat
Normal file
@@ -0,0 +1 @@
|
||||
idf.py -p COM21 flash monitor
|
||||
@@ -0,0 +1,7 @@
|
||||
idf_component_register( SRCS
|
||||
SRCS "utils.c"
|
||||
SRCS "second_uart.c"
|
||||
SRCS "radio.c"
|
||||
SRCS "led.c"
|
||||
SRCS "main.c"
|
||||
INCLUDE_DIRS ".")
|
||||
26
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/led.c
Normal file
26
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/led.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "led.h"
|
||||
#include "proto.h"
|
||||
|
||||
void init_led()
|
||||
{
|
||||
gpio_config_t led1 = {};
|
||||
led1.intr_type = GPIO_INTR_DISABLE;
|
||||
led1.mode = GPIO_MODE_OUTPUT;
|
||||
led1.pin_bit_mask = ((1ULL<<LED1) | (1ULL<<LED2));
|
||||
led1.pull_down_en = 0;
|
||||
led1.pull_up_en = 0;
|
||||
gpio_config(&led1);
|
||||
}
|
||||
|
||||
void led_set(int nr, bool state)
|
||||
{
|
||||
gpio_set_level(nr, state);
|
||||
}
|
||||
4
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/led.h
Normal file
4
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/led.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void init_led();
|
||||
void led_set(int nr, bool state);
|
||||
715
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c
Normal file
715
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.c
Normal file
@@ -0,0 +1,715 @@
|
||||
// Ported to ESP32-C6 By ATC1441(ATCnetz.de) for OpenEPaperLink at ~08.2023
|
||||
|
||||
#include "main.h"
|
||||
#include <esp_mac.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_ieee802154.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "proto.h"
|
||||
#include "radio.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "second_uart.h"
|
||||
#include "soc/uart_struct.h"
|
||||
#include "soc\lp_uart_reg.h"
|
||||
#include "utils.h"
|
||||
#include "led.h"
|
||||
|
||||
static const char *TAG = "MAIN";
|
||||
|
||||
const uint8_t channelList[6] = {11, 15, 20, 25, 26, 27};
|
||||
|
||||
#define DATATYPE_NOUPDATE 0
|
||||
#define HW_TYPE 0xFF
|
||||
|
||||
#define MAX_PENDING_MACS 250
|
||||
#define HOUSEKEEPING_INTERVAL 60UL
|
||||
|
||||
struct pendingData pendingDataArr[MAX_PENDING_MACS];
|
||||
|
||||
// VERSION GOES HERE!
|
||||
uint16_t version = 0x0017;
|
||||
|
||||
#define RAW_PKT_PADDING 2
|
||||
|
||||
uint8_t radiotxbuffer[128];
|
||||
uint8_t radiorxbuffer[128];
|
||||
|
||||
static uint32_t housekeepingTimer;
|
||||
|
||||
struct blockRequest requestedData = {0}; // holds which data was requested by the tag
|
||||
|
||||
uint8_t dstMac[8]; // target for the block transfer
|
||||
uint16_t dstPan; //
|
||||
|
||||
static uint32_t blockStartTimer = 0; // reference that holds when the AP sends the next block
|
||||
uint32_t nextBlockAttempt = 0; // reference time for when the AP can request a new block from the ESP32
|
||||
uint8_t seq = 0; // holds current sequence number for transmission
|
||||
uint8_t blockbuffer[BLOCK_XFER_BUFFER_SIZE + 5]; // block transfer buffer
|
||||
uint8_t lastAckMac[8] = {0};
|
||||
|
||||
// these variables hold the current mac were talking to
|
||||
#define CONCURRENT_REQUEST_DELAY 1200UL
|
||||
uint32_t lastBlockRequest = 0;
|
||||
uint8_t lastBlockMac[8];
|
||||
|
||||
uint8_t curChannel = 11;
|
||||
uint8_t curPower = 10;
|
||||
|
||||
uint8_t curPendingData = 0;
|
||||
uint8_t curNoUpdate = 0;
|
||||
|
||||
void sendXferCompleteAck(uint8_t *dst);
|
||||
void sendCancelXfer(uint8_t *dst);
|
||||
void espNotifyAPInfo();
|
||||
|
||||
// tools
|
||||
void addCRC(void *p, uint8_t len) {
|
||||
uint8_t total = 0;
|
||||
for (uint8_t c = 1; c < len; c++) {
|
||||
total += ((uint8_t *) p)[c];
|
||||
}
|
||||
((uint8_t *) p)[0] = total;
|
||||
}
|
||||
bool checkCRC(void *p, uint8_t len) {
|
||||
uint8_t total = 0;
|
||||
for (uint8_t c = 1; c < len; c++) {
|
||||
total += ((uint8_t *) p)[c];
|
||||
}
|
||||
return ((uint8_t *) p)[0] == total;
|
||||
}
|
||||
|
||||
uint8_t getPacketType(void *buffer) {
|
||||
struct MacFcs *fcs = buffer;
|
||||
if ((fcs->frameType == 1) && (fcs->destAddrType == 2) && (fcs->srcAddrType == 3) && (fcs->panIdCompressed == 0)) {
|
||||
// broadcast frame
|
||||
uint8_t type = ((uint8_t *) buffer)[sizeof(struct MacFrameBcast)];
|
||||
return type;
|
||||
} else if ((fcs->frameType == 1) && (fcs->destAddrType == 3) && (fcs->srcAddrType == 3) && (fcs->panIdCompressed == 1)) {
|
||||
// normal frame
|
||||
uint8_t type = ((uint8_t *) buffer)[sizeof(struct MacFrameNormal)];
|
||||
return type;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint8_t getBlockDataLength() {
|
||||
uint8_t partNo = 0;
|
||||
for (uint8_t c = 0; c < BLOCK_MAX_PARTS; c++) {
|
||||
if (requestedData.requestedParts[c / 8] & (1 << (c % 8))) {
|
||||
partNo++;
|
||||
}
|
||||
}
|
||||
return partNo;
|
||||
}
|
||||
|
||||
// pendingdata slot stuff
|
||||
int8_t findSlotForMac(const uint8_t *mac) {
|
||||
for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) {
|
||||
if (memcmp(mac, ((uint8_t *) &(pendingDataArr[c].targetMac)), 8) == 0) {
|
||||
if (pendingDataArr[c].attemptsLeft != 0) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int8_t findFreeSlot() {
|
||||
for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) {
|
||||
if (pendingDataArr[c].attemptsLeft == 0) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int8_t findSlotForVer(const uint8_t *ver) {
|
||||
for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) {
|
||||
if (memcmp(ver, ((uint8_t *) &(pendingDataArr[c].availdatainfo.dataVer)), 8) == 0) {
|
||||
if (pendingDataArr[c].attemptsLeft != 0) return c;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void deleteAllPendingDataForVer(const uint8_t *ver) {
|
||||
int8_t slot = -1;
|
||||
do {
|
||||
slot = findSlotForVer(ver);
|
||||
if (slot != -1) pendingDataArr[slot].attemptsLeft = 0;
|
||||
} while (slot != -1);
|
||||
}
|
||||
void deleteAllPendingDataForMac(const uint8_t *mac) {
|
||||
int8_t slot = -1;
|
||||
do {
|
||||
slot = findSlotForMac(mac);
|
||||
if (slot != -1) pendingDataArr[slot].attemptsLeft = 0;
|
||||
} while (slot != -1);
|
||||
}
|
||||
|
||||
void countSlots() {
|
||||
curPendingData = 0;
|
||||
curNoUpdate = 0;
|
||||
for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) {
|
||||
if (pendingDataArr[c].attemptsLeft != 0) {
|
||||
if (pendingDataArr[c].availdatainfo.dataType != 0) {
|
||||
curPendingData++;
|
||||
} else {
|
||||
curNoUpdate++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// processing serial data
|
||||
#define ZBS_RX_WAIT_HEADER 0
|
||||
#define ZBS_RX_WAIT_SDA 1 // send data avail
|
||||
#define ZBS_RX_WAIT_CANCEL 2 // cancel traffic for mac
|
||||
#define ZBS_RX_WAIT_SCP 3 // set channel power
|
||||
#define ZBS_RX_WAIT_BLOCKDATA 4
|
||||
|
||||
bool isSame(uint8_t *in1, char *in2, int len) {
|
||||
bool flag = 1;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (in1[i] != in2[i]) flag = 0;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
int blockPosition = 0;
|
||||
void processSerial(uint8_t lastchar) {
|
||||
static uint8_t cmdbuffer[4];
|
||||
static uint8_t RXState = 0;
|
||||
static uint8_t serialbuffer[48];
|
||||
static uint8_t *serialbufferp;
|
||||
static uint8_t bytesRemain = 0;
|
||||
static uint32_t lastSerial = 0;
|
||||
static uint32_t blockStartTime = 0;
|
||||
if ((RXState != ZBS_RX_WAIT_HEADER) && ((getMillis() - lastSerial) > 1000)) {
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
ESP_LOGI(TAG, "UART Timeout");
|
||||
}
|
||||
lastSerial = getMillis();
|
||||
switch (RXState) {
|
||||
case ZBS_RX_WAIT_HEADER:
|
||||
// shift characters in
|
||||
for (uint8_t c = 0; c < 3; c++) {
|
||||
cmdbuffer[c] = cmdbuffer[c + 1];
|
||||
}
|
||||
cmdbuffer[3] = lastchar;
|
||||
|
||||
if (isSame(cmdbuffer + 1, ">D>", 3)) {
|
||||
pr("ACK>\n");
|
||||
blockStartTime = getMillis();
|
||||
ESP_LOGI(TAG, "Starting BlkData");
|
||||
blockPosition = 0;
|
||||
RXState = ZBS_RX_WAIT_BLOCKDATA;
|
||||
}
|
||||
|
||||
if (isSame(cmdbuffer, "SDA>", 4)) {
|
||||
ESP_LOGI(TAG, "SDA In");
|
||||
RXState = ZBS_RX_WAIT_SDA;
|
||||
bytesRemain = sizeof(struct pendingData);
|
||||
serialbufferp = serialbuffer;
|
||||
break;
|
||||
}
|
||||
if (isSame(cmdbuffer, "CXD>", 4)) {
|
||||
ESP_LOGI(TAG, "CXD In");
|
||||
RXState = ZBS_RX_WAIT_CANCEL;
|
||||
bytesRemain = sizeof(struct pendingData);
|
||||
serialbufferp = serialbuffer;
|
||||
break;
|
||||
}
|
||||
if (isSame(cmdbuffer, "SCP>", 4)) {
|
||||
ESP_LOGI(TAG, "SCP In");
|
||||
RXState = ZBS_RX_WAIT_SCP;
|
||||
bytesRemain = sizeof(struct espSetChannelPower);
|
||||
serialbufferp = serialbuffer;
|
||||
break;
|
||||
}
|
||||
if (isSame(cmdbuffer, "NFO?", 4)) {
|
||||
pr("ACK>");
|
||||
ESP_LOGI(TAG, "NFO? In");
|
||||
espNotifyAPInfo();
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
if (isSame(cmdbuffer, "RDY?", 4)) {
|
||||
pr("ACK>");
|
||||
ESP_LOGI(TAG, "RDY? In");
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
if (isSame(cmdbuffer, "RSET", 4)) {
|
||||
pr("ACK>");
|
||||
ESP_LOGI(TAG, "RSET In");
|
||||
delay(100);
|
||||
// TODO RESET US HERE
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
break;
|
||||
case ZBS_RX_WAIT_BLOCKDATA:
|
||||
blockbuffer[blockPosition++] = 0xAA ^ lastchar;
|
||||
if (blockPosition >= 4100) {
|
||||
ESP_LOGI(TAG, "Blockdata fully received %lu", getMillis() - blockStartTime);
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZBS_RX_WAIT_SDA:
|
||||
*serialbufferp = lastchar;
|
||||
serialbufferp++;
|
||||
bytesRemain--;
|
||||
if (bytesRemain == 0) {
|
||||
if (checkCRC(serialbuffer, sizeof(struct pendingData))) {
|
||||
struct pendingData *pd = (struct pendingData *) serialbuffer;
|
||||
int8_t slot = findSlotForMac(pd->targetMac);
|
||||
if (slot == -1) slot = findFreeSlot();
|
||||
if (slot != -1) {
|
||||
memcpy(&(pendingDataArr[slot]), serialbuffer, sizeof(struct pendingData));
|
||||
pr("ACK>\n");
|
||||
} else {
|
||||
pr("NOQ>\n");
|
||||
}
|
||||
} else {
|
||||
pr("NOK>\n");
|
||||
}
|
||||
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
break;
|
||||
case ZBS_RX_WAIT_CANCEL:
|
||||
*serialbufferp = lastchar;
|
||||
serialbufferp++;
|
||||
bytesRemain--;
|
||||
if (bytesRemain == 0) {
|
||||
if (checkCRC(serialbuffer, sizeof(struct pendingData))) {
|
||||
struct pendingData *pd = (struct pendingData *) serialbuffer;
|
||||
// deleteAllPendingDataForVer((uint8_t *)&pd->availdatainfo.dataVer);
|
||||
deleteAllPendingDataForMac((uint8_t *) &pd->targetMac);
|
||||
pr("ACK>\n");
|
||||
} else {
|
||||
pr("NOK>\n");
|
||||
}
|
||||
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
break;
|
||||
case ZBS_RX_WAIT_SCP:
|
||||
*serialbufferp = lastchar;
|
||||
serialbufferp++;
|
||||
bytesRemain--;
|
||||
if (bytesRemain == 0) {
|
||||
if (checkCRC(serialbuffer, sizeof(struct espSetChannelPower))) {
|
||||
struct espSetChannelPower *scp = (struct espSetChannelPower *) serialbuffer;
|
||||
for (uint8_t c = 0; c < sizeof(channelList); c++) {
|
||||
if (channelList[c] == scp->channel) goto SCPchannelFound;
|
||||
}
|
||||
goto SCPfailed;
|
||||
SCPchannelFound:
|
||||
curChannel = scp->channel;
|
||||
curPower = scp->power;
|
||||
radioSetChannel(scp->channel);
|
||||
radioSetTxPower(scp->power);
|
||||
pr("ACK>\n");
|
||||
} else {
|
||||
SCPfailed:
|
||||
pr("NOK>\n");
|
||||
}
|
||||
RXState = ZBS_RX_WAIT_HEADER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// sending data to the ESP
|
||||
void espBlockRequest(const struct blockRequest *br, uint8_t *src) {
|
||||
struct espBlockRequest *ebr = (struct espBlockRequest *) blockbuffer;
|
||||
uartTx('R');
|
||||
uartTx('Q');
|
||||
uartTx('B');
|
||||
uartTx('>');
|
||||
memcpy(&(ebr->ver), &(br->ver), 8);
|
||||
memcpy(&(ebr->src), src, 8);
|
||||
ebr->blockId = br->blockId;
|
||||
addCRC(ebr, sizeof(struct espBlockRequest));
|
||||
for (uint8_t c = 0; c < sizeof(struct espBlockRequest); c++) {
|
||||
uartTx(((uint8_t *) ebr)[c]);
|
||||
}
|
||||
}
|
||||
void espNotifyAvailDataReq(const struct AvailDataReq *adr, const uint8_t *src) {
|
||||
uartTx('A');
|
||||
uartTx('D');
|
||||
uartTx('R');
|
||||
uartTx('>');
|
||||
|
||||
struct espAvailDataReq eadr = {0};
|
||||
memcpy((void *) eadr.src, (void *) src, 8);
|
||||
memcpy((void *) &eadr.adr, (void *) adr, sizeof(struct AvailDataReq));
|
||||
addCRC(&eadr, sizeof(struct espAvailDataReq));
|
||||
for (uint8_t c = 0; c < sizeof(struct espAvailDataReq); c++) {
|
||||
uartTx(((uint8_t *) &eadr)[c]);
|
||||
}
|
||||
}
|
||||
void espNotifyXferComplete(const uint8_t *src) {
|
||||
struct espXferComplete exfc;
|
||||
memcpy(&exfc.src, src, 8);
|
||||
uartTx('X');
|
||||
uartTx('F');
|
||||
uartTx('C');
|
||||
uartTx('>');
|
||||
addCRC(&exfc, sizeof(exfc));
|
||||
for (uint8_t c = 0; c < sizeof(exfc); c++) {
|
||||
uartTx(((uint8_t *) &exfc)[c]);
|
||||
}
|
||||
}
|
||||
void espNotifyTimeOut(const uint8_t *src) {
|
||||
struct espXferComplete exfc;
|
||||
memcpy(&exfc.src, src, 8);
|
||||
uartTx('X');
|
||||
uartTx('T');
|
||||
uartTx('O');
|
||||
uartTx('>');
|
||||
addCRC(&exfc, sizeof(exfc));
|
||||
for (uint8_t c = 0; c < sizeof(exfc); c++) {
|
||||
uartTx(((uint8_t *) &exfc)[c]);
|
||||
}
|
||||
}
|
||||
void espNotifyAPInfo() {
|
||||
pr("TYP>%02X\n", HW_TYPE);
|
||||
pr("VER>%04X\n", version);
|
||||
pr("MAC>%02X%02X", mSelfMac[0], mSelfMac[1]);
|
||||
pr("%02X%02X", mSelfMac[2], mSelfMac[3]);
|
||||
pr("%02X%02X", mSelfMac[4], mSelfMac[5]);
|
||||
pr("%02X%02X\n", mSelfMac[6], mSelfMac[7]);
|
||||
pr("ZCH>%02X\n", curChannel);
|
||||
pr("ZPW>%02X\n", curPower);
|
||||
countSlots();
|
||||
pr("PEN>%02X\n", curPendingData);
|
||||
pr("NOP>%02X\n", curNoUpdate);
|
||||
}
|
||||
|
||||
// process data from tag
|
||||
void processBlockRequest(const uint8_t *buffer, uint8_t forceBlockDownload) {
|
||||
struct MacFrameNormal *rxHeader = (struct MacFrameNormal *) buffer;
|
||||
struct blockRequest *blockReq = (struct blockRequest *) (buffer + sizeof(struct MacFrameNormal) + 1);
|
||||
if (!checkCRC(blockReq, sizeof(struct blockRequest))) return;
|
||||
|
||||
// check if we're already talking to this mac
|
||||
if (memcmp(rxHeader->src, lastBlockMac, 8) == 0) {
|
||||
lastBlockRequest = getMillis();
|
||||
} else {
|
||||
// we weren't talking to this mac, see if there was a transfer in progress from another mac, recently
|
||||
if ((getMillis() - lastBlockRequest) > CONCURRENT_REQUEST_DELAY) {
|
||||
// mark this mac as the new current mac we're talking to
|
||||
memcpy((void *) lastBlockMac, (void *) rxHeader->src, 8);
|
||||
lastBlockRequest = getMillis();
|
||||
} else {
|
||||
// we're talking to another mac, let this mac know we can't accomodate another request right now
|
||||
pr("BUSY!\n");
|
||||
sendCancelXfer(rxHeader->src);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check if we have data for this mac
|
||||
if (findSlotForMac(rxHeader->src) == -1) {
|
||||
// no data for this mac, politely tell it to fuck off
|
||||
sendCancelXfer(rxHeader->src);
|
||||
return;
|
||||
}
|
||||
|
||||
bool requestDataDownload = false;
|
||||
if ((blockReq->blockId != requestedData.blockId) || (blockReq->ver != requestedData.ver)) {
|
||||
// requested block isn't already in the buffer
|
||||
requestDataDownload = true;
|
||||
} else {
|
||||
// requested block is already in the buffer
|
||||
if (forceBlockDownload) {
|
||||
if ((getMillis() - nextBlockAttempt) > 380) {
|
||||
requestDataDownload = true;
|
||||
pr("FORCED\n");
|
||||
} else {
|
||||
pr("IGNORED\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copy blockrequest into requested data
|
||||
memcpy(&requestedData, blockReq, sizeof(struct blockRequest));
|
||||
|
||||
struct MacFrameNormal *txHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
struct blockRequestAck *blockRequestAck = (struct blockRequestAck *) (radiotxbuffer + sizeof(struct MacFrameNormal) + 2);
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + 1 + sizeof(struct blockRequestAck) + RAW_PKT_PADDING;
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_BLOCK_REQUEST_ACK;
|
||||
|
||||
if (blockStartTimer == 0) {
|
||||
if (requestDataDownload) {
|
||||
// check if we need to download the first block; we need to give the ESP32 some additional time to cache the file
|
||||
if (blockReq->blockId == 0) {
|
||||
blockRequestAck->pleaseWaitMs = 450;
|
||||
} else {
|
||||
blockRequestAck->pleaseWaitMs = 450;
|
||||
}
|
||||
} else {
|
||||
// block is already in buffer
|
||||
blockRequestAck->pleaseWaitMs = 50;
|
||||
}
|
||||
} else {
|
||||
blockRequestAck->pleaseWaitMs = 50;
|
||||
}
|
||||
blockStartTimer = getMillis() + blockRequestAck->pleaseWaitMs;
|
||||
|
||||
memcpy(txHeader->src, mSelfMac, 8);
|
||||
memcpy(txHeader->dst, rxHeader->src, 8);
|
||||
|
||||
txHeader->pan = rxHeader->pan;
|
||||
txHeader->fcs.frameType = 1;
|
||||
txHeader->fcs.panIdCompressed = 1;
|
||||
txHeader->fcs.destAddrType = 3;
|
||||
txHeader->fcs.srcAddrType = 3;
|
||||
txHeader->seq = seq++;
|
||||
|
||||
addCRC((void *) blockRequestAck, sizeof(struct blockRequestAck));
|
||||
|
||||
radioTx(radiotxbuffer);
|
||||
|
||||
// save the target for the blockdata
|
||||
memcpy(dstMac, rxHeader->src, 8);
|
||||
dstPan = rxHeader->pan;
|
||||
|
||||
if (requestDataDownload) {
|
||||
blockPosition = 0;
|
||||
espBlockRequest(&requestedData, rxHeader->src);
|
||||
nextBlockAttempt = getMillis();
|
||||
}
|
||||
}
|
||||
|
||||
void processAvailDataReq(uint8_t *buffer) {
|
||||
struct MacFrameBcast *rxHeader = (struct MacFrameBcast *) buffer;
|
||||
struct AvailDataReq *availDataReq = (struct AvailDataReq *) (buffer + sizeof(struct MacFrameBcast) + 1);
|
||||
|
||||
if (!checkCRC(availDataReq, sizeof(struct AvailDataReq))) return;
|
||||
|
||||
// prepare tx buffer to send a response
|
||||
memset(radiotxbuffer, 0, sizeof(struct MacFrameNormal) + sizeof(struct AvailDataInfo) + 2); // 120);
|
||||
struct MacFrameNormal *txHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
struct AvailDataInfo *availDataInfo = (struct AvailDataInfo *) (radiotxbuffer + sizeof(struct MacFrameNormal) + 2);
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + 1 + sizeof(struct AvailDataInfo) + RAW_PKT_PADDING;
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_AVAIL_DATA_INFO;
|
||||
|
||||
// check to see if we have data available for this mac
|
||||
bool haveData = false;
|
||||
for (uint8_t c = 0; c < MAX_PENDING_MACS; c++) {
|
||||
if (pendingDataArr[c].attemptsLeft) {
|
||||
if (memcmp(pendingDataArr[c].targetMac, rxHeader->src, 8) == 0) {
|
||||
haveData = true;
|
||||
memcpy((void *) availDataInfo, &(pendingDataArr[c].availdatainfo), sizeof(struct AvailDataInfo));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// couldn't find data for this mac
|
||||
if (!haveData) availDataInfo->dataType = DATATYPE_NOUPDATE;
|
||||
|
||||
memcpy(txHeader->src, mSelfMac, 8);
|
||||
memcpy(txHeader->dst, rxHeader->src, 8);
|
||||
txHeader->pan = rxHeader->dstPan;
|
||||
txHeader->fcs.frameType = 1;
|
||||
txHeader->fcs.panIdCompressed = 1;
|
||||
txHeader->fcs.destAddrType = 3;
|
||||
txHeader->fcs.srcAddrType = 3;
|
||||
txHeader->seq = seq++;
|
||||
addCRC(availDataInfo, sizeof(struct AvailDataInfo));
|
||||
radioTx(radiotxbuffer);
|
||||
memset(lastAckMac, 0, 8); // reset lastAckMac, so we can record if we've received exactly one ack packet
|
||||
espNotifyAvailDataReq(availDataReq, rxHeader->src);
|
||||
}
|
||||
void processXferComplete(uint8_t *buffer) {
|
||||
struct MacFrameNormal *rxHeader = (struct MacFrameNormal *) buffer;
|
||||
sendXferCompleteAck(rxHeader->src);
|
||||
if (memcmp(lastAckMac, rxHeader->src, 8) != 0) {
|
||||
memcpy((void *) lastAckMac, (void *) rxHeader->src, 8);
|
||||
espNotifyXferComplete(rxHeader->src);
|
||||
int8_t slot = findSlotForMac(rxHeader->src);
|
||||
if (slot != -1) pendingDataArr[slot].attemptsLeft = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// send block data to the tag
|
||||
void sendPart(uint8_t partNo) {
|
||||
struct MacFrameNormal *frameHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
struct blockPart *blockPart = (struct blockPart *) (radiotxbuffer + sizeof(struct MacFrameNormal) + 2);
|
||||
memset(radiotxbuffer + 1, 0, sizeof(struct blockPart) + sizeof(struct MacFrameNormal));
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_BLOCK_PART;
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + sizeof(struct blockPart) + BLOCK_PART_DATA_SIZE + 1 + RAW_PKT_PADDING;
|
||||
memcpy(frameHeader->src, mSelfMac, 8);
|
||||
memcpy(frameHeader->dst, dstMac, 8);
|
||||
blockPart->blockId = requestedData.blockId;
|
||||
blockPart->blockPart = partNo;
|
||||
memcpy(&(blockPart->data), blockbuffer + (partNo * BLOCK_PART_DATA_SIZE), BLOCK_PART_DATA_SIZE);
|
||||
addCRC(blockPart, sizeof(struct blockPart) + BLOCK_PART_DATA_SIZE);
|
||||
frameHeader->fcs.frameType = 1;
|
||||
frameHeader->fcs.panIdCompressed = 1;
|
||||
frameHeader->fcs.destAddrType = 3;
|
||||
frameHeader->fcs.srcAddrType = 3;
|
||||
frameHeader->seq = seq++;
|
||||
frameHeader->pan = dstPan;
|
||||
radioTx(radiotxbuffer);
|
||||
}
|
||||
void sendBlockData() {
|
||||
if (getBlockDataLength() == 0) {
|
||||
pr("Invalid block request received, 0 parts..\n");
|
||||
requestedData.requestedParts[0] |= 0x01;
|
||||
}
|
||||
uint8_t partNo = 0;
|
||||
while (partNo < BLOCK_MAX_PARTS) {
|
||||
for (uint8_t c = 0; (c < BLOCK_MAX_PARTS) && (partNo < BLOCK_MAX_PARTS); c++) {
|
||||
if (requestedData.requestedParts[c / 8] & (1 << (c % 8))) {
|
||||
sendPart(c);
|
||||
partNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void sendXferCompleteAck(uint8_t *dst) {
|
||||
struct MacFrameNormal *frameHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
memset(radiotxbuffer + 1, 0, sizeof(struct blockPart) + sizeof(struct MacFrameNormal));
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_XFER_COMPLETE_ACK;
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + 1 + RAW_PKT_PADDING;
|
||||
memcpy(frameHeader->src, mSelfMac, 8);
|
||||
memcpy(frameHeader->dst, dst, 8);
|
||||
frameHeader->fcs.frameType = 1;
|
||||
frameHeader->fcs.panIdCompressed = 1;
|
||||
frameHeader->fcs.destAddrType = 3;
|
||||
frameHeader->fcs.srcAddrType = 3;
|
||||
frameHeader->seq = seq++;
|
||||
frameHeader->pan = dstPan;
|
||||
radioTx(radiotxbuffer);
|
||||
}
|
||||
void sendCancelXfer(uint8_t *dst) {
|
||||
struct MacFrameNormal *frameHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
memset(radiotxbuffer + 1, 0, sizeof(struct blockPart) + sizeof(struct MacFrameNormal));
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_CANCEL_XFER;
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + 1 + RAW_PKT_PADDING;
|
||||
memcpy(frameHeader->src, mSelfMac, 8);
|
||||
memcpy(frameHeader->dst, dst, 8);
|
||||
frameHeader->fcs.frameType = 1;
|
||||
frameHeader->fcs.panIdCompressed = 1;
|
||||
frameHeader->fcs.destAddrType = 3;
|
||||
frameHeader->fcs.srcAddrType = 3;
|
||||
frameHeader->seq = seq++;
|
||||
frameHeader->pan = dstPan;
|
||||
radioTx(radiotxbuffer);
|
||||
}
|
||||
void sendPong(void *buf) {
|
||||
struct MacFrameBcast *rxframe = (struct MacFrameBcast *) buf;
|
||||
struct MacFrameNormal *frameHeader = (struct MacFrameNormal *) (radiotxbuffer + 1);
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 1] = PKT_PONG;
|
||||
radiotxbuffer[sizeof(struct MacFrameNormal) + 2] = curChannel;
|
||||
radiotxbuffer[0] = sizeof(struct MacFrameNormal) + 1 + 1 + RAW_PKT_PADDING;
|
||||
memcpy(frameHeader->src, mSelfMac, 8);
|
||||
memcpy(frameHeader->dst, rxframe->src, 8);
|
||||
radiotxbuffer[1] = 0x41; // fast way to set the appropriate bits
|
||||
radiotxbuffer[2] = 0xCC; // normal frame
|
||||
frameHeader->seq = seq++;
|
||||
frameHeader->pan = rxframe->srcPan;
|
||||
radioTx(radiotxbuffer);
|
||||
}
|
||||
|
||||
void app_main(void) {
|
||||
init_nvs();
|
||||
init_led();
|
||||
init_second_uart();
|
||||
|
||||
esp_event_loop_create_default();
|
||||
|
||||
radio_init();
|
||||
|
||||
requestedData.blockId = 0xFF;
|
||||
// clear the array with pending information
|
||||
memset(pendingDataArr, 0, sizeof(pendingDataArr));
|
||||
|
||||
radioSetChannel(curChannel);
|
||||
radioSetTxPower(10);
|
||||
|
||||
pr("RES>\n");
|
||||
pr("RDY>\n");
|
||||
|
||||
housekeepingTimer = getMillis();
|
||||
while (1) {
|
||||
while ((getMillis() - housekeepingTimer) < ((1000 * HOUSEKEEPING_INTERVAL) - 100)) {
|
||||
int8_t ret = commsRxUnencrypted(radiorxbuffer);
|
||||
if (ret > 1) {
|
||||
led_set(LED1, 1);
|
||||
// received a packet, lets see what it is
|
||||
switch (getPacketType(radiorxbuffer)) {
|
||||
case PKT_AVAIL_DATA_REQ:
|
||||
if (ret == 28) {
|
||||
// old version of the AvailDataReq struct, set all the new fields to zero, so it will pass the CRC
|
||||
processAvailDataReq(radiorxbuffer);
|
||||
memset(radiorxbuffer + 1 + sizeof(struct MacFrameBcast) + sizeof(struct oldAvailDataReq), 0,
|
||||
sizeof(struct AvailDataReq) - sizeof(struct oldAvailDataReq) + 2);
|
||||
} else if (ret == 40) {
|
||||
// new version of the AvailDataReq struct
|
||||
processAvailDataReq(radiorxbuffer);
|
||||
}
|
||||
break;
|
||||
case PKT_BLOCK_REQUEST:
|
||||
processBlockRequest(radiorxbuffer, 1);
|
||||
break;
|
||||
case PKT_BLOCK_PARTIAL_REQUEST:
|
||||
processBlockRequest(radiorxbuffer, 0);
|
||||
break;
|
||||
case PKT_XFER_COMPLETE:
|
||||
processXferComplete(radiorxbuffer);
|
||||
break;
|
||||
case PKT_PING:
|
||||
sendPong(radiorxbuffer);
|
||||
break;
|
||||
case PKT_AVAIL_DATA_SHORTREQ:
|
||||
// a short AvailDataReq is basically a very short (1 byte payload) packet that requires little preparation on the tx side, for optimal
|
||||
// battery use bytes of the struct are set 0, so it passes the checksum test, and the ESP32 can detect that no interesting payload is
|
||||
// sent
|
||||
if (ret == 18) {
|
||||
memset(radiorxbuffer + 1 + sizeof(struct MacFrameBcast), 0, sizeof(struct AvailDataReq) + 2);
|
||||
processAvailDataReq(radiorxbuffer);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr("t=%02X\n", getPacketType(radiorxbuffer));
|
||||
break;
|
||||
}
|
||||
led_set(LED1, 0);
|
||||
}
|
||||
uint8_t curr_char;
|
||||
while (getRxCharSecond(&curr_char)) processSerial(curr_char);
|
||||
|
||||
if (blockStartTimer) {
|
||||
// BUG: uint32 overflowing; this will break every once in a while. Don't know how to fix this other than ugly global variables
|
||||
if (getMillis() > blockStartTimer) {
|
||||
sendBlockData();
|
||||
blockStartTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint8_t cCount = 0; cCount < MAX_PENDING_MACS; cCount++) {
|
||||
if (pendingDataArr[cCount].attemptsLeft == 1) {
|
||||
if (pendingDataArr[cCount].availdatainfo.dataType != DATATYPE_NOUPDATE) {
|
||||
espNotifyTimeOut(pendingDataArr[cCount].targetMac);
|
||||
}
|
||||
pendingDataArr[cCount].attemptsLeft = 0;
|
||||
} else if (pendingDataArr[cCount].attemptsLeft > 1) {
|
||||
pendingDataArr[cCount].attemptsLeft--;
|
||||
if (pendingDataArr[cCount].availdatainfo.nextCheckIn) pendingDataArr[cCount].availdatainfo.nextCheckIn--;
|
||||
}
|
||||
}
|
||||
housekeepingTimer = getMillis();
|
||||
}
|
||||
}
|
||||
1
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.h
Normal file
1
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/main.h
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
||||
176
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/proto.h
Normal file
176
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/proto.h
Normal file
@@ -0,0 +1,176 @@
|
||||
#ifndef _PROTO_H_
|
||||
#define _PROTO_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#define LED1 22
|
||||
#define LED2 23
|
||||
|
||||
#define PROTO_PAN_ID (0x4447) // PAN ID compression shall be used
|
||||
|
||||
#define RADIO_MAX_PACKET_LEN (125) // useful payload, not including the crc
|
||||
|
||||
#define ADDR_MODE_NONE (0)
|
||||
#define ADDR_MODE_SHORT (2)
|
||||
#define ADDR_MODE_LONG (3)
|
||||
|
||||
#define FRAME_TYPE_BEACON (0)
|
||||
#define FRAME_TYPE_DATA (1)
|
||||
#define FRAME_TYPE_ACK (2)
|
||||
#define FRAME_TYPE_MAC_CMD (3)
|
||||
|
||||
#define SHORT_MAC_UNUSED (0x10000000UL) // for radioRxFilterCfg's myShortMac
|
||||
|
||||
struct MacFcs {
|
||||
uint8_t frameType : 3;
|
||||
uint8_t secure : 1;
|
||||
uint8_t framePending : 1;
|
||||
uint8_t ackReqd : 1;
|
||||
uint8_t panIdCompressed : 1;
|
||||
uint8_t rfu1 : 1;
|
||||
uint8_t rfu2 : 2;
|
||||
uint8_t destAddrType : 2;
|
||||
uint8_t frameVer : 2;
|
||||
uint8_t srcAddrType : 2;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct MacFrameFromMaster {
|
||||
struct MacFcs fcs;
|
||||
uint8_t seq;
|
||||
uint16_t pan;
|
||||
uint8_t dst[8];
|
||||
uint16_t from;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct MacFrameNormal {
|
||||
struct MacFcs fcs;
|
||||
uint8_t seq;
|
||||
uint16_t pan;
|
||||
uint8_t dst[8];
|
||||
uint8_t src[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct MacFrameBcast {
|
||||
struct MacFcs fcs;
|
||||
uint8_t seq;
|
||||
uint16_t dstPan;
|
||||
uint16_t dstAddr;
|
||||
uint16_t srcPan;
|
||||
uint8_t src[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
#define PKT_AVAIL_DATA_SHORTREQ 0xE3
|
||||
#define PKT_AVAIL_DATA_REQ 0xE5
|
||||
#define PKT_AVAIL_DATA_INFO 0xE6
|
||||
#define PKT_BLOCK_PARTIAL_REQUEST 0xE7
|
||||
#define PKT_BLOCK_REQUEST_ACK 0xE9
|
||||
#define PKT_BLOCK_REQUEST 0xE4
|
||||
#define PKT_BLOCK_PART 0xE8
|
||||
#define PKT_XFER_COMPLETE 0xEA
|
||||
#define PKT_XFER_COMPLETE_ACK 0xEB
|
||||
#define PKT_CANCEL_XFER 0xEC
|
||||
#define PKT_PING 0xED
|
||||
#define PKT_PONG 0xEE
|
||||
|
||||
struct AvailDataReq {
|
||||
uint8_t checksum;
|
||||
uint8_t lastPacketLQI;
|
||||
int8_t lastPacketRSSI;
|
||||
int8_t temperature;
|
||||
uint16_t batteryMv;
|
||||
uint8_t hwType;
|
||||
uint8_t wakeupReason;
|
||||
uint8_t capabilities;
|
||||
uint16_t tagSoftwareVersion;
|
||||
uint8_t currentChannel;
|
||||
uint8_t customMode;
|
||||
uint8_t reserved[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct oldAvailDataReq {
|
||||
uint8_t checksum;
|
||||
uint8_t lastPacketLQI;
|
||||
int8_t lastPacketRSSI;
|
||||
int8_t temperature;
|
||||
uint16_t batteryMv;
|
||||
uint8_t hwType;
|
||||
uint8_t wakeupReason;
|
||||
uint8_t capabilities;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct AvailDataInfo {
|
||||
uint8_t checksum;
|
||||
uint64_t dataVer; // MD5 of potential traffic
|
||||
uint32_t dataSize;
|
||||
uint8_t dataType;
|
||||
uint8_t dataTypeArgument; // extra specification or instruction for the tag (LUT to be used for drawing image)
|
||||
uint16_t nextCheckIn; // when should the tag check-in again? Measured in minutes
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct pendingData {
|
||||
struct AvailDataInfo availdatainfo;
|
||||
uint16_t attemptsLeft;
|
||||
uint8_t targetMac[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct blockPart {
|
||||
uint8_t checksum;
|
||||
uint8_t blockId;
|
||||
uint8_t blockPart;
|
||||
uint8_t data[];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct blockData {
|
||||
uint16_t size;
|
||||
uint16_t checksum;
|
||||
uint8_t data[];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct burstMacData {
|
||||
uint16_t offset;
|
||||
uint8_t targetMac[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
#define BLOCK_PART_DATA_SIZE 99
|
||||
#define BLOCK_MAX_PARTS 42
|
||||
#define BLOCK_DATA_SIZE 4096UL
|
||||
#define BLOCK_XFER_BUFFER_SIZE BLOCK_DATA_SIZE + sizeof(struct blockData)
|
||||
#define BLOCK_REQ_PARTS_BYTES 6
|
||||
|
||||
struct blockRequest {
|
||||
uint8_t checksum;
|
||||
uint64_t ver;
|
||||
uint8_t blockId;
|
||||
uint8_t type;
|
||||
uint8_t requestedParts[BLOCK_REQ_PARTS_BYTES];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct blockRequestAck {
|
||||
uint8_t checksum;
|
||||
uint16_t pleaseWaitMs;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct espBlockRequest {
|
||||
uint8_t checksum;
|
||||
uint64_t ver;
|
||||
uint8_t blockId;
|
||||
uint8_t src[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct espXferComplete {
|
||||
uint8_t checksum;
|
||||
uint8_t src[8];
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct espAvailDataReq {
|
||||
uint8_t checksum;
|
||||
uint8_t src[8];
|
||||
struct AvailDataReq adr;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct espSetChannelPower {
|
||||
uint8_t checksum;
|
||||
uint8_t channel;
|
||||
uint8_t power;
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
#endif
|
||||
95
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/radio.c
Normal file
95
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/radio.c
Normal file
@@ -0,0 +1,95 @@
|
||||
#include <esp_mac.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_ieee802154.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "main.h"
|
||||
#include "proto.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/uart_struct.h"
|
||||
#include "soc\lp_uart_reg.h"
|
||||
#include "radio.h"
|
||||
#include "utils.h"
|
||||
#include "led.h"
|
||||
|
||||
static const char *TAG = "RADIO";
|
||||
|
||||
uint8_t mSelfMac[8];
|
||||
volatile uint8_t isInTransmit = 0;
|
||||
QueueHandle_t packet_bufer = NULL;
|
||||
|
||||
void esp_ieee802154_receive_done(uint8_t *frame, esp_ieee802154_frame_info_t *frame_info) {
|
||||
ESP_EARLY_LOGI(TAG, "RX <- : %d", frame[0]);
|
||||
BaseType_t xHigherPriorityTaskWoken ;
|
||||
static uint8_t inner_rxPKT[130];
|
||||
memcpy(inner_rxPKT, &frame[0], frame[0] + 1);
|
||||
xQueueSendFromISR(packet_bufer, (void *) &inner_rxPKT, &xHigherPriorityTaskWoken );
|
||||
portYIELD_FROM_ISR_ARG(xHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
void esp_ieee802154_transmit_failed(const uint8_t *frame, esp_ieee802154_tx_error_t error) {
|
||||
isInTransmit = 0;
|
||||
ESP_EARLY_LOGE(TAG, "TX Err: %d", error);
|
||||
}
|
||||
|
||||
void esp_ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info) {
|
||||
isInTransmit = 0;
|
||||
ESP_EARLY_LOGI(TAG, "TX -> : %d", frame[0]);
|
||||
}
|
||||
|
||||
void radio_init()
|
||||
{
|
||||
packet_bufer = xQueueCreate(32, 130);
|
||||
esp_ieee802154_enable();
|
||||
radioSetChannel(11);
|
||||
esp_ieee802154_set_panid(PROTO_PAN_ID);
|
||||
esp_ieee802154_set_promiscuous(false); // Filter for our mac and PAN
|
||||
esp_ieee802154_set_coordinator(false);
|
||||
esp_ieee802154_set_pending_mode(ESP_IEEE802154_AUTO_PENDING_ZIGBEE);
|
||||
esp_read_mac(mSelfMac, ESP_MAC_IEEE802154);
|
||||
esp_ieee802154_set_extended_address(mSelfMac);
|
||||
esp_ieee802154_set_short_address(0xFFFE);
|
||||
esp_ieee802154_set_rx_when_idle(true);
|
||||
esp_ieee802154_receive();
|
||||
}
|
||||
|
||||
uint32_t lastZbTx = 0;
|
||||
bool radioTx(uint8_t *packet)
|
||||
{
|
||||
static uint8_t txPKT[130];
|
||||
led_set(LED2, 1);
|
||||
while (isInTransmit) {
|
||||
}
|
||||
while (getMillis() - lastZbTx < 6) {
|
||||
}
|
||||
memcpy(txPKT, packet, packet[0]);
|
||||
isInTransmit = 1;
|
||||
lastZbTx = getMillis();
|
||||
esp_ieee802154_transmit(txPKT, false);
|
||||
led_set(LED2, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void radioSetChannel(uint8_t ch) { esp_ieee802154_set_channel(ch); }
|
||||
|
||||
void radioSetTxPower(uint8_t power) {}
|
||||
|
||||
int8_t commsRxUnencrypted(uint8_t *data) {
|
||||
static uint8_t inner_rxPKT_out[130];
|
||||
if (xQueueReceive(packet_bufer, (void *) &inner_rxPKT_out, pdMS_TO_TICKS(100)) == pdTRUE) {
|
||||
memcpy(data, &inner_rxPKT_out[1], inner_rxPKT_out[0] + 1);
|
||||
return inner_rxPKT_out[0] - 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
9
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/radio.h
Normal file
9
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/radio.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
extern uint8_t mSelfMac[8];
|
||||
|
||||
void radio_init();
|
||||
bool radioTx(uint8_t *packet);
|
||||
void radioSetChannel(uint8_t ch);
|
||||
void radioSetTxPower(uint8_t power);
|
||||
int8_t commsRxUnencrypted(uint8_t *data);
|
||||
260
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/second_uart.c
Normal file
260
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/second_uart.c
Normal file
@@ -0,0 +1,260 @@
|
||||
#include <esp_mac.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_ieee802154.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "main.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "proto.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/uart_struct.h"
|
||||
#include "soc\lp_uart_reg.h"
|
||||
|
||||
static const char *TAG = "SECOND_UART";
|
||||
|
||||
#define BUF_SIZE (1024)
|
||||
#define RD_BUF_SIZE (BUF_SIZE)
|
||||
static QueueHandle_t uart0_queue;
|
||||
|
||||
#define MAX_BUFF_POS 8000
|
||||
volatile int curr_buff_pos = 0;
|
||||
volatile int worked_buff_pos = 0;
|
||||
volatile uint8_t buff_pos[MAX_BUFF_POS + 5];
|
||||
|
||||
|
||||
|
||||
static void uart_event_task(void *pvParameters);
|
||||
void init_second_uart() {
|
||||
uart_config_t uart_config = {
|
||||
.baud_rate = 115200,
|
||||
.data_bits = UART_DATA_8_BITS,
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||
.source_clk = UART_SCLK_DEFAULT,
|
||||
};
|
||||
ESP_ERROR_CHECK(uart_driver_install(1, BUF_SIZE * 2, BUF_SIZE * 2, 20, &uart0_queue, 0));
|
||||
ESP_ERROR_CHECK(uart_param_config(1, &uart_config));
|
||||
ESP_ERROR_CHECK(uart_set_pin(1, 3, 2, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
||||
|
||||
xTaskCreate(uart_event_task, "uart_event_task", 16384, NULL, 12, NULL);
|
||||
}
|
||||
|
||||
void uartTx(uint8_t data) { uart_write_bytes(1, (const char *) &data, 1); }
|
||||
|
||||
|
||||
bool getRxCharSecond(uint8_t *newChar) {
|
||||
if (curr_buff_pos != worked_buff_pos) {
|
||||
*newChar = buff_pos[worked_buff_pos];
|
||||
worked_buff_pos++;
|
||||
worked_buff_pos %= MAX_BUFF_POS;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void uart_event_task(void *pvParameters) {
|
||||
uart_event_t event;
|
||||
uint8_t *dtmp = (uint8_t *) malloc(RD_BUF_SIZE);
|
||||
for (;;) {
|
||||
if (xQueueReceive(uart0_queue, (void *) &event, (TickType_t) portMAX_DELAY)) {
|
||||
bzero(dtmp, RD_BUF_SIZE);
|
||||
switch (event.type) {
|
||||
case UART_DATA:
|
||||
uart_read_bytes(1, dtmp, event.size, portMAX_DELAY);
|
||||
for (int i = 0; i < event.size; i++) {
|
||||
buff_pos[curr_buff_pos] = dtmp[i];
|
||||
curr_buff_pos++;
|
||||
curr_buff_pos %= MAX_BUFF_POS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ESP_LOGI(TAG, "uart event type: %d", event.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(dtmp);
|
||||
dtmp = NULL;
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
static void printchar(char **str, int c) {
|
||||
if (str) {
|
||||
**str = c;
|
||||
++(*str);
|
||||
} else {
|
||||
uart_write_bytes(1, (const char *) &c, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#define PAD_RIGHT 1
|
||||
#define PAD_ZERO 2
|
||||
|
||||
static int prints(char **out, const char *string, int width, int pad) {
|
||||
register int pc = 0, padchar = ' ';
|
||||
|
||||
if (width > 0) {
|
||||
register int len = 0;
|
||||
register const char *ptr;
|
||||
for (ptr = string; *ptr; ++ptr) ++len;
|
||||
if (len >= width)
|
||||
width = 0;
|
||||
else
|
||||
width -= len;
|
||||
if (pad & PAD_ZERO) padchar = '0';
|
||||
}
|
||||
if (!(pad & PAD_RIGHT)) {
|
||||
for (; width > 0; --width) {
|
||||
printchar(out, padchar);
|
||||
++pc;
|
||||
}
|
||||
}
|
||||
for (; *string; ++string) {
|
||||
printchar(out, *string);
|
||||
++pc;
|
||||
}
|
||||
for (; width > 0; --width) {
|
||||
printchar(out, padchar);
|
||||
++pc;
|
||||
}
|
||||
|
||||
return pc;
|
||||
}
|
||||
|
||||
/* the following should be enough for 32 bit int */
|
||||
#define PRINT_BUF_LEN 12
|
||||
|
||||
static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase) {
|
||||
char print_buf[PRINT_BUF_LEN];
|
||||
register char *s;
|
||||
register int t, neg = 0, pc = 0;
|
||||
register unsigned int u = i;
|
||||
|
||||
if (i == 0) {
|
||||
print_buf[0] = '0';
|
||||
print_buf[1] = '\0';
|
||||
return prints(out, print_buf, width, pad);
|
||||
}
|
||||
|
||||
if (sg && b == 10 && i < 0) {
|
||||
neg = 1;
|
||||
u = -i;
|
||||
}
|
||||
|
||||
s = print_buf + PRINT_BUF_LEN - 1;
|
||||
*s = '\0';
|
||||
|
||||
while (u) {
|
||||
t = u % b;
|
||||
if (t >= 10) t += letbase - '0' - 10;
|
||||
*--s = t + '0';
|
||||
u /= b;
|
||||
}
|
||||
|
||||
if (neg) {
|
||||
if (width && (pad & PAD_ZERO)) {
|
||||
printchar(out, '-');
|
||||
++pc;
|
||||
--width;
|
||||
} else {
|
||||
*--s = '-';
|
||||
}
|
||||
}
|
||||
|
||||
return pc + prints(out, s, width, pad);
|
||||
}
|
||||
|
||||
static int print(char **out, const char *format, va_list args) {
|
||||
register int width, pad;
|
||||
register int pc = 0;
|
||||
char scr[2];
|
||||
|
||||
for (; *format != 0; ++format) {
|
||||
if (*format == '%') {
|
||||
++format;
|
||||
width = pad = 0;
|
||||
if (*format == '\0') break;
|
||||
if (*format == '%') goto out;
|
||||
if (*format == '-') {
|
||||
++format;
|
||||
pad = PAD_RIGHT;
|
||||
}
|
||||
while (*format == '0') {
|
||||
++format;
|
||||
pad |= PAD_ZERO;
|
||||
}
|
||||
for (; *format >= '0' && *format <= '9'; ++format) {
|
||||
width *= 10;
|
||||
width += *format - '0';
|
||||
}
|
||||
if (*format == 's') {
|
||||
register char *s = (char *) va_arg(args, int);
|
||||
pc += prints(out, s ? s : "(null)", width, pad);
|
||||
continue;
|
||||
}
|
||||
if (*format == 'd') {
|
||||
pc += printi(out, va_arg(args, int), 10, 1, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if (*format == 'x') {
|
||||
pc += printi(out, va_arg(args, int), 16, 0, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if (*format == 'X') {
|
||||
pc += printi(out, va_arg(args, int), 16, 0, width, pad, 'A');
|
||||
continue;
|
||||
}
|
||||
if (*format == 'u') {
|
||||
pc += printi(out, va_arg(args, int), 10, 0, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if (*format == 'c') {
|
||||
/* char are converted to int then pushed on the stack */
|
||||
scr[0] = (char) va_arg(args, int);
|
||||
scr[1] = '\0';
|
||||
pc += prints(out, scr, width, pad);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
out:
|
||||
printchar(out, *format);
|
||||
++pc;
|
||||
}
|
||||
}
|
||||
if (out) **out = '\0';
|
||||
va_end(args);
|
||||
return pc;
|
||||
}
|
||||
|
||||
int u_printf(const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
print(0, format, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int u_sprintf(char *out, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
return print(&out, format, args);
|
||||
}
|
||||
|
||||
void u_array_printf(unsigned char *data, unsigned int len) {
|
||||
u_printf("{");
|
||||
for (int i = 0; i < len; ++i) {
|
||||
u_printf("%X%s", data[i], i < (len) -1 ? ":" : " ");
|
||||
}
|
||||
u_printf("}\n");
|
||||
}
|
||||
14
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/second_uart.h
Normal file
14
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/second_uart.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
void init_second_uart();
|
||||
|
||||
void uartTx(uint8_t data);
|
||||
bool getRxCharSecond(uint8_t *newChar);
|
||||
|
||||
int u_printf(const char *fmt, ...);
|
||||
int u_sprintf(char *s, const char *fmt, ...);
|
||||
void u_array_printf(unsigned char *data, unsigned int len);
|
||||
|
||||
#define pr u_printf
|
||||
#define sprf u_sprintf
|
||||
#define array_prf u_array_printf
|
||||
36
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/utils.c
Normal file
36
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/utils.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <esp_mac.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_ieee802154.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "main.h"
|
||||
#include "proto.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/uart_struct.h"
|
||||
#include "soc\lp_uart_reg.h"
|
||||
#include "nvs_flash.h"
|
||||
|
||||
void delay(int ms) { vTaskDelay(pdMS_TO_TICKS(ms)); }
|
||||
|
||||
uint32_t getMillis() { return (uint32_t) (esp_timer_get_time() / 1000); }
|
||||
|
||||
void init_nvs()
|
||||
{
|
||||
// Initialize NVS
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
ESP_ERROR_CHECK( ret );
|
||||
}
|
||||
5
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/utils.h
Normal file
5
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/main/utils.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
void delay(int ms);
|
||||
uint32_t getMillis();
|
||||
void init_nvs();
|
||||
1825
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/sdkconfig
Normal file
1825
ARM_Tag_FW/OpenEPaperLink_esp32_C6_AP/sdkconfig
Normal file
File diff suppressed because it is too large
Load Diff
2
ARM_Tag_FW/nrf52811_Platformio_AP/.gitignore
vendored
Normal file
2
ARM_Tag_FW/nrf52811_Platformio_AP/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.pio
|
||||
.vscode
|
||||
1
ARM_Tag_FW/nrf52811_Platformio_AP/core/appstate.json
Normal file
1
ARM_Tag_FW/nrf52811_Platformio_AP/core/appstate.json
Normal file
@@ -0,0 +1 @@
|
||||
{"cid": "1d402e43-dabf-d91d-7f45-a96cc92d316e", "last_version": "6.1.10", "last_check": {"platformio_upgrade": 1691998441, "prune_system": 1691998442}, "created_at": 1687423184}
|
||||
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [sandeepmistry]
|
||||
@@ -0,0 +1,76 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
pull_request:
|
||||
branches: '*'
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant:
|
||||
- nRF52DK
|
||||
- BluzDK
|
||||
- RedBearLab_nRF51822:version=1_0
|
||||
- BBCmicrobit
|
||||
- BBCmicrobitV2
|
||||
- CalliopeMini
|
||||
- Generic_nRF51822:chip=xxac
|
||||
- Generic_nRF52832
|
||||
- Generic_nRF52833
|
||||
- OSHChip
|
||||
- STCT_nRF52_minidev
|
||||
- PCA1000X:board_variant=pca10000
|
||||
- PCA1000X:board_variant=pca10001
|
||||
- PCA1000X:board_variant=nrf6310
|
||||
- nRF51Dongle:version=1_1_0
|
||||
- Blend2
|
||||
- BLENano
|
||||
- BLENano2
|
||||
- TinyBLE
|
||||
- bluey
|
||||
- hackaBLE
|
||||
- hackaBLE_v2
|
||||
- Sinobit
|
||||
- DWM1001-DEV
|
||||
- SeeedArchLink
|
||||
- Beacon_PCA20006
|
||||
- Waveshare_BLE400
|
||||
- ng_beacon
|
||||
runs-on: ubuntu-latest
|
||||
name: Compile ${{ matrix.variant }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Create blinky sketch to compile
|
||||
run: |
|
||||
mkdir blinky
|
||||
cat > blinky/blinky.ino << EOF
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
EOF
|
||||
- uses: arduino/compile-sketches@v1
|
||||
with:
|
||||
cli-version: latest
|
||||
verbose: true
|
||||
enable-deltas-report: true
|
||||
platforms: |
|
||||
# First we have to install this core so that the tooling is installed
|
||||
- name: "sandeepmistry:nRF5"
|
||||
source-url: "https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json"
|
||||
version: latest
|
||||
# Now, this will overwrite the core source to use the local version
|
||||
- name: "sandeepmistry:nRF5"
|
||||
source-path: .
|
||||
fqbn: "sandeepmistry:nRF5:${{ matrix.variant }}"
|
||||
sketch-paths: blinky
|
||||
10
ARM_Tag_FW/nrf52811_Platformio_AP/core/packages/framework-arduinonordicnrf5/.gitignore
vendored
Normal file
10
ARM_Tag_FW/nrf52811_Platformio_AP/core/packages/framework-arduinonordicnrf5/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
.DS_Store
|
||||
|
||||
# softdevice files
|
||||
cores/nRF5/SDK/components/softdevice/*/hex/*.hex
|
||||
cores/nRF5/SDK/components/softdevice/*/hex/*.txt
|
||||
|
||||
# IDE tools
|
||||
extras/ide-tools/bin
|
||||
extras/ide-tools/nRF5FlashSoftDevice.jar
|
||||
.vscode/*
|
||||
@@ -0,0 +1 @@
|
||||
{"type": "tool", "name": "framework-arduinonordicnrf5", "version": "1.700.201209", "spec": {"owner": "platformio", "id": 8076, "name": "framework-arduinonordicnrf5", "requirements": null, "uri": null}}
|
||||
@@ -0,0 +1,45 @@
|
||||
language: generic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libc6:i386
|
||||
- libstdc++6:i386
|
||||
env:
|
||||
global:
|
||||
- IDE_VERSION=1.8.5
|
||||
before_install:
|
||||
- wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz
|
||||
- tar xf arduino-$IDE_VERSION-linux64.tar.xz
|
||||
- mv arduino-$IDE_VERSION $HOME/arduino-ide
|
||||
- export PATH=$PATH:$HOME/arduino-ide
|
||||
- arduino --pref "boardsmanager.additional.urls=https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json" --install-boards sandeepmistry:nRF5 > /dev/null
|
||||
- buildExampleSketch() { arduino --verbose-build --verify --board $1 $HOME/arduino-ide/examples/$2/$3/$3.ino; }
|
||||
install:
|
||||
- mkdir -p $HOME/Arduino/hardware/sandeepmistry
|
||||
- ln -s $PWD $HOME/Arduino/hardware/sandeepmistry/nRF5
|
||||
script:
|
||||
- buildExampleSketch sandeepmistry:nRF5:nRF52DK 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:BluzDK 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:BLENano:version=1_0 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:RedBearLab_nRF51822:version=1_0 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:BBCmicrobit 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:CalliopeMini 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:Generic_nRF51822:chip=xxac 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:Generic_nRF52832 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:OSHChip 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:STCT_nRF52_minidev 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=pca10000 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=pca10001 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:PCA1000X:board_variant=nrf6310 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:nRF51Dongle:version=1_1_0 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:Blend2 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:BLENano2 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:TinyBLE 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:bluey 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:hackaBLE 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:hackaBLE_v2 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:Sinobit 01.Basics BareMinimum
|
||||
- buildExampleSketch sandeepmistry:nRF5:DWM1001-DEV 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:SeeedArchLink 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:Generic_nRF52833 01.Basics Blink
|
||||
- buildExampleSketch sandeepmistry:nRF5:BBCmicrobitV2 01.Basics Blink
|
||||
@@ -0,0 +1,16 @@
|
||||
Copyright (c) 2015 Arduino LLC. All right reserved.
|
||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
@@ -0,0 +1,224 @@
|
||||
# Arduino Core for Nordic Semiconductor nRF5 based boards
|
||||
|
||||
[](https://github.com/sandeepmistry/arduino-nRF5/actions/workflows/compile.yml) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
|
||||
Program your [Nordic Semiconductor](https://www.nordicsemi.com) nRF51 or nRF52 board using the [Arduino](https://www.arduino.cc) IDE.
|
||||
|
||||
Does not require a custom bootloader on the device.
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/arduino-nRF5#backer)]
|
||||
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/0/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/1/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/2/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/3/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/4/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/5/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/6/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/7/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/8/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/9/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/10/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/11/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/12/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/13/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/14/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/15/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/16/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/17/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/18/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/19/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/20/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/21/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/22/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/23/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/24/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/25/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/26/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/27/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/28/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/backer/29/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/backer/29/avatar.svg"></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/arduino-nRF5#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/0/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/1/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/2/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/3/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/4/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/5/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/6/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/7/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/8/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/9/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/10/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/11/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/12/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/13/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/14/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/15/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/16/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/17/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/18/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/19/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/20/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/21/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/22/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/23/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/24/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/25/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/26/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/27/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/28/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/arduino-nRF5/sponsor/29/website" target="_blank"><img src="https://opencollective.com/arduino-nRF5/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## Supported boards
|
||||
|
||||
### nRF52833
|
||||
* [BBC micro:bit v2](https://microbit.org/new-microbit/)
|
||||
|
||||
### nRF52
|
||||
* [Plain nRF52 MCU](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52832)
|
||||
* [Nordic Semiconductor nRF52 DK](https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF52-DK)
|
||||
* For boards prior to ```2016.9``` (see sticker), the lastest JLink bootloader is required to upload sketches. To upgrade, press the boot/reset button while powering on the board and copy over the latest [bootloader](https://www.nordicsemi.com/eng/nordic/Products/nRF52-DK/nRF5x-OB-JLink-IF/52275).
|
||||
* To see how the silkscreened MCU pin names map to Arduino-compatible pin names, see ```PCA10040_Schematic_And_PCB.pdf``` -> ```GPIO pin mapping``` from the [PCA10040_Schematic](https://www.nordicsemi.com/eng/nordic/Products/nRF52-DK/nRF52-HW/50980).
|
||||
* [Shenzhen Taida Century Technology nRF52 low cost development board](https://www.aliexpress.com/item/NRF52832-high-cost-development-board-gold-core-board/32725601299.html)
|
||||
* [RedBear Blend 2](https://github.com/redbear/nRF5x#blend-2)
|
||||
* [RedBear Nano 2](https://github.com/redbear/nRF5x#ble-nano-2)
|
||||
* [Bluey](https://github.com/electronut/ElectronutLabs-bluey)
|
||||
* [hackaBLE](https://github.com/electronut/ElectronutLabs-hackaBLE)
|
||||
* [hackaBLE_v2](https://github.com/electronut/ElectronutLabs-hackaBLE)
|
||||
* [DWM1001-DEV](https://www.decawave.com/product/dwm1001-development-board/)
|
||||
|
||||
### nRF51
|
||||
* [Plain nRF51 MCU](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822)
|
||||
* [BBC micro:bit](https://microbit.org)
|
||||
* [Calliope mini](https://calliope.cc/en)
|
||||
* [Bluz DK](http://bluz.io)
|
||||
* Nordic Semiconductor [nRF51822 Development Kit](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822-Development-Kit) + [nRF51422 Development Kit](https://www.nordicsemi.com/eng/Products/ANT/nRF51422-Development-Kit)
|
||||
* Nordic SemiconductornRF51x22 Development Kits (PCA1000x)
|
||||
* [Nordic Semiconductor NRF51 Smart Beacon Kit](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822-Bluetooth-Smart-Beacon-Kit)
|
||||
* [Nordic Semiconductor NRF51 Dongle](http://www.nordicsemi.com/eng/Products/nRF51-Dongle)
|
||||
* [OSHChip](http://www.oshchip.org/)
|
||||
* [RedBearLab BLE Nano](http://redbearlab.com/blenano/)
|
||||
* [RedBearLab nRF51822](http://redbearlab.com/redbearlab-nrf51822/)
|
||||
* [Waveshare BLE400](http://www.waveshare.com/wiki/BLE400)
|
||||
* [ng-beacon](https://github.com/urish/ng-beacon)
|
||||
* [TinyBLE](https://www.seeedstudio.com/Seeed-Tiny-BLE-BLE-%2B-6DOF-Mbed-Platform-p-2268.html)
|
||||
* [Sino:bit](http://sinobit.org)
|
||||
* [SeeedArchLink](http://wiki.seeedstudio.com/Arch_Link/)
|
||||
|
||||
## Installing
|
||||
|
||||
### Board Manager
|
||||
|
||||
1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software) (At least v1.6.12)
|
||||
2. Start the Arduino IDE
|
||||
3. Go into Preferences
|
||||
4. Add ```https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json``` as an "Additional Board Manager URL"
|
||||
5. Open the Boards Manager from the Tools -> Board menu and install "Nordic Semiconductor nRF5 Boards"
|
||||
6. Select your nRF5 board from the Tools -> Board menu
|
||||
|
||||
__NOTE:__ During installation it takes the Arduino IDE a few minutes to extract the tools after they have been downloaded, please be patient.
|
||||
|
||||
#### OS Specific Setup
|
||||
|
||||
##### OS X
|
||||
|
||||
No additional setup required.
|
||||
|
||||
##### Linux
|
||||
|
||||
For 64-bit Linux users, ```libc6:i386```, ```libstdc++6:i386```, ```libncurses5:i386``` and ```libudev1:i386``` need to be installed :
|
||||
* ```sudo dpkg --add-architecture i386```
|
||||
* ```sudo apt-get update```
|
||||
* ```sudo apt-get -y install libc6:i386 libstdc++6:i386 libncurses5:i386 libudev1:i386```
|
||||
|
||||
##### Windows
|
||||
|
||||
###### Driver Setup for mbed devices
|
||||
Download [mbed Windows Serial driver](https://developer.mbed.org/handbook/Windows-serial-configuration#1-download-the-mbed-windows-serial-port)
|
||||
|
||||
###### Driver Setup for Segger J-Link
|
||||
|
||||
1. Download [Zadig](http://zadig.akeo.ie)
|
||||
2. Plugin Segger J-Link or DK board
|
||||
3. Start ```Zadig```
|
||||
4. Select ```Options -> List All Devices```
|
||||
5. Plug and unplug your device to find what changes, and select the ```Interface 2``` from the device dropdown
|
||||
6. Click ```Replace Driver```
|
||||
|
||||
__NOTE__: To roll back to the original driver go to: Device Manager -> Right click on device -> Check box for "Delete the driver software for this device" and click Uninstall
|
||||
|
||||
###### Driver Setup for Black Magic Probe
|
||||
1. Download .inf file drivers from [blacksphere github](https://github.com/blacksphere/blackmagic/tree/master/driver)
|
||||
2. Plugin Black Magic Probe
|
||||
3. Point the installer to the folder containing blackmagic.inf
|
||||
|
||||
__NOTE__: If using Windows 10 or Linux then two UART COM ports will be visible without requiring additional drivers
|
||||
|
||||
### Selecting a SoftDevice
|
||||
SoftDevices contain the BLE stack and housekeeping, and must be downloaded once before a sketch using BLE can be loaded.
|
||||
The SD consumes ~5k of Ram + some extra based on actual BLE configuration.
|
||||
* SoftDevice S110 v8.0.0 supports [Revision](http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf51%2Fdita%2Fnrf51%2Fcompatibility_matrix%2FnRF51822_ic_revision_overview.html&cp=3_0_1) 2 and 3 of nRF51 in peripheral role. It is 96k in size.
|
||||
* SoftDevice S130 v2.0.1 supports Revision 3 of nRF51 in peripheral and central role. It is 108k in size.
|
||||
* SoftDevice S132 v2.0.1 supports nRF52 in peripheral and central role. It is 112k in size.
|
||||
|
||||
### Flashing a SoftDevice
|
||||
|
||||
1. ```cd <SKETCHBOOK>```, where ```<SKETCHBOOK>``` is your Arduino Sketch folder:
|
||||
* OS X: ```~/Documents/Arduino```
|
||||
* Linux: ```~/Arduino```
|
||||
* Windows: ```~/Documents/Arduino```
|
||||
2. Create the following directories: ```tools/nRF5FlashSoftDevice/tool/```
|
||||
3. Download [nRF5FlashSoftDevice.jar](https://github.com/sandeepmistry/arduino-nRF5/releases/download/tools/nRF5FlashSoftDevice.jar) to ```<SKETCHBOOK>/tools/nRF5FlashSoftDevice/tool/```
|
||||
4. Restart the Arduino IDE
|
||||
5. Select your nRF board from the Tools -> Board menu
|
||||
6. Select a SoftDevice from the Tools -> "SoftDevice: " menu
|
||||
7. Select a Programmer (J-Link, ST-Link V2, or CMSIS-DAP) from the Tools -> "Programmer: " menu
|
||||
8. Select Tools -> nRF5 Flash SoftDevice
|
||||
9. Read license agreement
|
||||
10. Click "Accept" to accept license and continue, or "Decline" to decline and abort
|
||||
11. If accepted, SoftDevice binary will be flashed to the board
|
||||
|
||||
### From git (for core development)
|
||||
|
||||
1. Follow steps from Board Manager section above
|
||||
2. ```cd <SKETCHBOOK>```, where ```<SKETCHBOOK>``` is your Arduino Sketch folder:
|
||||
* OS X: ```~/Documents/Arduino```
|
||||
* Linux: ```~/Arduino```
|
||||
* Windows: ```~/Documents/Arduino```
|
||||
3. Create a folder named ```hardware```, if it does not exist, and change directories to it
|
||||
4. Clone this repo: ```git clone https://github.com/sandeepmistry/arduino-nRF5.git sandeepmistry-github/nRF5```
|
||||
5. Restart the Arduino IDE
|
||||
|
||||
## BLE
|
||||
|
||||
This Arduino Core does **not** contain any Arduino style API's for BLE functionality. All the relevant Nordic SoftDevice (S110, S130, S132) header files are included build path when a SoftDevice is selected via the `Tools` menu.
|
||||
|
||||
### Recommend BLE Libraries
|
||||
|
||||
* [BLEPeripheral](https://github.com/sandeepmistry/arduino-BLEPeripheral)
|
||||
* v0.3.0 and greater, available via the Arduino IDE's library manager.
|
||||
* Supports peripheral mode only.
|
||||
|
||||
## Low Frequency Clock Source (LFCLKSRC)
|
||||
|
||||
If the selected board has an external 32 kHz crystal connected, it will be used as the source for the low frequency clock. Otherwise the internal 32 kHz RC oscillator will be used. The low frequency clock is used by the `delay(ms)` and `millis()` Arduino API's.
|
||||
|
||||
The Generic nRF51 and nRF52 board options have an additional menu item under `Tools -> Low Frequency Clock` that allows you to select the low frequency clock source. However, Nordic does not recommend the Synthesized clock, which also has a significant power impact.
|
||||
|
||||
## Credits
|
||||
|
||||
This core is based on the [Arduino SAMD Core](https://github.com/arduino/ArduinoCore-samd) and licensed under the same [LGPL License](LICENSE)
|
||||
|
||||
The following tools are used:
|
||||
|
||||
* [GCC ARM Embedded](https://launchpad.net/gcc-arm-embedded) as the compiler
|
||||
* A [forked](https://github.com/sandeepmistry/openocd-code-nrf5) version of [OpenOCD](http://openocd.org) to flash sketches
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,133 @@
|
||||
#ifndef Arduino_h
|
||||
#define Arduino_h
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "nrf.h"
|
||||
#include "nrf_peripherals.h"
|
||||
|
||||
typedef bool boolean;
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
|
||||
// some libraries and sketches depend on this AVR stuff,
|
||||
// assuming Arduino.h or WProgram.h automatically includes it...
|
||||
|
||||
#include "avr/pgmspace.h"
|
||||
#include "avr/interrupt.h"
|
||||
|
||||
#include "itoa.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "wiring_constants.h"
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
|
||||
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
|
||||
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
|
||||
|
||||
void yield( void ) ;
|
||||
|
||||
/* sketch */
|
||||
void setup( void ) ;
|
||||
void loop( void ) ;
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
// The following headers are for C++ only compilation
|
||||
#ifdef __cplusplus
|
||||
#include "WCharacter.h"
|
||||
#include "WString.h"
|
||||
// #include "Tone.h"
|
||||
#include "WMath.h"
|
||||
#include "HardwareSerial.h"
|
||||
#include "pulse.h"
|
||||
#endif
|
||||
#include "delay.h"
|
||||
#include "binary.h"
|
||||
#ifdef __cplusplus
|
||||
#include "Uart.h"
|
||||
#endif
|
||||
|
||||
// Include board variant
|
||||
#include "variant.h"
|
||||
|
||||
#include "wiring.h"
|
||||
#include "wiring_digital.h"
|
||||
#include "wiring_analog.h"
|
||||
#include "wiring_shift.h"
|
||||
#include "WInterrupts.h"
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif // abs
|
||||
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
#define abs(x) ((x)>0?(x):-(x))
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#define interrupts() __enable_irq()
|
||||
#define noInterrupts() __disable_irq()
|
||||
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
#define bit(b) (1UL << (b))
|
||||
|
||||
#if (GPIO_COUNT == 1)
|
||||
#define gpioBaseForPin(P) ( NRF_GPIO )
|
||||
#define digitalPinToPort(P) ( (NRF_GPIO_Type *) gpioBaseForPin(P) )
|
||||
#define digitalPinToPin(P) ( g_ADigitalPinMap[P] )
|
||||
#define digitalPinToBitMask(P) ( 1 << digitalPinToPin(P) )
|
||||
#elif (GPIO_COUNT == 2)
|
||||
#define gpioBaseForPin(P) ( (g_ADigitalPinMap[P] & 0x20) ? NRF_P1 : NRF_P0 )
|
||||
#define digitalPinToPort(P) ( (NRF_GPIO_Type *) gpioBaseForPin(P) )
|
||||
#define digitalPinToPin(P) ( g_ADigitalPinMap[P] & 0x1f )
|
||||
#define digitalPinToBitMask(P) ( 1 << digitalPinToPin(P) )
|
||||
#else
|
||||
#error "Unsupported GPIO_COUNT"
|
||||
#endif
|
||||
|
||||
#define portOutputRegister(port) ( &(port->OUT) )
|
||||
#define portInputRegister(port) ( &(port->IN) )
|
||||
#define portModeRegister(port) ( &(port->DIR) )
|
||||
#define digitalPinHasPWM(P) ( true )
|
||||
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for nRF52
|
||||
* architecture. If you need to check if a pin supports PWM you must
|
||||
* use digitalPinHasPWM(..).
|
||||
*
|
||||
* https://github.com/arduino/Arduino/issues/1833
|
||||
*/
|
||||
// #define digitalPinToTimer(P)
|
||||
|
||||
// Interrupts
|
||||
#define digitalPinToInterrupt(P) ( P )
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "Uart.h"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // Arduino_h
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Client.h - Base class that provides Client
|
||||
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef client_h
|
||||
#define client_h
|
||||
#include "Print.h"
|
||||
#include "Stream.h"
|
||||
#include "IPAddress.h"
|
||||
|
||||
class Client : public Stream {
|
||||
|
||||
public:
|
||||
virtual int connect(IPAddress ip, uint16_t port) =0;
|
||||
virtual int connect(const char *host, uint16_t port) =0;
|
||||
virtual size_t write(uint8_t) =0;
|
||||
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
||||
virtual int available() = 0;
|
||||
virtual int read() = 0;
|
||||
virtual int read(uint8_t *buf, size_t size) = 0;
|
||||
virtual int peek() = 0;
|
||||
virtual void flush() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual uint8_t connected() = 0;
|
||||
virtual operator bool() = 0;
|
||||
protected:
|
||||
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
Copyright (c) 2015 Arduino LLC. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef HardwareSerial_h
|
||||
#define HardwareSerial_h
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "Stream.h"
|
||||
|
||||
#define HARDSER_PARITY_EVEN (0x1ul)
|
||||
#define HARDSER_PARITY_ODD (0x2ul)
|
||||
#define HARDSER_PARITY_NONE (0x3ul)
|
||||
#define HARDSER_PARITY_MASK (0xFul)
|
||||
|
||||
#define HARDSER_STOP_BIT_1 (0x10ul)
|
||||
#define HARDSER_STOP_BIT_1_5 (0x20ul)
|
||||
#define HARDSER_STOP_BIT_2 (0x30ul)
|
||||
#define HARDSER_STOP_BIT_MASK (0xF0ul)
|
||||
|
||||
#define HARDSER_DATA_5 (0x100ul)
|
||||
#define HARDSER_DATA_6 (0x200ul)
|
||||
#define HARDSER_DATA_7 (0x300ul)
|
||||
#define HARDSER_DATA_8 (0x400ul)
|
||||
#define HARDSER_DATA_MASK (0xF00ul)
|
||||
|
||||
#define SERIAL_5N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
|
||||
#define SERIAL_6N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
|
||||
#define SERIAL_7N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
|
||||
#define SERIAL_8N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
|
||||
#define SERIAL_5N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
|
||||
#define SERIAL_6N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
|
||||
#define SERIAL_7N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
|
||||
#define SERIAL_8N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
|
||||
#define SERIAL_5E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
|
||||
#define SERIAL_6E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
|
||||
#define SERIAL_7E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
|
||||
#define SERIAL_8E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
|
||||
#define SERIAL_5E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
|
||||
#define SERIAL_6E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
|
||||
#define SERIAL_7E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
|
||||
#define SERIAL_8E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
|
||||
#define SERIAL_5O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
|
||||
#define SERIAL_6O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
|
||||
#define SERIAL_7O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
|
||||
#define SERIAL_8O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
|
||||
#define SERIAL_5O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
|
||||
#define SERIAL_6O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
|
||||
#define SERIAL_7O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
|
||||
#define SERIAL_8O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
|
||||
|
||||
class HardwareSerial : public Stream
|
||||
{
|
||||
public:
|
||||
virtual void begin(unsigned long) = 0;
|
||||
virtual void begin(unsigned long baudrate, uint16_t config) = 0;
|
||||
virtual void end() = 0;
|
||||
virtual int available(void) = 0;
|
||||
virtual int peek(void) = 0;
|
||||
virtual int read(void) = 0;
|
||||
virtual void flush(void) = 0;
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
using Print::write; // pull in write(str) and write(buf, size) from Print
|
||||
virtual operator bool() = 0;
|
||||
};
|
||||
|
||||
extern void serialEventRun(void) __attribute__((weak));
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
IPAddress.cpp - Base class that provides IPAddress
|
||||
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
IPAddress::IPAddress()
|
||||
{
|
||||
_address.dword = 0;
|
||||
}
|
||||
|
||||
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
|
||||
{
|
||||
_address.bytes[0] = first_octet;
|
||||
_address.bytes[1] = second_octet;
|
||||
_address.bytes[2] = third_octet;
|
||||
_address.bytes[3] = fourth_octet;
|
||||
}
|
||||
|
||||
IPAddress::IPAddress(uint32_t address)
|
||||
{
|
||||
_address.dword = address;
|
||||
}
|
||||
|
||||
IPAddress::IPAddress(const uint8_t *address)
|
||||
{
|
||||
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||
}
|
||||
|
||||
bool IPAddress::fromString(const char *address)
|
||||
{
|
||||
// TODO: add support for "a", "a.b", "a.b.c" formats
|
||||
|
||||
uint16_t acc = 0; // Accumulator
|
||||
uint8_t dots = 0;
|
||||
|
||||
while (*address)
|
||||
{
|
||||
char c = *address++;
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
acc = acc * 10 + (c - '0');
|
||||
if (acc > 255) {
|
||||
// Value out of [0..255] range
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (c == '.')
|
||||
{
|
||||
if (dots == 3) {
|
||||
// Too much dots (there must be 3 dots)
|
||||
return false;
|
||||
}
|
||||
_address.bytes[dots++] = acc;
|
||||
acc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid char
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (dots != 3) {
|
||||
// Too few dots (there must be 3 dots)
|
||||
return false;
|
||||
}
|
||||
_address.bytes[3] = acc;
|
||||
return true;
|
||||
}
|
||||
|
||||
IPAddress& IPAddress::operator=(const uint8_t *address)
|
||||
{
|
||||
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||
return *this;
|
||||
}
|
||||
|
||||
IPAddress& IPAddress::operator=(uint32_t address)
|
||||
{
|
||||
_address.dword = address;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IPAddress::operator==(const uint8_t* addr) const
|
||||
{
|
||||
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
|
||||
}
|
||||
|
||||
size_t IPAddress::printTo(Print& p) const
|
||||
{
|
||||
size_t n = 0;
|
||||
for (int i =0; i < 3; i++)
|
||||
{
|
||||
n += p.print(_address.bytes[i], DEC);
|
||||
n += p.print('.');
|
||||
}
|
||||
n += p.print(_address.bytes[3], DEC);
|
||||
return n;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
IPAddress.h - Base class that provides IPAddress
|
||||
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef IPAddress_h
|
||||
#define IPAddress_h
|
||||
|
||||
#include <stdint.h>
|
||||
#include "Printable.h"
|
||||
#include "WString.h"
|
||||
|
||||
// A class to make it easier to handle and pass around IP addresses
|
||||
|
||||
class IPAddress : public Printable {
|
||||
private:
|
||||
union {
|
||||
uint8_t bytes[4]; // IPv4 address
|
||||
uint32_t dword;
|
||||
} _address;
|
||||
|
||||
// Access the raw byte array containing the address. Because this returns a pointer
|
||||
// to the internal structure rather than a copy of the address this function should only
|
||||
// be used when you know that the usage of the returned uint8_t* will be transient and not
|
||||
// stored.
|
||||
uint8_t* raw_address() { return _address.bytes; };
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
IPAddress();
|
||||
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
|
||||
IPAddress(uint32_t address);
|
||||
IPAddress(const uint8_t *address);
|
||||
|
||||
bool fromString(const char *address);
|
||||
bool fromString(const String &address) { return fromString(address.c_str()); }
|
||||
|
||||
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
|
||||
// to a four-byte uint8_t array is expected
|
||||
operator uint32_t() const { return _address.dword; };
|
||||
bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; };
|
||||
bool operator==(const uint8_t* addr) const;
|
||||
|
||||
// Overloaded index operator to allow getting and setting individual octets of the address
|
||||
uint8_t operator[](int index) const { return _address.bytes[index]; };
|
||||
uint8_t& operator[](int index) { return _address.bytes[index]; };
|
||||
|
||||
// Overloaded copy operators to allow initialisation of IPAddress objects from other types
|
||||
IPAddress& operator=(const uint8_t *address);
|
||||
IPAddress& operator=(uint32_t address);
|
||||
|
||||
virtual size_t printTo(Print& p) const;
|
||||
|
||||
friend class EthernetClass;
|
||||
friend class UDP;
|
||||
friend class Client;
|
||||
friend class Server;
|
||||
friend class DhcpClass;
|
||||
friend class DNSClient;
|
||||
};
|
||||
|
||||
const IPAddress INADDR_NONE(0,0,0,0);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
Copyright (c) 2014 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "Arduino.h"
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
size_t Print::write(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
size_t n = 0;
|
||||
while (size--) {
|
||||
if (write(*buffer++)) n++;
|
||||
else break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::print(const __FlashStringHelper *ifsh)
|
||||
{
|
||||
return print(reinterpret_cast<const char *>(ifsh));
|
||||
}
|
||||
|
||||
size_t Print::print(const String &s)
|
||||
{
|
||||
return write(s.c_str(), s.length());
|
||||
}
|
||||
|
||||
size_t Print::print(const char str[])
|
||||
{
|
||||
return write(str);
|
||||
}
|
||||
|
||||
size_t Print::print(char c)
|
||||
{
|
||||
return write(c);
|
||||
}
|
||||
|
||||
size_t Print::print(unsigned char b, int base)
|
||||
{
|
||||
return print((unsigned long) b, base);
|
||||
}
|
||||
|
||||
size_t Print::print(int n, int base)
|
||||
{
|
||||
return print((long) n, base);
|
||||
}
|
||||
|
||||
size_t Print::print(unsigned int n, int base)
|
||||
{
|
||||
return print((unsigned long) n, base);
|
||||
}
|
||||
|
||||
size_t Print::print(long n, int base)
|
||||
{
|
||||
if (base == 0) {
|
||||
return write(n);
|
||||
} else if (base == 10) {
|
||||
if (n < 0) {
|
||||
int t = print('-');
|
||||
n = -n;
|
||||
return printNumber(n, 10) + t;
|
||||
}
|
||||
return printNumber(n, 10);
|
||||
} else {
|
||||
return printNumber(n, base);
|
||||
}
|
||||
}
|
||||
|
||||
size_t Print::print(unsigned long n, int base)
|
||||
{
|
||||
if (base == 0) return write(n);
|
||||
else return printNumber(n, base);
|
||||
}
|
||||
|
||||
size_t Print::print(double n, int digits)
|
||||
{
|
||||
return printFloat(n, digits);
|
||||
}
|
||||
|
||||
size_t Print::println(const __FlashStringHelper *ifsh)
|
||||
{
|
||||
size_t n = print(ifsh);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::print(const Printable& x)
|
||||
{
|
||||
return x.printTo(*this);
|
||||
}
|
||||
|
||||
size_t Print::println(void)
|
||||
{
|
||||
return write("\r\n");
|
||||
}
|
||||
|
||||
size_t Print::println(const String &s)
|
||||
{
|
||||
size_t n = print(s);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(const char c[])
|
||||
{
|
||||
size_t n = print(c);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(char c)
|
||||
{
|
||||
size_t n = print(c);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(unsigned char b, int base)
|
||||
{
|
||||
size_t n = print(b, base);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(int num, int base)
|
||||
{
|
||||
size_t n = print(num, base);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(unsigned int num, int base)
|
||||
{
|
||||
size_t n = print(num, base);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(long num, int base)
|
||||
{
|
||||
size_t n = print(num, base);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(unsigned long num, int base)
|
||||
{
|
||||
size_t n = print(num, base);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(double num, int digits)
|
||||
{
|
||||
size_t n = print(num, digits);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::println(const Printable& x)
|
||||
{
|
||||
size_t n = print(x);
|
||||
n += println();
|
||||
return n;
|
||||
}
|
||||
|
||||
// Private Methods /////////////////////////////////////////////////////////////
|
||||
|
||||
size_t Print::printNumber(unsigned long n, uint8_t base)
|
||||
{
|
||||
char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
|
||||
char *str = &buf[sizeof(buf) - 1];
|
||||
|
||||
*str = '\0';
|
||||
|
||||
// prevent crash if called with base == 1
|
||||
if (base < 2) base = 10;
|
||||
|
||||
do {
|
||||
char c = n % base;
|
||||
n /= base;
|
||||
|
||||
*--str = c < 10 ? c + '0' : c + 'A' - 10;
|
||||
} while(n);
|
||||
|
||||
return write(str);
|
||||
}
|
||||
|
||||
size_t Print::printFloat(double number, uint8_t digits)
|
||||
{
|
||||
size_t n = 0;
|
||||
|
||||
if (isnan(number)) return print("nan");
|
||||
if (isinf(number)) return print("inf");
|
||||
if (number > 4294967040.0) return print ("ovf"); // constant determined empirically
|
||||
if (number <-4294967040.0) return print ("ovf"); // constant determined empirically
|
||||
|
||||
// Handle negative numbers
|
||||
if (number < 0.0)
|
||||
{
|
||||
n += print('-');
|
||||
number = -number;
|
||||
}
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
double rounding = 0.5;
|
||||
for (uint8_t i=0; i<digits; ++i)
|
||||
rounding /= 10.0;
|
||||
|
||||
number += rounding;
|
||||
|
||||
// Extract the integer part of the number and print it
|
||||
unsigned long int_part = (unsigned long)number;
|
||||
double remainder = number - (double)int_part;
|
||||
n += print(int_part);
|
||||
|
||||
// Print the decimal point, but only if there are digits beyond
|
||||
if (digits > 0) {
|
||||
n += print(".");
|
||||
}
|
||||
|
||||
// Extract digits from the remainder one at a time
|
||||
while (digits-- > 0)
|
||||
{
|
||||
remainder *= 10.0;
|
||||
int toPrint = int(remainder);
|
||||
n += print(toPrint);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright (c) 2014 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Print_h
|
||||
#define Print_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h> // for size_t
|
||||
|
||||
#include "WString.h"
|
||||
#include "Printable.h"
|
||||
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
|
||||
class Print
|
||||
{
|
||||
private:
|
||||
int write_error;
|
||||
size_t printNumber(unsigned long, uint8_t);
|
||||
size_t printFloat(double, uint8_t);
|
||||
protected:
|
||||
void setWriteError(int err = 1) { write_error = err; }
|
||||
public:
|
||||
Print() : write_error(0) {}
|
||||
|
||||
int getWriteError() { return write_error; }
|
||||
void clearWriteError() { setWriteError(0); }
|
||||
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
size_t write(const char *str) {
|
||||
if (str == NULL) return 0;
|
||||
return write((const uint8_t *)str, strlen(str));
|
||||
}
|
||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||
size_t write(const char *buffer, size_t size) {
|
||||
return write((const uint8_t *)buffer, size);
|
||||
}
|
||||
|
||||
size_t print(const __FlashStringHelper *);
|
||||
size_t print(const String &);
|
||||
size_t print(const char[]);
|
||||
size_t print(char);
|
||||
size_t print(unsigned char, int = DEC);
|
||||
size_t print(int, int = DEC);
|
||||
size_t print(unsigned int, int = DEC);
|
||||
size_t print(long, int = DEC);
|
||||
size_t print(unsigned long, int = DEC);
|
||||
size_t print(double, int = 2);
|
||||
size_t print(const Printable&);
|
||||
|
||||
size_t println(const __FlashStringHelper *);
|
||||
size_t println(const String &s);
|
||||
size_t println(const char[]);
|
||||
size_t println(char);
|
||||
size_t println(unsigned char, int = DEC);
|
||||
size_t println(int, int = DEC);
|
||||
size_t println(unsigned int, int = DEC);
|
||||
size_t println(long, int = DEC);
|
||||
size_t println(unsigned long, int = DEC);
|
||||
size_t println(double, int = 2);
|
||||
size_t println(const Printable&);
|
||||
size_t println(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (c) 2014 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Printable_h
|
||||
#define Printable_h
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
class Print;
|
||||
|
||||
/** The Printable class provides a way for new classes to allow themselves to be printed.
|
||||
By deriving from Printable and implementing the printTo method, it will then be possible
|
||||
for users to print out instances of this class by passing them into the usual
|
||||
Print::print and Print::println methods.
|
||||
*/
|
||||
|
||||
class Printable
|
||||
{
|
||||
public:
|
||||
virtual size_t printTo(Print& p) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (c) 2014 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "RingBuffer.h"
|
||||
#include <string.h>
|
||||
|
||||
RingBuffer::RingBuffer( void )
|
||||
{
|
||||
memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ;
|
||||
clear();
|
||||
}
|
||||
|
||||
void RingBuffer::store_char( uint8_t c )
|
||||
{
|
||||
int i = nextIndex(_iHead);
|
||||
|
||||
// if we should be storing the received character into the location
|
||||
// just before the tail (meaning that the head would advance to the
|
||||
// current location of the tail), we're about to overflow the buffer
|
||||
// and so we don't write the character or advance the head.
|
||||
if ( i != _iTail )
|
||||
{
|
||||
_aucBuffer[_iHead] = c ;
|
||||
_iHead = i ;
|
||||
}
|
||||
}
|
||||
|
||||
void RingBuffer::clear()
|
||||
{
|
||||
_iHead = 0;
|
||||
_iTail = 0;
|
||||
}
|
||||
|
||||
int RingBuffer::read_char()
|
||||
{
|
||||
if(_iTail == _iHead)
|
||||
return -1;
|
||||
|
||||
uint8_t value = _aucBuffer[_iTail];
|
||||
_iTail = nextIndex(_iTail);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int RingBuffer::available()
|
||||
{
|
||||
int delta = _iHead - _iTail;
|
||||
|
||||
if(delta < 0)
|
||||
return SERIAL_BUFFER_SIZE + delta;
|
||||
else
|
||||
return delta;
|
||||
}
|
||||
|
||||
int RingBuffer::peek()
|
||||
{
|
||||
if(_iTail == _iHead)
|
||||
return -1;
|
||||
|
||||
return _aucBuffer[_iTail];
|
||||
}
|
||||
|
||||
int RingBuffer::nextIndex(int index)
|
||||
{
|
||||
return (uint32_t)(index + 1) % SERIAL_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
bool RingBuffer::isFull()
|
||||
{
|
||||
return (nextIndex(_iHead) == _iTail);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright (c) 2014 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _RING_BUFFER_
|
||||
#define _RING_BUFFER_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
// using a ring buffer (I think), in which head is the index of the location
|
||||
// to which to write the next incoming character and tail is the index of the
|
||||
// location from which to read.
|
||||
#define SERIAL_BUFFER_SIZE 64
|
||||
|
||||
class RingBuffer
|
||||
{
|
||||
public:
|
||||
uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ;
|
||||
int _iHead ;
|
||||
int _iTail ;
|
||||
|
||||
public:
|
||||
RingBuffer( void ) ;
|
||||
void store_char( uint8_t c ) ;
|
||||
void clear();
|
||||
int read_char();
|
||||
int available();
|
||||
int peek();
|
||||
bool isFull();
|
||||
|
||||
private:
|
||||
int nextIndex(int index);
|
||||
} ;
|
||||
|
||||
#endif /* _RING_BUFFER_ */
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _COMPILER_ABSTRACTION_H
|
||||
#define _COMPILER_ABSTRACTION_H
|
||||
|
||||
/*lint ++flb "Enter library region" */
|
||||
|
||||
#ifndef NRF_STRING_CONCATENATE_IMPL
|
||||
#define NRF_STRING_CONCATENATE_IMPL(lhs, rhs) lhs ## rhs
|
||||
#endif
|
||||
#ifndef NRF_STRING_CONCATENATE
|
||||
#define NRF_STRING_CONCATENATE(lhs, rhs) NRF_STRING_CONCATENATE_IMPL(lhs, rhs)
|
||||
#endif
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __INLINE
|
||||
#define __INLINE __inline
|
||||
#endif
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __weak
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGN
|
||||
#define __ALIGN(n) __align(n)
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __PACKED __packed
|
||||
#endif
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#define GET_SP() __current_sp()
|
||||
|
||||
#ifndef NRF_STATIC_ASSERT
|
||||
#define NRF_STATIC_ASSERT(cond, msg) \
|
||||
;enum { NRF_STRING_CONCATENATE(static_assert_on_line_, __LINE__) = 1 / (!!(cond)) }
|
||||
#endif
|
||||
|
||||
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __INLINE
|
||||
#define __INLINE __inline
|
||||
#endif
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGN
|
||||
#define __ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __PACKED __attribute__((packed, aligned(1)))
|
||||
#endif
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#define GET_SP() __current_sp()
|
||||
|
||||
#ifndef NRF_STATIC_ASSERT
|
||||
#ifdef __cplusplus
|
||||
#ifndef _Static_assert
|
||||
#define _Static_assert static_assert
|
||||
#endif
|
||||
#endif
|
||||
#define NRF_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
|
||||
#endif
|
||||
|
||||
#elif defined ( __ICCARM__ )
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __INLINE
|
||||
#define __INLINE inline
|
||||
#endif
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __weak
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGN
|
||||
#define STRING_PRAGMA(x) _Pragma(#x)
|
||||
#define __ALIGN(n) STRING_PRAGMA(data_alignment = n)
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __PACKED __packed
|
||||
#endif
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED
|
||||
#endif
|
||||
|
||||
#define GET_SP() __get_SP()
|
||||
|
||||
#ifndef NRF_STATIC_ASSERT
|
||||
#define NRF_STATIC_ASSERT(cond, msg) static_assert(cond, msg)
|
||||
#endif
|
||||
|
||||
#elif defined ( __GNUC__ ) || defined ( __clang__ )
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __INLINE
|
||||
#define __INLINE inline
|
||||
#endif
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGN
|
||||
#define __ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#define GET_SP() gcc_current_sp()
|
||||
|
||||
static inline unsigned int gcc_current_sp(void)
|
||||
{
|
||||
unsigned int stack_pointer = 0;
|
||||
__asm__ __volatile__ ("mov %0, sp" : "=r"(stack_pointer));
|
||||
return stack_pointer;
|
||||
}
|
||||
|
||||
#ifndef NRF_STATIC_ASSERT
|
||||
#ifdef __cplusplus
|
||||
#ifndef _Static_assert
|
||||
#define _Static_assert static_assert
|
||||
#endif
|
||||
#endif
|
||||
#define NRF_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
|
||||
#endif
|
||||
|
||||
#elif defined ( __TASKING__ )
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __INLINE
|
||||
#define __INLINE inline
|
||||
#endif
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGN
|
||||
#define __ALIGN(n) __align(n)
|
||||
#endif
|
||||
|
||||
/* Not defined for TASKING. */
|
||||
#ifndef __PACKED
|
||||
#define __PACKED
|
||||
#endif
|
||||
|
||||
#ifndef __UNUSED
|
||||
#define __UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#define GET_SP() __get_MSP()
|
||||
|
||||
#ifndef NRF_STATIC_ASSERT
|
||||
#define NRF_STATIC_ASSERT(cond, msg) static_assert(cond, msg)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define NRF_MDK_VERSION_ASSERT_AT_LEAST(major, minor, micro) \
|
||||
NRF_STATIC_ASSERT( \
|
||||
( \
|
||||
(major < MDK_MAJOR_VERSION) || \
|
||||
(major == MDK_MAJOR_VERSION && minor < MDK_MINOR_VERSION) || \
|
||||
(major == MDK_MAJOR_VERSION && minor == MDK_MINOR_VERSION && micro < MDK_MICRO_VERSION) \
|
||||
), "MDK version mismatch.")
|
||||
|
||||
#define NRF_MDK_VERSION_ASSERT_EXACT(major, minor, micro) \
|
||||
NRF_STATIC_ASSERT( \
|
||||
( \
|
||||
(major != MDK_MAJOR_VERSION) || \
|
||||
(major != MDK_MAJOR_VERSION) || \
|
||||
(major != MDK_MAJOR_VERSION) \
|
||||
), "MDK version mismatch.")
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF_H
|
||||
#define NRF_H
|
||||
|
||||
/* MDK version */
|
||||
#define MDK_MAJOR_VERSION 8
|
||||
#define MDK_MINOR_VERSION 37
|
||||
#define MDK_MICRO_VERSION 0
|
||||
|
||||
|
||||
/* Define coprocessor domains */
|
||||
#if defined (NRF5340_XXAA_APPLICATION) || defined (NRF5340_XXAA_NETWORK)
|
||||
#ifndef NRF5340_XXAA
|
||||
#define NRF5340_XXAA
|
||||
#endif
|
||||
#endif
|
||||
#if defined (NRF5340_XXAA_APPLICATION)
|
||||
#ifndef NRF_APPLICATION
|
||||
#define NRF_APPLICATION
|
||||
#endif
|
||||
#endif
|
||||
#if defined (NRF5340_XXAA_NETWORK)
|
||||
#ifndef NRF_NETWORK
|
||||
#define NRF_NETWORK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Apply compatibility macros for old nRF5340 macros */
|
||||
#if defined(NRF5340_XXAA)
|
||||
#if defined (NRF_APPLICATION)
|
||||
#ifndef NRF5340_XXAA_APPLICATION
|
||||
#define NRF5340_XXAA_APPLICATION
|
||||
#endif
|
||||
#endif
|
||||
#if defined (NRF_NETWORK)
|
||||
#ifndef NRF5340_XXAA_NETWORK
|
||||
#define NRF5340_XXAA_NETWORK
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define NRF51_SERIES for common use in nRF51 series devices. Only if not previously defined. */
|
||||
#if defined (NRF51) ||\
|
||||
defined (NRF51422_XXAA) ||\
|
||||
defined (NRF51422_XXAB) ||\
|
||||
defined (NRF51422_XXAC) ||\
|
||||
defined (NRF51801_XXAB) ||\
|
||||
defined (NRF51802_XXAA) ||\
|
||||
defined (NRF51822_XXAA) ||\
|
||||
defined (NRF51822_XXAB) ||\
|
||||
defined (NRF51822_XXAC) ||\
|
||||
defined (NRF51824_XXAA)
|
||||
#ifndef NRF51_SERIES
|
||||
#define NRF51_SERIES
|
||||
#endif
|
||||
#ifndef NRF51
|
||||
#define NRF51
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Redefine "old" too-generic name NRF52 to NRF52832_XXAA to keep backwards compatibility. */
|
||||
#if defined (NRF52)
|
||||
#ifndef NRF52832_XXAA
|
||||
#define NRF52832_XXAA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define NRF52_SERIES for common use in nRF52 series devices. Only if not previously defined. */
|
||||
#if defined (NRF52805_XXAA) || defined (NRF52810_XXAA) || defined (NRF52811_XXAA) || defined (NRF52820_XXAA) || defined (NRF52832_XXAA) || defined (NRF52832_XXAB) || defined (NRF52833_XXAA) || defined (NRF52840_XXAA)
|
||||
#ifndef NRF52_SERIES
|
||||
#define NRF52_SERIES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define NRF53_SERIES for common use in nRF53 series devices. */
|
||||
#if defined (NRF5340_XXAA)
|
||||
#ifndef NRF53_SERIES
|
||||
#define NRF53_SERIES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define NRF91_SERIES for common use in nRF91 series devices. */
|
||||
#if defined (NRF9160_XXAA)
|
||||
#ifndef NRF91_SERIES
|
||||
#define NRF91_SERIES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Device selection for device includes. */
|
||||
#if defined (NRF51)
|
||||
#include "nrf51.h"
|
||||
#include "nrf51_bitfields.h"
|
||||
#include "nrf51_deprecated.h"
|
||||
|
||||
#elif defined (NRF52805_XXAA)
|
||||
#include "nrf52805.h"
|
||||
#include "nrf52805_bitfields.h"
|
||||
#include "nrf51_to_nrf52810.h"
|
||||
#include "nrf52_to_nrf52810.h"
|
||||
#include "nrf52810_to_nrf52811.h"
|
||||
#elif defined (NRF52810_XXAA)
|
||||
#include "nrf52810.h"
|
||||
#include "nrf52810_bitfields.h"
|
||||
#include "nrf51_to_nrf52810.h"
|
||||
#include "nrf52_to_nrf52810.h"
|
||||
#include "nrf52810_name_change.h"
|
||||
#elif defined (NRF52811_XXAA)
|
||||
#include "nrf52811.h"
|
||||
#include "nrf52811_bitfields.h"
|
||||
#include "nrf51_to_nrf52810.h"
|
||||
#include "nrf52_to_nrf52810.h"
|
||||
#include "nrf52810_to_nrf52811.h"
|
||||
#elif defined (NRF52820_XXAA)
|
||||
#include "nrf52820.h"
|
||||
#include "nrf52820_bitfields.h"
|
||||
#include "nrf51_to_nrf52.h"
|
||||
#include "nrf52_to_nrf52833.h"
|
||||
#include "nrf52833_to_nrf52820.h"
|
||||
#elif defined (NRF52832_XXAA) || defined (NRF52832_XXAB)
|
||||
#include "nrf52.h"
|
||||
#include "nrf52_bitfields.h"
|
||||
#include "nrf51_to_nrf52.h"
|
||||
#include "nrf52_name_change.h"
|
||||
#elif defined (NRF52833_XXAA)
|
||||
#include "nrf52833.h"
|
||||
#include "nrf52833_bitfields.h"
|
||||
#include "nrf52_to_nrf52833.h"
|
||||
#include "nrf51_to_nrf52.h"
|
||||
#elif defined (NRF52840_XXAA)
|
||||
#include "nrf52840.h"
|
||||
#include "nrf52840_bitfields.h"
|
||||
#include "nrf51_to_nrf52840.h"
|
||||
#include "nrf52_to_nrf52840.h"
|
||||
|
||||
#elif defined (NRF5340_XXAA)
|
||||
#if defined(NRF_APPLICATION)
|
||||
#include "nrf5340_application.h"
|
||||
#include "nrf5340_application_bitfields.h"
|
||||
#elif defined (NRF_NETWORK)
|
||||
#include "nrf5340_network.h"
|
||||
#include "nrf5340_network_bitfields.h"
|
||||
#endif
|
||||
|
||||
#elif defined (NRF9160_XXAA)
|
||||
#include "nrf9160.h"
|
||||
#include "nrf9160_bitfields.h"
|
||||
#include "nrf9160_name_change.h"
|
||||
|
||||
#else
|
||||
#error "Device must be defined. See nrf.h."
|
||||
#endif /* NRF51, NRF52805_XXAA, NRF52810_XXAA, NRF52811_XXAA, NRF52820_XXAA, NRF52832_XXAA, NRF52832_XXAB, NRF52833_XXAA, NRF52840_XXAA, NRF5340_XXAA_APPLICATION, NRF5340_XXAA_NETWORK, NRF9160_XXAA */
|
||||
|
||||
#include "compiler_abstraction.h"
|
||||
|
||||
#endif /* NRF_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* This file is deprecated */
|
||||
#ifndef _NRF51422_PERIPHERALS_H
|
||||
#define _NRF51422_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51422_PERIPHERALS_H
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* This file is deprecated */
|
||||
#ifndef _NRF51801_PERIPHERALS_H
|
||||
#define _NRF51801_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51801_PERIPHERALS_H
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* This file is deprecated */
|
||||
#ifndef _NRF51802_PERIPHERALS_H
|
||||
#define _NRF51802_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51802_PERIPHERALS_H
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* This file is deprecated */
|
||||
#ifndef _NRF51822_PERIPHERALS_H
|
||||
#define _NRF51822_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51822_PERIPHERALS_H
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* This file is deprecated */
|
||||
#ifndef _NRF51824_PERIPHERALS_H
|
||||
#define _NRF51824_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51824_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,446 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF51_DEPRECATED_H
|
||||
#define NRF51_DEPRECATED_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the updates made to nrf51.h and
|
||||
* nrf51_bitfields.h. The macros defined in this file were available previously. Do not use these
|
||||
* macros on purpose. Use the ones defined in nrf51.h and nrf51_bitfields.h instead.
|
||||
*/
|
||||
|
||||
/* NVMC */
|
||||
/* The register ERASEPROTECTEDPAGE is called ERASEPCR0 in the documentation. */
|
||||
#define ERASEPROTECTEDPAGE ERASEPCR0
|
||||
|
||||
|
||||
/* LPCOMP */
|
||||
/* The interrupt ISR was renamed. Adding old name to the macros. */
|
||||
#define LPCOMP_COMP_IRQHandler LPCOMP_IRQHandler
|
||||
#define LPCOMP_COMP_IRQn LPCOMP_IRQn
|
||||
/* Corrected typo in RESULT register. */
|
||||
#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
|
||||
|
||||
|
||||
/* MPU */
|
||||
/* The field MPU.PERR0.LPCOMP_COMP was renamed. Added into deprecated in case somebody was using the macros defined for it. */
|
||||
#define MPU_PERR0_LPCOMP_COMP_Pos MPU_PERR0_LPCOMP_Pos
|
||||
#define MPU_PERR0_LPCOMP_COMP_Msk MPU_PERR0_LPCOMP_Msk
|
||||
#define MPU_PERR0_LPCOMP_COMP_InRegion1 MPU_PERR0_LPCOMP_InRegion1
|
||||
#define MPU_PERR0_LPCOMP_COMP_InRegion0 MPU_PERR0_LPCOMP_InRegion0
|
||||
|
||||
|
||||
/* POWER */
|
||||
/* The field POWER.RAMON.OFFRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
|
||||
#define POWER_RAMON_OFFRAM3_Pos (19UL)
|
||||
#define POWER_RAMON_OFFRAM3_Msk (0x1UL << POWER_RAMON_OFFRAM3_Pos)
|
||||
#define POWER_RAMON_OFFRAM3_RAM3Off (0UL)
|
||||
#define POWER_RAMON_OFFRAM3_RAM3On (1UL)
|
||||
/* The field POWER.RAMON.OFFRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
|
||||
#define POWER_RAMON_OFFRAM2_Pos (18UL)
|
||||
#define POWER_RAMON_OFFRAM2_Msk (0x1UL << POWER_RAMON_OFFRAM2_Pos)
|
||||
#define POWER_RAMON_OFFRAM2_RAM2Off (0UL)
|
||||
#define POWER_RAMON_OFFRAM2_RAM2On (1UL)
|
||||
/* The field POWER.RAMON.ONRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
|
||||
#define POWER_RAMON_ONRAM3_Pos (3UL)
|
||||
#define POWER_RAMON_ONRAM3_Msk (0x1UL << POWER_RAMON_ONRAM3_Pos)
|
||||
#define POWER_RAMON_ONRAM3_RAM3Off (0UL)
|
||||
#define POWER_RAMON_ONRAM3_RAM3On (1UL)
|
||||
/* The field POWER.RAMON.ONRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
|
||||
#define POWER_RAMON_ONRAM2_Pos (2UL)
|
||||
#define POWER_RAMON_ONRAM2_Msk (0x1UL << POWER_RAMON_ONRAM2_Pos)
|
||||
#define POWER_RAMON_ONRAM2_RAM2Off (0UL)
|
||||
#define POWER_RAMON_ONRAM2_RAM2On (1UL)
|
||||
|
||||
|
||||
/* RADIO */
|
||||
/* The enumerated value RADIO.TXPOWER.TXPOWER.Neg40dBm was renamed. Added into deprecated with the new macro name. */
|
||||
#define RADIO_TXPOWER_TXPOWER_Neg40dBm RADIO_TXPOWER_TXPOWER_Neg30dBm
|
||||
/* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */
|
||||
#define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos
|
||||
#define RADIO_CRCCNF_SKIP_ADDR_Msk RADIO_CRCCNF_SKIPADDR_Msk
|
||||
#define RADIO_CRCCNF_SKIP_ADDR_Include RADIO_CRCCNF_SKIPADDR_Include
|
||||
#define RADIO_CRCCNF_SKIP_ADDR_Skip RADIO_CRCCNF_SKIPADDR_Skip
|
||||
/* The name of the field PLLLOCK was corrected. Old macros added for compatibility. */
|
||||
#define RADIO_TEST_PLL_LOCK_Pos RADIO_TEST_PLLLOCK_Pos
|
||||
#define RADIO_TEST_PLL_LOCK_Msk RADIO_TEST_PLLLOCK_Msk
|
||||
#define RADIO_TEST_PLL_LOCK_Disabled RADIO_TEST_PLLLOCK_Disabled
|
||||
#define RADIO_TEST_PLL_LOCK_Enabled RADIO_TEST_PLLLOCK_Enabled
|
||||
/* The name of the field CONSTCARRIER was corrected. Old macros added for compatibility. */
|
||||
#define RADIO_TEST_CONST_CARRIER_Pos RADIO_TEST_CONSTCARRIER_Pos
|
||||
#define RADIO_TEST_CONST_CARRIER_Msk RADIO_TEST_CONSTCARRIER_Msk
|
||||
#define RADIO_TEST_CONST_CARRIER_Disabled RADIO_TEST_CONSTCARRIER_Disabled
|
||||
#define RADIO_TEST_CONST_CARRIER_Enabled RADIO_TEST_CONSTCARRIER_Enabled
|
||||
|
||||
|
||||
/* FICR */
|
||||
/* The registers FICR.SIZERAMBLOCK0, FICR.SIZERAMBLOCK1, FICR.SIZERAMBLOCK2 and FICR.SIZERAMBLOCK3 were renamed into an array. */
|
||||
#define SIZERAMBLOCK0 SIZERAMBLOCKS
|
||||
#define SIZERAMBLOCK1 SIZERAMBLOCKS
|
||||
#define SIZERAMBLOCK2 SIZERAMBLOCK[2] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */
|
||||
#define SIZERAMBLOCK3 SIZERAMBLOCK[3] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */
|
||||
/* The registers FICR.DEVICEID0 and FICR.DEVICEID1 were renamed into an array. */
|
||||
#define DEVICEID0 DEVICEID[0]
|
||||
#define DEVICEID1 DEVICEID[1]
|
||||
/* The registers FICR.ER0, FICR.ER1, FICR.ER2 and FICR.ER3 were renamed into an array. */
|
||||
#define ER0 ER[0]
|
||||
#define ER1 ER[1]
|
||||
#define ER2 ER[2]
|
||||
#define ER3 ER[3]
|
||||
/* The registers FICR.IR0, FICR.IR1, FICR.IR2 and FICR.IR3 were renamed into an array. */
|
||||
#define IR0 IR[0]
|
||||
#define IR1 IR[1]
|
||||
#define IR2 IR[2]
|
||||
#define IR3 IR[3]
|
||||
/* The registers FICR.DEVICEADDR0 and FICR.DEVICEADDR1 were renamed into an array. */
|
||||
#define DEVICEADDR0 DEVICEADDR[0]
|
||||
#define DEVICEADDR1 DEVICEADDR[1]
|
||||
|
||||
|
||||
/* PPI */
|
||||
/* The tasks PPI.TASKS_CHGxEN and PPI.TASKS_CHGxDIS were renamed into an array of structs. */
|
||||
#define TASKS_CHG0EN TASKS_CHG[0].EN
|
||||
#define TASKS_CHG0DIS TASKS_CHG[0].DIS
|
||||
#define TASKS_CHG1EN TASKS_CHG[1].EN
|
||||
#define TASKS_CHG1DIS TASKS_CHG[1].DIS
|
||||
#define TASKS_CHG2EN TASKS_CHG[2].EN
|
||||
#define TASKS_CHG2DIS TASKS_CHG[2].DIS
|
||||
#define TASKS_CHG3EN TASKS_CHG[3].EN
|
||||
#define TASKS_CHG3DIS TASKS_CHG[3].DIS
|
||||
/* The registers PPI.CHx_EEP and PPI.CHx_TEP were renamed into an array of structs. */
|
||||
#define CH0_EEP CH[0].EEP
|
||||
#define CH0_TEP CH[0].TEP
|
||||
#define CH1_EEP CH[1].EEP
|
||||
#define CH1_TEP CH[1].TEP
|
||||
#define CH2_EEP CH[2].EEP
|
||||
#define CH2_TEP CH[2].TEP
|
||||
#define CH3_EEP CH[3].EEP
|
||||
#define CH3_TEP CH[3].TEP
|
||||
#define CH4_EEP CH[4].EEP
|
||||
#define CH4_TEP CH[4].TEP
|
||||
#define CH5_EEP CH[5].EEP
|
||||
#define CH5_TEP CH[5].TEP
|
||||
#define CH6_EEP CH[6].EEP
|
||||
#define CH6_TEP CH[6].TEP
|
||||
#define CH7_EEP CH[7].EEP
|
||||
#define CH7_TEP CH[7].TEP
|
||||
#define CH8_EEP CH[8].EEP
|
||||
#define CH8_TEP CH[8].TEP
|
||||
#define CH9_EEP CH[9].EEP
|
||||
#define CH9_TEP CH[9].TEP
|
||||
#define CH10_EEP CH[10].EEP
|
||||
#define CH10_TEP CH[10].TEP
|
||||
#define CH11_EEP CH[11].EEP
|
||||
#define CH11_TEP CH[11].TEP
|
||||
#define CH12_EEP CH[12].EEP
|
||||
#define CH12_TEP CH[12].TEP
|
||||
#define CH13_EEP CH[13].EEP
|
||||
#define CH13_TEP CH[13].TEP
|
||||
#define CH14_EEP CH[14].EEP
|
||||
#define CH14_TEP CH[14].TEP
|
||||
#define CH15_EEP CH[15].EEP
|
||||
#define CH15_TEP CH[15].TEP
|
||||
/* The registers PPI.CHG0, PPI.CHG1, PPI.CHG2 and PPI.CHG3 were renamed into an array. */
|
||||
#define CHG0 CHG[0]
|
||||
#define CHG1 CHG[1]
|
||||
#define CHG2 CHG[2]
|
||||
#define CHG3 CHG[3]
|
||||
/* All bitfield macros for the CHGx registers therefore changed name. */
|
||||
#define PPI_CHG0_CH15_Pos PPI_CHG_CH15_Pos
|
||||
#define PPI_CHG0_CH15_Msk PPI_CHG_CH15_Msk
|
||||
#define PPI_CHG0_CH15_Excluded PPI_CHG_CH15_Excluded
|
||||
#define PPI_CHG0_CH15_Included PPI_CHG_CH15_Included
|
||||
#define PPI_CHG0_CH14_Pos PPI_CHG_CH14_Pos
|
||||
#define PPI_CHG0_CH14_Msk PPI_CHG_CH14_Msk
|
||||
#define PPI_CHG0_CH14_Excluded PPI_CHG_CH14_Excluded
|
||||
#define PPI_CHG0_CH14_Included PPI_CHG_CH14_Included
|
||||
#define PPI_CHG0_CH13_Pos PPI_CHG_CH13_Pos
|
||||
#define PPI_CHG0_CH13_Msk PPI_CHG_CH13_Msk
|
||||
#define PPI_CHG0_CH13_Excluded PPI_CHG_CH13_Excluded
|
||||
#define PPI_CHG0_CH13_Included PPI_CHG_CH13_Included
|
||||
#define PPI_CHG0_CH12_Pos PPI_CHG_CH12_Pos
|
||||
#define PPI_CHG0_CH12_Msk PPI_CHG_CH12_Msk
|
||||
#define PPI_CHG0_CH12_Excluded PPI_CHG_CH12_Excluded
|
||||
#define PPI_CHG0_CH12_Included PPI_CHG_CH12_Included
|
||||
#define PPI_CHG0_CH11_Pos PPI_CHG_CH11_Pos
|
||||
#define PPI_CHG0_CH11_Msk PPI_CHG_CH11_Msk
|
||||
#define PPI_CHG0_CH11_Excluded PPI_CHG_CH11_Excluded
|
||||
#define PPI_CHG0_CH11_Included PPI_CHG_CH11_Included
|
||||
#define PPI_CHG0_CH10_Pos PPI_CHG_CH10_Pos
|
||||
#define PPI_CHG0_CH10_Msk PPI_CHG_CH10_Msk
|
||||
#define PPI_CHG0_CH10_Excluded PPI_CHG_CH10_Excluded
|
||||
#define PPI_CHG0_CH10_Included PPI_CHG_CH10_Included
|
||||
#define PPI_CHG0_CH9_Pos PPI_CHG_CH9_Pos
|
||||
#define PPI_CHG0_CH9_Msk PPI_CHG_CH9_Msk
|
||||
#define PPI_CHG0_CH9_Excluded PPI_CHG_CH9_Excluded
|
||||
#define PPI_CHG0_CH9_Included PPI_CHG_CH9_Included
|
||||
#define PPI_CHG0_CH8_Pos PPI_CHG_CH8_Pos
|
||||
#define PPI_CHG0_CH8_Msk PPI_CHG_CH8_Msk
|
||||
#define PPI_CHG0_CH8_Excluded PPI_CHG_CH8_Excluded
|
||||
#define PPI_CHG0_CH8_Included PPI_CHG_CH8_Included
|
||||
#define PPI_CHG0_CH7_Pos PPI_CHG_CH7_Pos
|
||||
#define PPI_CHG0_CH7_Msk PPI_CHG_CH7_Msk
|
||||
#define PPI_CHG0_CH7_Excluded PPI_CHG_CH7_Excluded
|
||||
#define PPI_CHG0_CH7_Included PPI_CHG_CH7_Included
|
||||
#define PPI_CHG0_CH6_Pos PPI_CHG_CH6_Pos
|
||||
#define PPI_CHG0_CH6_Msk PPI_CHG_CH6_Msk
|
||||
#define PPI_CHG0_CH6_Excluded PPI_CHG_CH6_Excluded
|
||||
#define PPI_CHG0_CH6_Included PPI_CHG_CH6_Included
|
||||
#define PPI_CHG0_CH5_Pos PPI_CHG_CH5_Pos
|
||||
#define PPI_CHG0_CH5_Msk PPI_CHG_CH5_Msk
|
||||
#define PPI_CHG0_CH5_Excluded PPI_CHG_CH5_Excluded
|
||||
#define PPI_CHG0_CH5_Included PPI_CHG_CH5_Included
|
||||
#define PPI_CHG0_CH4_Pos PPI_CHG_CH4_Pos
|
||||
#define PPI_CHG0_CH4_Msk PPI_CHG_CH4_Msk
|
||||
#define PPI_CHG0_CH4_Excluded PPI_CHG_CH4_Excluded
|
||||
#define PPI_CHG0_CH4_Included PPI_CHG_CH4_Included
|
||||
#define PPI_CHG0_CH3_Pos PPI_CHG_CH3_Pos
|
||||
#define PPI_CHG0_CH3_Msk PPI_CHG_CH3_Msk
|
||||
#define PPI_CHG0_CH3_Excluded PPI_CHG_CH3_Excluded
|
||||
#define PPI_CHG0_CH3_Included PPI_CHG_CH3_Included
|
||||
#define PPI_CHG0_CH2_Pos PPI_CHG_CH2_Pos
|
||||
#define PPI_CHG0_CH2_Msk PPI_CHG_CH2_Msk
|
||||
#define PPI_CHG0_CH2_Excluded PPI_CHG_CH2_Excluded
|
||||
#define PPI_CHG0_CH2_Included PPI_CHG_CH2_Included
|
||||
#define PPI_CHG0_CH1_Pos PPI_CHG_CH1_Pos
|
||||
#define PPI_CHG0_CH1_Msk PPI_CHG_CH1_Msk
|
||||
#define PPI_CHG0_CH1_Excluded PPI_CHG_CH1_Excluded
|
||||
#define PPI_CHG0_CH1_Included PPI_CHG_CH1_Included
|
||||
#define PPI_CHG0_CH0_Pos PPI_CHG_CH0_Pos
|
||||
#define PPI_CHG0_CH0_Msk PPI_CHG_CH0_Msk
|
||||
#define PPI_CHG0_CH0_Excluded PPI_CHG_CH0_Excluded
|
||||
#define PPI_CHG0_CH0_Included PPI_CHG_CH0_Included
|
||||
#define PPI_CHG1_CH15_Pos PPI_CHG_CH15_Pos
|
||||
#define PPI_CHG1_CH15_Msk PPI_CHG_CH15_Msk
|
||||
#define PPI_CHG1_CH15_Excluded PPI_CHG_CH15_Excluded
|
||||
#define PPI_CHG1_CH15_Included PPI_CHG_CH15_Included
|
||||
#define PPI_CHG1_CH14_Pos PPI_CHG_CH14_Pos
|
||||
#define PPI_CHG1_CH14_Msk PPI_CHG_CH14_Msk
|
||||
#define PPI_CHG1_CH14_Excluded PPI_CHG_CH14_Excluded
|
||||
#define PPI_CHG1_CH14_Included PPI_CHG_CH14_Included
|
||||
#define PPI_CHG1_CH13_Pos PPI_CHG_CH13_Pos
|
||||
#define PPI_CHG1_CH13_Msk PPI_CHG_CH13_Msk
|
||||
#define PPI_CHG1_CH13_Excluded PPI_CHG_CH13_Excluded
|
||||
#define PPI_CHG1_CH13_Included PPI_CHG_CH13_Included
|
||||
#define PPI_CHG1_CH12_Pos PPI_CHG_CH12_Pos
|
||||
#define PPI_CHG1_CH12_Msk PPI_CHG_CH12_Msk
|
||||
#define PPI_CHG1_CH12_Excluded PPI_CHG_CH12_Excluded
|
||||
#define PPI_CHG1_CH12_Included PPI_CHG_CH12_Included
|
||||
#define PPI_CHG1_CH11_Pos PPI_CHG_CH11_Pos
|
||||
#define PPI_CHG1_CH11_Msk PPI_CHG_CH11_Msk
|
||||
#define PPI_CHG1_CH11_Excluded PPI_CHG_CH11_Excluded
|
||||
#define PPI_CHG1_CH11_Included PPI_CHG_CH11_Included
|
||||
#define PPI_CHG1_CH10_Pos PPI_CHG_CH10_Pos
|
||||
#define PPI_CHG1_CH10_Msk PPI_CHG_CH10_Msk
|
||||
#define PPI_CHG1_CH10_Excluded PPI_CHG_CH10_Excluded
|
||||
#define PPI_CHG1_CH10_Included PPI_CHG_CH10_Included
|
||||
#define PPI_CHG1_CH9_Pos PPI_CHG_CH9_Pos
|
||||
#define PPI_CHG1_CH9_Msk PPI_CHG_CH9_Msk
|
||||
#define PPI_CHG1_CH9_Excluded PPI_CHG_CH9_Excluded
|
||||
#define PPI_CHG1_CH9_Included PPI_CHG_CH9_Included
|
||||
#define PPI_CHG1_CH8_Pos PPI_CHG_CH8_Pos
|
||||
#define PPI_CHG1_CH8_Msk PPI_CHG_CH8_Msk
|
||||
#define PPI_CHG1_CH8_Excluded PPI_CHG_CH8_Excluded
|
||||
#define PPI_CHG1_CH8_Included PPI_CHG_CH8_Included
|
||||
#define PPI_CHG1_CH7_Pos PPI_CHG_CH7_Pos
|
||||
#define PPI_CHG1_CH7_Msk PPI_CHG_CH7_Msk
|
||||
#define PPI_CHG1_CH7_Excluded PPI_CHG_CH7_Excluded
|
||||
#define PPI_CHG1_CH7_Included PPI_CHG_CH7_Included
|
||||
#define PPI_CHG1_CH6_Pos PPI_CHG_CH6_Pos
|
||||
#define PPI_CHG1_CH6_Msk PPI_CHG_CH6_Msk
|
||||
#define PPI_CHG1_CH6_Excluded PPI_CHG_CH6_Excluded
|
||||
#define PPI_CHG1_CH6_Included PPI_CHG_CH6_Included
|
||||
#define PPI_CHG1_CH5_Pos PPI_CHG_CH5_Pos
|
||||
#define PPI_CHG1_CH5_Msk PPI_CHG_CH5_Msk
|
||||
#define PPI_CHG1_CH5_Excluded PPI_CHG_CH5_Excluded
|
||||
#define PPI_CHG1_CH5_Included PPI_CHG_CH5_Included
|
||||
#define PPI_CHG1_CH4_Pos PPI_CHG_CH4_Pos
|
||||
#define PPI_CHG1_CH4_Msk PPI_CHG_CH4_Msk
|
||||
#define PPI_CHG1_CH4_Excluded PPI_CHG_CH4_Excluded
|
||||
#define PPI_CHG1_CH4_Included PPI_CHG_CH4_Included
|
||||
#define PPI_CHG1_CH3_Pos PPI_CHG_CH3_Pos
|
||||
#define PPI_CHG1_CH3_Msk PPI_CHG_CH3_Msk
|
||||
#define PPI_CHG1_CH3_Excluded PPI_CHG_CH3_Excluded
|
||||
#define PPI_CHG1_CH3_Included PPI_CHG_CH3_Included
|
||||
#define PPI_CHG1_CH2_Pos PPI_CHG_CH2_Pos
|
||||
#define PPI_CHG1_CH2_Msk PPI_CHG_CH2_Msk
|
||||
#define PPI_CHG1_CH2_Excluded PPI_CHG_CH2_Excluded
|
||||
#define PPI_CHG1_CH2_Included PPI_CHG_CH2_Included
|
||||
#define PPI_CHG1_CH1_Pos PPI_CHG_CH1_Pos
|
||||
#define PPI_CHG1_CH1_Msk PPI_CHG_CH1_Msk
|
||||
#define PPI_CHG1_CH1_Excluded PPI_CHG_CH1_Excluded
|
||||
#define PPI_CHG1_CH1_Included PPI_CHG_CH1_Included
|
||||
#define PPI_CHG1_CH0_Pos PPI_CHG_CH0_Pos
|
||||
#define PPI_CHG1_CH0_Msk PPI_CHG_CH0_Msk
|
||||
#define PPI_CHG1_CH0_Excluded PPI_CHG_CH0_Excluded
|
||||
#define PPI_CHG1_CH0_Included PPI_CHG_CH0_Included
|
||||
#define PPI_CHG2_CH15_Pos PPI_CHG_CH15_Pos
|
||||
#define PPI_CHG2_CH15_Msk PPI_CHG_CH15_Msk
|
||||
#define PPI_CHG2_CH15_Excluded PPI_CHG_CH15_Excluded
|
||||
#define PPI_CHG2_CH15_Included PPI_CHG_CH15_Included
|
||||
#define PPI_CHG2_CH14_Pos PPI_CHG_CH14_Pos
|
||||
#define PPI_CHG2_CH14_Msk PPI_CHG_CH14_Msk
|
||||
#define PPI_CHG2_CH14_Excluded PPI_CHG_CH14_Excluded
|
||||
#define PPI_CHG2_CH14_Included PPI_CHG_CH14_Included
|
||||
#define PPI_CHG2_CH13_Pos PPI_CHG_CH13_Pos
|
||||
#define PPI_CHG2_CH13_Msk PPI_CHG_CH13_Msk
|
||||
#define PPI_CHG2_CH13_Excluded PPI_CHG_CH13_Excluded
|
||||
#define PPI_CHG2_CH13_Included PPI_CHG_CH13_Included
|
||||
#define PPI_CHG2_CH12_Pos PPI_CHG_CH12_Pos
|
||||
#define PPI_CHG2_CH12_Msk PPI_CHG_CH12_Msk
|
||||
#define PPI_CHG2_CH12_Excluded PPI_CHG_CH12_Excluded
|
||||
#define PPI_CHG2_CH12_Included PPI_CHG_CH12_Included
|
||||
#define PPI_CHG2_CH11_Pos PPI_CHG_CH11_Pos
|
||||
#define PPI_CHG2_CH11_Msk PPI_CHG_CH11_Msk
|
||||
#define PPI_CHG2_CH11_Excluded PPI_CHG_CH11_Excluded
|
||||
#define PPI_CHG2_CH11_Included PPI_CHG_CH11_Included
|
||||
#define PPI_CHG2_CH10_Pos PPI_CHG_CH10_Pos
|
||||
#define PPI_CHG2_CH10_Msk PPI_CHG_CH10_Msk
|
||||
#define PPI_CHG2_CH10_Excluded PPI_CHG_CH10_Excluded
|
||||
#define PPI_CHG2_CH10_Included PPI_CHG_CH10_Included
|
||||
#define PPI_CHG2_CH9_Pos PPI_CHG_CH9_Pos
|
||||
#define PPI_CHG2_CH9_Msk PPI_CHG_CH9_Msk
|
||||
#define PPI_CHG2_CH9_Excluded PPI_CHG_CH9_Excluded
|
||||
#define PPI_CHG2_CH9_Included PPI_CHG_CH9_Included
|
||||
#define PPI_CHG2_CH8_Pos PPI_CHG_CH8_Pos
|
||||
#define PPI_CHG2_CH8_Msk PPI_CHG_CH8_Msk
|
||||
#define PPI_CHG2_CH8_Excluded PPI_CHG_CH8_Excluded
|
||||
#define PPI_CHG2_CH8_Included PPI_CHG_CH8_Included
|
||||
#define PPI_CHG2_CH7_Pos PPI_CHG_CH7_Pos
|
||||
#define PPI_CHG2_CH7_Msk PPI_CHG_CH7_Msk
|
||||
#define PPI_CHG2_CH7_Excluded PPI_CHG_CH7_Excluded
|
||||
#define PPI_CHG2_CH7_Included PPI_CHG_CH7_Included
|
||||
#define PPI_CHG2_CH6_Pos PPI_CHG_CH6_Pos
|
||||
#define PPI_CHG2_CH6_Msk PPI_CHG_CH6_Msk
|
||||
#define PPI_CHG2_CH6_Excluded PPI_CHG_CH6_Excluded
|
||||
#define PPI_CHG2_CH6_Included PPI_CHG_CH6_Included
|
||||
#define PPI_CHG2_CH5_Pos PPI_CHG_CH5_Pos
|
||||
#define PPI_CHG2_CH5_Msk PPI_CHG_CH5_Msk
|
||||
#define PPI_CHG2_CH5_Excluded PPI_CHG_CH5_Excluded
|
||||
#define PPI_CHG2_CH5_Included PPI_CHG_CH5_Included
|
||||
#define PPI_CHG2_CH4_Pos PPI_CHG_CH4_Pos
|
||||
#define PPI_CHG2_CH4_Msk PPI_CHG_CH4_Msk
|
||||
#define PPI_CHG2_CH4_Excluded PPI_CHG_CH4_Excluded
|
||||
#define PPI_CHG2_CH4_Included PPI_CHG_CH4_Included
|
||||
#define PPI_CHG2_CH3_Pos PPI_CHG_CH3_Pos
|
||||
#define PPI_CHG2_CH3_Msk PPI_CHG_CH3_Msk
|
||||
#define PPI_CHG2_CH3_Excluded PPI_CHG_CH3_Excluded
|
||||
#define PPI_CHG2_CH3_Included PPI_CHG_CH3_Included
|
||||
#define PPI_CHG2_CH2_Pos PPI_CHG_CH2_Pos
|
||||
#define PPI_CHG2_CH2_Msk PPI_CHG_CH2_Msk
|
||||
#define PPI_CHG2_CH2_Excluded PPI_CHG_CH2_Excluded
|
||||
#define PPI_CHG2_CH2_Included PPI_CHG_CH2_Included
|
||||
#define PPI_CHG2_CH1_Pos PPI_CHG_CH1_Pos
|
||||
#define PPI_CHG2_CH1_Msk PPI_CHG_CH1_Msk
|
||||
#define PPI_CHG2_CH1_Excluded PPI_CHG_CH1_Excluded
|
||||
#define PPI_CHG2_CH1_Included PPI_CHG_CH1_Included
|
||||
#define PPI_CHG2_CH0_Pos PPI_CHG_CH0_Pos
|
||||
#define PPI_CHG2_CH0_Msk PPI_CHG_CH0_Msk
|
||||
#define PPI_CHG2_CH0_Excluded PPI_CHG_CH0_Excluded
|
||||
#define PPI_CHG2_CH0_Included PPI_CHG_CH0_Included
|
||||
#define PPI_CHG3_CH15_Pos PPI_CHG_CH15_Pos
|
||||
#define PPI_CHG3_CH15_Msk PPI_CHG_CH15_Msk
|
||||
#define PPI_CHG3_CH15_Excluded PPI_CHG_CH15_Excluded
|
||||
#define PPI_CHG3_CH15_Included PPI_CHG_CH15_Included
|
||||
#define PPI_CHG3_CH14_Pos PPI_CHG_CH14_Pos
|
||||
#define PPI_CHG3_CH14_Msk PPI_CHG_CH14_Msk
|
||||
#define PPI_CHG3_CH14_Excluded PPI_CHG_CH14_Excluded
|
||||
#define PPI_CHG3_CH14_Included PPI_CHG_CH14_Included
|
||||
#define PPI_CHG3_CH13_Pos PPI_CHG_CH13_Pos
|
||||
#define PPI_CHG3_CH13_Msk PPI_CHG_CH13_Msk
|
||||
#define PPI_CHG3_CH13_Excluded PPI_CHG_CH13_Excluded
|
||||
#define PPI_CHG3_CH13_Included PPI_CHG_CH13_Included
|
||||
#define PPI_CHG3_CH12_Pos PPI_CHG_CH12_Pos
|
||||
#define PPI_CHG3_CH12_Msk PPI_CHG_CH12_Msk
|
||||
#define PPI_CHG3_CH12_Excluded PPI_CHG_CH12_Excluded
|
||||
#define PPI_CHG3_CH12_Included PPI_CHG_CH12_Included
|
||||
#define PPI_CHG3_CH11_Pos PPI_CHG_CH11_Pos
|
||||
#define PPI_CHG3_CH11_Msk PPI_CHG_CH11_Msk
|
||||
#define PPI_CHG3_CH11_Excluded PPI_CHG_CH11_Excluded
|
||||
#define PPI_CHG3_CH11_Included PPI_CHG_CH11_Included
|
||||
#define PPI_CHG3_CH10_Pos PPI_CHG_CH10_Pos
|
||||
#define PPI_CHG3_CH10_Msk PPI_CHG_CH10_Msk
|
||||
#define PPI_CHG3_CH10_Excluded PPI_CHG_CH10_Excluded
|
||||
#define PPI_CHG3_CH10_Included PPI_CHG_CH10_Included
|
||||
#define PPI_CHG3_CH9_Pos PPI_CHG_CH9_Pos
|
||||
#define PPI_CHG3_CH9_Msk PPI_CHG_CH9_Msk
|
||||
#define PPI_CHG3_CH9_Excluded PPI_CHG_CH9_Excluded
|
||||
#define PPI_CHG3_CH9_Included PPI_CHG_CH9_Included
|
||||
#define PPI_CHG3_CH8_Pos PPI_CHG_CH8_Pos
|
||||
#define PPI_CHG3_CH8_Msk PPI_CHG_CH8_Msk
|
||||
#define PPI_CHG3_CH8_Excluded PPI_CHG_CH8_Excluded
|
||||
#define PPI_CHG3_CH8_Included PPI_CHG_CH8_Included
|
||||
#define PPI_CHG3_CH7_Pos PPI_CHG_CH7_Pos
|
||||
#define PPI_CHG3_CH7_Msk PPI_CHG_CH7_Msk
|
||||
#define PPI_CHG3_CH7_Excluded PPI_CHG_CH7_Excluded
|
||||
#define PPI_CHG3_CH7_Included PPI_CHG_CH7_Included
|
||||
#define PPI_CHG3_CH6_Pos PPI_CHG_CH6_Pos
|
||||
#define PPI_CHG3_CH6_Msk PPI_CHG_CH6_Msk
|
||||
#define PPI_CHG3_CH6_Excluded PPI_CHG_CH6_Excluded
|
||||
#define PPI_CHG3_CH6_Included PPI_CHG_CH6_Included
|
||||
#define PPI_CHG3_CH5_Pos PPI_CHG_CH5_Pos
|
||||
#define PPI_CHG3_CH5_Msk PPI_CHG_CH5_Msk
|
||||
#define PPI_CHG3_CH5_Excluded PPI_CHG_CH5_Excluded
|
||||
#define PPI_CHG3_CH5_Included PPI_CHG_CH5_Included
|
||||
#define PPI_CHG3_CH4_Pos PPI_CHG_CH4_Pos
|
||||
#define PPI_CHG3_CH4_Msk PPI_CHG_CH4_Msk
|
||||
#define PPI_CHG3_CH4_Excluded PPI_CHG_CH4_Excluded
|
||||
#define PPI_CHG3_CH4_Included PPI_CHG_CH4_Included
|
||||
#define PPI_CHG3_CH3_Pos PPI_CHG_CH3_Pos
|
||||
#define PPI_CHG3_CH3_Msk PPI_CHG_CH3_Msk
|
||||
#define PPI_CHG3_CH3_Excluded PPI_CHG_CH3_Excluded
|
||||
#define PPI_CHG3_CH3_Included PPI_CHG_CH3_Included
|
||||
#define PPI_CHG3_CH2_Pos PPI_CHG_CH2_Pos
|
||||
#define PPI_CHG3_CH2_Msk PPI_CHG_CH2_Msk
|
||||
#define PPI_CHG3_CH2_Excluded PPI_CHG_CH2_Excluded
|
||||
#define PPI_CHG3_CH2_Included PPI_CHG_CH2_Included
|
||||
#define PPI_CHG3_CH1_Pos PPI_CHG_CH1_Pos
|
||||
#define PPI_CHG3_CH1_Msk PPI_CHG_CH1_Msk
|
||||
#define PPI_CHG3_CH1_Excluded PPI_CHG_CH1_Excluded
|
||||
#define PPI_CHG3_CH1_Included PPI_CHG_CH1_Included
|
||||
#define PPI_CHG3_CH0_Pos PPI_CHG_CH0_Pos
|
||||
#define PPI_CHG3_CH0_Msk PPI_CHG_CH0_Msk
|
||||
#define PPI_CHG3_CH0_Excluded PPI_CHG_CH0_Excluded
|
||||
#define PPI_CHG3_CH0_Included PPI_CHG_CH0_Included
|
||||
|
||||
/* SPIS */
|
||||
/* nRF51 devices do not have an SPIS0, only SPIS1. SPIS0_EASYDMA_MAXCNT_SIZE was therefore renamed. */
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE SPIS1_EASYDMA_MAXCNT_SIZE
|
||||
|
||||
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF51_DEPRECATED_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF51_PERIPHERALS_H
|
||||
#define _NRF51_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAMON_REGISTERS_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 8
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 16
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 4
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 16
|
||||
#define TIMER2_MAX_SIZE 16
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA */
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Analog to Digital Converter */
|
||||
#define ADC_PRESENT
|
||||
#define ADC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 4
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 8
|
||||
|
||||
|
||||
#endif // _NRF51_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52805_PERIPHERALS_H
|
||||
#define _NRF52805_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 3
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 48
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 10
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 2
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 1
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 14
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 14
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 1
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 1
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 1
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
|
||||
#endif // _NRF52805_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52810_NAME_CHANGE_H
|
||||
#define NRF52810_NAME_CHANGE_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the updates made to nrf52810.h and
|
||||
* nrf52810_bitfields.h. The macros defined in this file were available previously. Do not use these
|
||||
* macros on purpose. Use the ones defined in nrf52810.h and nrf52810_bitfields.h instead.
|
||||
*/
|
||||
|
||||
/* IRQ */
|
||||
/* Changes of interrupt names */
|
||||
#define SPIM0_SPIS0_IRQn SPIM0_SPIS0_SPI0_IRQn
|
||||
#define TWIM0_TWIS0_IRQn TWIM0_TWIS0_TWI0_IRQn
|
||||
#define UARTE0_IRQn UARTE0_UART0_IRQn
|
||||
|
||||
#define SPIM0_SPIS0_IRQHandler SPIM0_SPIS0_SPI0_IRQHandler
|
||||
#define TWIM0_TWIS0_IRQHandler TWIM0_TWIS0_TWI0_IRQHandler
|
||||
#define UARTE0_IRQHandler UARTE0_UART0_IRQHandler
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF52810_NAME_CHANGE_H */
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52810_PERIPHERALS_H
|
||||
#define _NRF52810_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 3
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 48
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 2
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 1
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 10
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 10
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 1
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 1
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 10
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 1
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 10
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 10
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 1
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Pulse Density Modulator */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
#define PDM_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
|
||||
#endif // _NRF52810_PERIPHERALS_H
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52810_TO_NRF52811_H
|
||||
#define NRF52810_TO_NRF52811_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the name changes between nRF52810 and nRF52811 devices.
|
||||
* It redefines the old nRF52810 names into the new ones as long as the functionality is still supported. If the
|
||||
* functionality is gone, there old names are not defined, so compilation will fail. */
|
||||
|
||||
/* Differences between latest nRF52810 headers and nRF52811 headers. */
|
||||
|
||||
/* Interrupt service routines handlers. */
|
||||
#ifndef TWIM0_TWIS0_IRQHandler
|
||||
#define TWIM0_TWIS0_IRQHandler TWIM0_TWIS0_TWI0_SPIM1_SPIS1_SPI1_IRQHandler
|
||||
#endif
|
||||
|
||||
|
||||
/* Interrupt service routines index. */
|
||||
#ifndef TWIM0_TWIS0_IRQn
|
||||
#define TWIM0_TWIS0_IRQn TWIM0_TWIS0_TWI0_SPIM1_SPIS1_SPI1_IRQn
|
||||
#endif
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF52810_TO_NRF52811_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52811_PERIPHERALS_H
|
||||
#define _NRF52811_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 3
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
#define BPROT_REGIONS_NUM 48
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
#define RADIO_FEATURE_IEEE_802_15_4_PRESENT
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 2
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 2
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 14
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 2
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 14
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 1
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 1
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 1
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 1
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Pulse Density Modulator */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
#define PDM_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
|
||||
#endif // _NRF52811_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52820_PERIPHERALS_H
|
||||
#define _NRF52820_PERIPHERALS_H
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 4
|
||||
|
||||
#define POWER_FEATURE_VDDH_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM (18)
|
||||
#define P0_FEATURE_PINS_PRESENT (nrf52_errata_230() ? 0xF0168E3Ful : 0x7017C1FFul)
|
||||
|
||||
/* ACL */
|
||||
#define ACL_PRESENT
|
||||
|
||||
#define ACL_REGIONS_COUNT 8
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 14
|
||||
#define RADIO_FEATURE_IEEE_802_15_4_PRESENT
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos8dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 6
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
#define EGU2_CH_NUM 16
|
||||
#define EGU3_CH_NUM 16
|
||||
#define EGU4_CH_NUM 16
|
||||
#define EGU5_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 4
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
#define TIMER3_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
#define TIMER3_CC_NUM 6
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 2
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 2
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 2
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define TWIM1_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 2
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define TWIS1_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
|
||||
/* Universal Serial Bus Device */
|
||||
#define USBD_PRESENT
|
||||
#define USBD_COUNT 1
|
||||
|
||||
#define USBD_EASYDMA_MAXCNT_SIZE 7
|
||||
|
||||
#endif // _NRF52820_PERIPHERALS_H
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52832_PERIPHERALS_H
|
||||
#define _NRF52832_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#if defined(NRF52832_XXAA)
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 8
|
||||
#elif defined(NRF52832_XXAB)
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 4
|
||||
#endif
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
#define NVMC_FEATURE_CACHE_PRESENT
|
||||
|
||||
/* Floating Point Unit */
|
||||
#define FPU_PRESENT
|
||||
#define FPU_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* Memory Watch Unit */
|
||||
#define MWU_PRESENT
|
||||
#define MWU_COUNT 1
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 1
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
|
||||
/* MPU and BPROT */
|
||||
#define BPROT_PRESENT
|
||||
|
||||
#define BPROT_REGIONS_SIZE 4096
|
||||
|
||||
#if defined(NRF52832_XXAA)
|
||||
#define BPROT_REGIONS_NUM 128
|
||||
#elif defined(NRF52832_XXAB)
|
||||
#define BPROT_REGIONS_NUM 64
|
||||
#endif
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos4dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* NFC Tag */
|
||||
#define NFCT_PRESENT
|
||||
#define NFCT_COUNT 1
|
||||
|
||||
#define NFCT_EASYDMA_MAXCNT_SIZE 9
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 6
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
#define EGU2_CH_NUM 16
|
||||
#define EGU3_CH_NUM 16
|
||||
#define EGU4_CH_NUM 16
|
||||
#define EGU5_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 5
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
#define TIMER3_MAX_SIZE 32
|
||||
#define TIMER4_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
#define TIMER3_CC_NUM 6
|
||||
#define TIMER4_CC_NUM 6
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 3
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
#define RTC2_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 3
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 3
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
#define SPIM2_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM2_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM2_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM2_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 8
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 8
|
||||
#define SPIM2_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 3
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 8
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
#define SPIS2_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 2
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 8
|
||||
#define TWIM1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 2
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 8
|
||||
#define TWIS1_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 8
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 16
|
||||
|
||||
#define LPCOMP_FEATURE_HYST_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 3
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
#define PWM1_CH_NUM 4
|
||||
#define PWM2_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM1_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM2_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Pulse Density Modulator */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
#define PDM_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Inter-IC Sound Interface */
|
||||
#define I2S_PRESENT
|
||||
#define I2S_COUNT 1
|
||||
|
||||
#define I2S_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
|
||||
#endif // _NRF52832_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52833_PERIPHERALS_H
|
||||
#define _NRF52833_PERIPHERALS_H
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
#define CLOCK_FEATURE_LFXO_EXTENDED_DEBOUNCE_PRESENT
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 9
|
||||
|
||||
#define POWER_FEATURE_VDDH_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
#define NVMC_FEATURE_CACHE_PRESENT
|
||||
|
||||
/* Floating Point Unit */
|
||||
#define FPU_PRESENT
|
||||
#define FPU_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* Memory Watch Unit */
|
||||
#define MWU_PRESENT
|
||||
#define MWU_COUNT 1
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 2
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
#define P1_PIN_NUM 10
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
#define P1_FEATURE_PINS_PRESENT 0x000003FFUL
|
||||
|
||||
/* ACL */
|
||||
#define ACL_PRESENT
|
||||
|
||||
#define ACL_REGIONS_COUNT 8
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
#define RADIO_FEATURE_IEEE_802_15_4_PRESENT
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos8dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* NFC Tag */
|
||||
#define NFCT_PRESENT
|
||||
#define NFCT_COUNT 1
|
||||
|
||||
#define NFCT_EASYDMA_MAXCNT_SIZE 9
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 6
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
#define EGU2_CH_NUM 16
|
||||
#define EGU3_CH_NUM 16
|
||||
#define EGU4_CH_NUM 16
|
||||
#define EGU5_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 5
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
#define TIMER3_MAX_SIZE 32
|
||||
#define TIMER4_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
#define TIMER3_CC_NUM 6
|
||||
#define TIMER4_CC_NUM 6
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 3
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
#define RTC2_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 3
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 4
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
#define SPIM2_MAX_DATARATE 8
|
||||
#define SPIM3_MAX_DATARATE 32
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM2_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM3_FEATURE_HARDWARE_CSN_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM2_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM3_FEATURE_DCX_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM2_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM3_FEATURE_RXDELAY_PRESENT 1
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 3
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS2_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 2
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 2
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
#define UART0_FEATURE_ODD_PARITY_PRESENT
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 2
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define UARTE1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
#define UARTE0_FEATURE_ODD_PARITY_PRESENT
|
||||
#define UARTE1_FEATURE_ODD_PARITY_PRESENT
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 16
|
||||
|
||||
#define LPCOMP_FEATURE_HYST_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 4
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
#define PWM1_CH_NUM 4
|
||||
#define PWM2_CH_NUM 4
|
||||
#define PWM3_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM1_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM2_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM3_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Pulse Density Modulator */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
#define PDM_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Inter-IC Sound Interface */
|
||||
#define I2S_PRESENT
|
||||
#define I2S_COUNT 1
|
||||
|
||||
#define I2S_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Universal Serial Bus Device */
|
||||
#define USBD_PRESENT
|
||||
#define USBD_COUNT 1
|
||||
|
||||
#define USBD_EASYDMA_MAXCNT_SIZE 7
|
||||
|
||||
#endif // _NRF52833_PERIPHERALS_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52833_TO_NRF52820_H
|
||||
#define NRF52833_TO_NRF52820_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the name changes between nRF52833 and nRF52820 devices.
|
||||
* It redefines the old nRF52833 names into the new ones as long as the functionality is still supported. If the
|
||||
* functionality is gone, there old names are not defined, so compilation will fail. */
|
||||
|
||||
/* Differences between latest nRF52833 headers and nRF52820 headers. */
|
||||
|
||||
#endif /* NRF52833_TO_NRF52820_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF52840_PERIPHERALS_H
|
||||
#define _NRF52840_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define POWER_FEATURE_RAM_REGISTERS_COUNT 9
|
||||
|
||||
#define POWER_FEATURE_VDDH_PRESENT
|
||||
#define POWER_FEATURE_VDDH_DCDC_PRESENT
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
#define NVMC_FEATURE_CACHE_PRESENT
|
||||
|
||||
/* Floating Point Unit */
|
||||
#define FPU_PRESENT
|
||||
#define FPU_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 6
|
||||
|
||||
/* Memory Watch Unit */
|
||||
#define MWU_PRESENT
|
||||
#define MWU_COUNT 1
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 2
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
#define P1_PIN_NUM 16
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
#define P1_FEATURE_PINS_PRESENT 0x0000FFFFUL
|
||||
|
||||
/* ACL */
|
||||
#define ACL_PRESENT
|
||||
|
||||
#define ACL_REGIONS_COUNT 8
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 8
|
||||
#define RADIO_FEATURE_IEEE_802_15_4_PRESENT
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_Pos8dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* NFC Tag */
|
||||
#define NFCT_PRESENT
|
||||
#define NFCT_COUNT 1
|
||||
|
||||
#define NFCT_EASYDMA_MAXCNT_SIZE 9
|
||||
|
||||
/* Peripheral to Peripheral Interconnect */
|
||||
#define PPI_PRESENT
|
||||
#define PPI_COUNT 1
|
||||
|
||||
#define PPI_CH_NUM 20
|
||||
#define PPI_FIXED_CH_NUM 12
|
||||
#define PPI_GROUP_NUM 6
|
||||
#define PPI_FEATURE_FORKS_PRESENT
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 6
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
#define EGU2_CH_NUM 16
|
||||
#define EGU3_CH_NUM 16
|
||||
#define EGU4_CH_NUM 16
|
||||
#define EGU5_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 5
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
#define TIMER3_MAX_SIZE 32
|
||||
#define TIMER4_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 4
|
||||
#define TIMER1_CC_NUM 4
|
||||
#define TIMER2_CC_NUM 4
|
||||
#define TIMER3_CC_NUM 6
|
||||
#define TIMER4_CC_NUM 6
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 3
|
||||
|
||||
#define RTC0_CC_NUM 3
|
||||
#define RTC1_CC_NUM 4
|
||||
#define RTC2_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Serial Peripheral Interface Master */
|
||||
#define SPI_PRESENT
|
||||
#define SPI_COUNT 3
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 4
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
#define SPIM2_MAX_DATARATE 8
|
||||
#define SPIM3_MAX_DATARATE 32
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM2_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM3_FEATURE_HARDWARE_CSN_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM2_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM3_FEATURE_DCX_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM2_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM3_FEATURE_RXDELAY_PRESENT 1
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 3
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS2_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Master */
|
||||
#define TWI_PRESENT
|
||||
#define TWI_COUNT 2
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 2
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 2
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter */
|
||||
#define UART_PRESENT
|
||||
#define UART_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 2
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define UARTE1_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 1
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 16
|
||||
|
||||
#define LPCOMP_FEATURE_HYST_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 4
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
#define PWM1_CH_NUM 4
|
||||
#define PWM2_CH_NUM 4
|
||||
#define PWM3_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM1_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM2_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM3_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Pulse Density Modulator */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
#define PDM_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* Inter-IC Sound Interface */
|
||||
#define I2S_PRESENT
|
||||
#define I2S_COUNT 1
|
||||
|
||||
#define I2S_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Universal Serial Bus Device */
|
||||
#define USBD_PRESENT
|
||||
#define USBD_COUNT 1
|
||||
|
||||
#define USBD_EASYDMA_MAXCNT_SIZE 7
|
||||
|
||||
/* ARM TrustZone Cryptocell 310 */
|
||||
#define CRYPTOCELL_PRESENT
|
||||
#define CRYPTOCELL_COUNT 1
|
||||
|
||||
/* Quad SPI */
|
||||
#define QSPI_PRESENT
|
||||
#define QSPI_COUNT 1
|
||||
|
||||
#define QSPI_EASYDMA_MAXCNT_SIZE 20
|
||||
|
||||
#endif // _NRF52840_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52_NAME_CHANGE_H
|
||||
#define NRF52_NAME_CHANGE_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the updates made to nrf52.h and
|
||||
* nrf52_bitfields.h. The macros defined in this file were available previously. Do not use these
|
||||
* macros on purpose. Use the ones defined in nrf52.h and nrf52_bitfields.h instead.
|
||||
*/
|
||||
|
||||
/* I2S */
|
||||
/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */
|
||||
#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled
|
||||
#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled
|
||||
#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master
|
||||
#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave
|
||||
#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled
|
||||
#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled
|
||||
#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled
|
||||
#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right
|
||||
#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right
|
||||
|
||||
/* LPCOMP */
|
||||
/* Corrected typo in RESULT register. */
|
||||
#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF52_NAME_CHANGE_H */
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52_TO_NRF52810_H
|
||||
#define NRF52_TO_NRF52810_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the name changes between nRF51 or nRF52832 and nRF52810 devices.
|
||||
* It redefines the old nRF51 or nRF52832 names into the new ones as long as the functionality is still supported. If the
|
||||
* functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros
|
||||
* from the nrf52_namechange.h file. */
|
||||
|
||||
/* Differences between latest nRF52 headers and nRF52810 headers. */
|
||||
|
||||
/* UART */
|
||||
/* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */
|
||||
#ifndef PSELRTS
|
||||
#define PSELRTS PSEL.RTS
|
||||
#endif
|
||||
#ifndef PSELTXD
|
||||
#define PSELTXD PSEL.TXD
|
||||
#endif
|
||||
#ifndef PSELCTS
|
||||
#define PSELCTS PSEL.CTS
|
||||
#endif
|
||||
#ifndef PSELRXD
|
||||
#define PSELRXD PSEL.RXD
|
||||
#endif
|
||||
|
||||
/* TWI */
|
||||
/* The registers PSELSCL, PSELSDA were restructured into a struct. */
|
||||
#ifndef PSELSCL
|
||||
#define PSELSCL PSEL.SCL
|
||||
#endif
|
||||
#ifndef PSELSDA
|
||||
#define PSELSDA PSEL.SDA
|
||||
#endif
|
||||
|
||||
|
||||
/* Interrupt service routines handlers. Note that handlers SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler and
|
||||
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler are not redefined since functionality is not equivalent. */
|
||||
#ifndef COMP_LPCOMP_IRQHandler
|
||||
#define COMP_LPCOMP_IRQHandler COMP_IRQHandler
|
||||
#endif
|
||||
#ifndef SWI2_EGU2_IRQHandler
|
||||
#define SWI2_EGU2_IRQHandler SWI2_IRQHandler
|
||||
#endif
|
||||
#ifndef SWI3_EGU3_IRQHandler
|
||||
#define SWI3_EGU3_IRQHandler SWI3_IRQHandler
|
||||
#endif
|
||||
#ifndef SWI4_EGU4_IRQHandler
|
||||
#define SWI4_EGU4_IRQHandler SWI4_IRQHandler
|
||||
#endif
|
||||
#ifndef SWI5_EGU5_IRQHandler
|
||||
#define SWI5_EGU5_IRQHandler SWI5_IRQHandler
|
||||
#endif
|
||||
|
||||
/* Interrupt service routines index. Note that indexes SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn and
|
||||
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn are not redefined since functionality is not equivalent. */
|
||||
#ifndef COMP_LPCOMP_IRQn
|
||||
#define COMP_LPCOMP_IRQn COMP_IRQn
|
||||
#endif
|
||||
#ifndef SWI2_EGU2_IRQn
|
||||
#define SWI2_EGU2_IRQn SWI2_IRQn
|
||||
#endif
|
||||
#ifndef SWI3_EGU3_IRQn
|
||||
#define SWI3_EGU3_IRQn SWI3_IRQn
|
||||
#endif
|
||||
#ifndef SWI4_EGU4_IRQn
|
||||
#define SWI4_EGU4_IRQn SWI4_IRQn
|
||||
#endif
|
||||
#ifndef SWI5_EGU5_IRQn
|
||||
#define SWI5_EGU5_IRQn SWI5_IRQn
|
||||
#endif
|
||||
|
||||
/* From nrf52_name_change.h. Several macros changed in different versions of nRF52 headers. By defining the following, any code written for any version of nRF52 headers will still compile. */
|
||||
|
||||
/* I2S */
|
||||
/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */
|
||||
#ifndef I2S_ENABLE_ENABLE_DISABLE
|
||||
#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled
|
||||
#endif
|
||||
#ifndef I2S_ENABLE_ENABLE_ENABLE
|
||||
#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_MASTER
|
||||
#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_SLAVE
|
||||
#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_DISABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_ENABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_DISABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_ENABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_DISABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_ENABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_8BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_16BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_24BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_LEFT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_RIGHT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_FORMAT_FORMAT_ALIGNED
|
||||
#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_STEREO
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_LEFT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_RIGHT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right
|
||||
#endif
|
||||
|
||||
/* LPCOMP */
|
||||
/* Corrected typo in RESULT register. */
|
||||
#ifndef LPCOMP_RESULT_RESULT_Bellow
|
||||
#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
|
||||
#endif
|
||||
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF52_TO_NRF52810_H */
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52_TO_NRF52833_H
|
||||
#define NRF52_TO_NRF52833_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the name changes between nRF51 or nRF52832 and nRF52840 devices.
|
||||
* It redefines the old nRF51 or nRF52832 names into the new ones as long as the functionality is still supported. If the
|
||||
* functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros
|
||||
* from the nrf52_namechange.h file. */
|
||||
|
||||
/* Differences between latest nRF52 headers and nRF52840 headers. */
|
||||
|
||||
/* UART */
|
||||
/* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */
|
||||
#ifndef PSELRTS
|
||||
#define PSELRTS PSEL.RTS
|
||||
#endif
|
||||
#ifndef PSELTXD
|
||||
#define PSELTXD PSEL.TXD
|
||||
#endif
|
||||
#ifndef PSELCTS
|
||||
#define PSELCTS PSEL.CTS
|
||||
#endif
|
||||
#ifndef PSELRXD
|
||||
#define PSELRXD PSEL.RXD
|
||||
#endif
|
||||
|
||||
/* TWI */
|
||||
/* The registers PSELSCL, PSELSDA were restructured into a struct. */
|
||||
#ifndef PSELSCL
|
||||
#define PSELSCL PSEL.SCL
|
||||
#endif
|
||||
#ifndef PSELSDA
|
||||
#define PSELSDA PSEL.SDA
|
||||
#endif
|
||||
|
||||
/* LPCOMP */
|
||||
/* The hysteresis control enumerated values has changed name for nRF52833 devices. */
|
||||
#ifndef LPCOMP_HYST_HYST_NoHyst
|
||||
#define LPCOMP_HYST_HYST_NoHyst LPCOMP_HYST_HYST_Disabled
|
||||
#endif
|
||||
#ifndef LPCOMP_HYST_HYST_Hyst50mV
|
||||
#define LPCOMP_HYST_HYST_Hyst50mV LPCOMP_HYST_HYST_Enabled
|
||||
#endif
|
||||
|
||||
|
||||
/* From nrf52_name_change.h. Several macros changed in different versions of nRF52 headers. By defining the following, any code written for any version of nRF52 headers will still compile. */
|
||||
|
||||
/* I2S */
|
||||
/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */
|
||||
#ifndef I2S_ENABLE_ENABLE_DISABLE
|
||||
#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled
|
||||
#endif
|
||||
#ifndef I2S_ENABLE_ENABLE_ENABLE
|
||||
#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_MASTER
|
||||
#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_SLAVE
|
||||
#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_DISABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_ENABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_DISABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_ENABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_DISABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_ENABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_8BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_16BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_24BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_LEFT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_RIGHT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_FORMAT_FORMAT_ALIGNED
|
||||
#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_STEREO
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_LEFT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_RIGHT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right
|
||||
#endif
|
||||
|
||||
/* LPCOMP */
|
||||
/* Corrected typo in RESULT register. */
|
||||
#ifndef LPCOMP_RESULT_RESULT_Bellow
|
||||
#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
|
||||
#endif
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF52_TO_NRF52833_H */
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF52_TO_NRF52840_H
|
||||
#define NRF52_TO_NRF52840_H
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
/* This file is given to prevent your SW from not compiling with the name changes between nRF51 or nRF52832 and nRF52840 devices.
|
||||
* It redefines the old nRF51 or nRF52832 names into the new ones as long as the functionality is still supported. If the
|
||||
* functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros
|
||||
* from the nrf52_namechange.h file. */
|
||||
|
||||
/* Differences between latest nRF52 headers and nRF52840 headers. */
|
||||
|
||||
/* UART */
|
||||
/* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */
|
||||
#ifndef PSELRTS
|
||||
#define PSELRTS PSEL.RTS
|
||||
#endif
|
||||
#ifndef PSELTXD
|
||||
#define PSELTXD PSEL.TXD
|
||||
#endif
|
||||
#ifndef PSELCTS
|
||||
#define PSELCTS PSEL.CTS
|
||||
#endif
|
||||
#ifndef PSELRXD
|
||||
#define PSELRXD PSEL.RXD
|
||||
#endif
|
||||
|
||||
/* TWI */
|
||||
/* The registers PSELSCL, PSELSDA were restructured into a struct. */
|
||||
#ifndef PSELSCL
|
||||
#define PSELSCL PSEL.SCL
|
||||
#endif
|
||||
#ifndef PSELSDA
|
||||
#define PSELSDA PSEL.SDA
|
||||
#endif
|
||||
|
||||
|
||||
/* LPCOMP */
|
||||
/* The hysteresis control enumerated values has changed name for nRF52840 devices. */
|
||||
#ifndef LPCOMP_HYST_HYST_NoHyst
|
||||
#define LPCOMP_HYST_HYST_NoHyst LPCOMP_HYST_HYST_Disabled
|
||||
#endif
|
||||
#ifndef LPCOMP_HYST_HYST_Hyst50mV
|
||||
#define LPCOMP_HYST_HYST_Hyst50mV LPCOMP_HYST_HYST_Enabled
|
||||
#endif
|
||||
|
||||
|
||||
/* From nrf52_name_change.h. Several macros changed in different versions of nRF52 headers. By defining the following, any code written for any version of nRF52 headers will still compile. */
|
||||
|
||||
/* I2S */
|
||||
/* Several enumerations changed case. Adding old macros to keep compilation compatibility. */
|
||||
#ifndef I2S_ENABLE_ENABLE_DISABLE
|
||||
#define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled
|
||||
#endif
|
||||
#ifndef I2S_ENABLE_ENABLE_ENABLE
|
||||
#define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_MASTER
|
||||
#define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MODE_MODE_SLAVE
|
||||
#define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_DISABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_RXEN_RXEN_ENABLE
|
||||
#define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_DISABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_TXEN_TXEN_ENABLE
|
||||
#define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_DISABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_MCKEN_MCKEN_ENABLE
|
||||
#define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_8BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_16BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_SWIDTH_SWIDTH_24BIT
|
||||
#define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_LEFT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_ALIGN_ALIGN_RIGHT
|
||||
#define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_FORMAT_FORMAT_ALIGNED
|
||||
#define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_STEREO
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_LEFT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left
|
||||
#endif
|
||||
#ifndef I2S_CONFIG_CHANNELS_CHANNELS_RIGHT
|
||||
#define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right
|
||||
#endif
|
||||
|
||||
/* LPCOMP */
|
||||
/* Corrected typo in RESULT register. */
|
||||
#ifndef LPCOMP_RESULT_RESULT_Bellow
|
||||
#define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
|
||||
#endif
|
||||
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif /* NRF51_TO_NRF52840_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF5340_PERIPHERALS_H
|
||||
#define _NRF5340_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
/* NVM instruction and data cache */
|
||||
#define CACHE_PRESENT
|
||||
#define CACHE_COUNT 1
|
||||
|
||||
/* Memory Protection Unit */
|
||||
#define MPU_REGION_NUM 8
|
||||
|
||||
/* Regulators Peripheral */
|
||||
#define REGULATORS_PRESENT
|
||||
#define REGULATORS_COUNT 1
|
||||
|
||||
#define REGULATORS_FEATURE_VDDH_PRESENT
|
||||
|
||||
/* USB Regulator Peripheral */
|
||||
#define USBREG_PRESENT
|
||||
#define USBREG_COUNT 1
|
||||
|
||||
/* Volatile Memory Controller Peripheral */
|
||||
#define VMC_PRESENT
|
||||
#define VMC_COUNT 1
|
||||
|
||||
#define VMC_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define VMC_FEATURE_RAM_REGISTERS_COUNT 8
|
||||
|
||||
/* Floating Point Unit */
|
||||
#define FPU_PRESENT
|
||||
#define FPU_COUNT 1
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Inter-Processor Communication */
|
||||
#define IPC_PRESENT
|
||||
#define IPC_COUNT 1
|
||||
|
||||
#define IPC_CH_NUM 16
|
||||
#define IPC_CONF_NUM 16
|
||||
#define IPC_GPMEM_NUM 2
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 2
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
#define P1_PIN_NUM 16
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
#define P1_FEATURE_PINS_PRESENT 0x0000FFFFUL
|
||||
|
||||
/* NFC Tag */
|
||||
#define NFCT_PRESENT
|
||||
#define NFCT_COUNT 1
|
||||
|
||||
#define NFCT_EASYDMA_MAXCNT_SIZE 9
|
||||
|
||||
/* Distributed Peripheral to Peripheral Interconnect */
|
||||
#define DPPI_PRESENT
|
||||
#define DPPI_COUNT 1
|
||||
|
||||
#define DPPI_CH_NUM 32
|
||||
#define DPPI_GROUP_NUM 6
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 6
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
#define EGU1_CH_NUM 16
|
||||
#define EGU2_CH_NUM 16
|
||||
#define EGU3_CH_NUM 16
|
||||
#define EGU4_CH_NUM 16
|
||||
#define EGU5_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 6
|
||||
#define TIMER1_CC_NUM 6
|
||||
#define TIMER2_CC_NUM 6
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 4
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 2
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 5
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
#define SPIM1_MAX_DATARATE 8
|
||||
#define SPIM2_MAX_DATARATE 8
|
||||
#define SPIM3_MAX_DATARATE 8
|
||||
#define SPIM4_MAX_DATARATE 32
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM1_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM2_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM3_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
#define SPIM4_FEATURE_HARDWARE_CSN_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM1_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM2_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM3_FEATURE_DCX_PRESENT 0
|
||||
#define SPIM4_FEATURE_DCX_PRESENT 1
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM1_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM2_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM3_FEATURE_RXDELAY_PRESENT 0
|
||||
#define SPIM4_FEATURE_RXDELAY_PRESENT 1
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM3_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIM4_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 4
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define SPIS3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 4
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIM1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIM2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIM3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 4
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIS1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIS2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define TWIS3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 4
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 16
|
||||
#define UARTE1_EASYDMA_MAXCNT_SIZE 16
|
||||
#define UARTE2_EASYDMA_MAXCNT_SIZE 16
|
||||
#define UARTE3_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Quadrature Decoder */
|
||||
#define QDEC_PRESENT
|
||||
#define QDEC_COUNT 2
|
||||
|
||||
/* Successive Approximation Analog to Digital Converter */
|
||||
#define SAADC_PRESENT
|
||||
#define SAADC_COUNT 1
|
||||
|
||||
#define SAADC_CH_NUM 8
|
||||
#define SAADC_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 2
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Low Power Comparator */
|
||||
#define LPCOMP_PRESENT
|
||||
#define LPCOMP_COUNT 1
|
||||
|
||||
#define LPCOMP_REFSEL_RESOLUTION 16
|
||||
|
||||
#define LPCOMP_FEATURE_HYST_PRESENT
|
||||
|
||||
/* Comparator */
|
||||
#define COMP_PRESENT
|
||||
#define COMP_COUNT 1
|
||||
|
||||
/* Pulse Width Modulator */
|
||||
#define PWM_PRESENT
|
||||
#define PWM_COUNT 4
|
||||
|
||||
#define PWM0_CH_NUM 4
|
||||
#define PWM1_CH_NUM 4
|
||||
#define PWM2_CH_NUM 4
|
||||
#define PWM3_CH_NUM 4
|
||||
|
||||
#define PWM0_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM1_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM2_EASYDMA_MAXCNT_SIZE 15
|
||||
#define PWM3_EASYDMA_MAXCNT_SIZE 15
|
||||
|
||||
/* ARM TrustZone Cryptocell 310 */
|
||||
#define CRYPTOCELL_PRESENT
|
||||
#define CRYPTOCELL_COUNT 1
|
||||
|
||||
/* Quad SPI */
|
||||
#define QSPI_PRESENT
|
||||
#define QSPI_COUNT 1
|
||||
|
||||
#define QSPI_EASYDMA_MAXCNT_SIZE 20
|
||||
|
||||
/* Mutex*/
|
||||
#define MUTEX_PRESENT
|
||||
#define MUTEX_COUNT 1
|
||||
|
||||
/* Key management Unit */
|
||||
#define KMU_PRESENT
|
||||
#define KMU_COUNT 1
|
||||
|
||||
/* Pulse density modulation */
|
||||
#define PDM_PRESENT
|
||||
#define PDM_COUNT 1
|
||||
|
||||
/* Secure Peripheral Unit */
|
||||
#define SPU_PRESENT
|
||||
#define SPU_COUNT 1
|
||||
|
||||
/* Inter-IC Sound Interface */
|
||||
#define I2S_PRESENT
|
||||
#define I2S_COUNT 1
|
||||
|
||||
#define I2S_EASYDMA_MAXCNT_SIZE 14
|
||||
|
||||
/* Universal Serial Bus Device */
|
||||
#define USBD_PRESENT
|
||||
#define USBD_COUNT 1
|
||||
|
||||
#define USBD_EASYDMA_MAXCNT_SIZE 7
|
||||
|
||||
/* Oscillators */
|
||||
#define OSCILLATORS_PRESENT
|
||||
#define OSCILLATORS_COUNT 1
|
||||
|
||||
#endif // _NRF5340_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _NRF5340_NETWORK_PERIPHERALS_H
|
||||
#define _NRF5340_NETWORK_PERIPHERALS_H
|
||||
|
||||
|
||||
/* Clock Peripheral */
|
||||
#define CLOCK_PRESENT
|
||||
#define CLOCK_COUNT 1
|
||||
|
||||
/* Power Peripheral */
|
||||
#define POWER_PRESENT
|
||||
#define POWER_COUNT 1
|
||||
|
||||
/* Non-Volatile Memory Controller */
|
||||
#define NVMC_PRESENT
|
||||
#define NVMC_COUNT 1
|
||||
|
||||
#define NVMC_FEATURE_CACHE_PRESENT
|
||||
|
||||
/* Voltage request peripheral */
|
||||
#define VREQCTRL_PRESENT
|
||||
#define VREQCTRL_COUNT 1
|
||||
|
||||
/* Volatile Memory Controller Peripheral */
|
||||
#define VMC_PRESENT
|
||||
#define VMC_COUNT 1
|
||||
|
||||
#define VMC_FEATURE_RAM_REGISTERS_PRESENT
|
||||
#define VMC_FEATURE_RAM_REGISTERS_COUNT 4
|
||||
|
||||
/* Systick timer */
|
||||
#define SYSTICK_PRESENT
|
||||
#define SYSTICK_COUNT 1
|
||||
|
||||
/* Inter-Processor Communication */
|
||||
#define IPC_PRESENT
|
||||
#define IPC_COUNT 1
|
||||
|
||||
#define IPC_CH_NUM 16
|
||||
#define IPC_CONF_NUM 16
|
||||
#define IPC_GPMEM_NUM 2
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PRESENT
|
||||
#define GPIO_COUNT 2
|
||||
|
||||
#define P0_PIN_NUM 32
|
||||
#define P1_PIN_NUM 16
|
||||
|
||||
#define P0_FEATURE_PINS_PRESENT 0xFFFFFFFFUL
|
||||
#define P1_FEATURE_PINS_PRESENT 0x0000FFFFUL
|
||||
|
||||
|
||||
/* ACL */
|
||||
#define ACL_PRESENT
|
||||
#define ACL_REGIONS_COUNT 8
|
||||
|
||||
/* Radio */
|
||||
#define RADIO_PRESENT
|
||||
#define RADIO_COUNT 1
|
||||
|
||||
#define RADIO_EASYDMA_MAXCNT_SIZE 9
|
||||
#define RADIO_FEATURE_IEEE_802_15_4_PRESENT
|
||||
|
||||
#define RADIO_TXPOWER_TXPOWER_Max RADIO_TXPOWER_TXPOWER_0dBm
|
||||
|
||||
/* Accelerated Address Resolver */
|
||||
#define AAR_PRESENT
|
||||
#define AAR_COUNT 1
|
||||
|
||||
#define AAR_MAX_IRK_NUM 16
|
||||
|
||||
/* AES Electronic CodeBook mode encryption */
|
||||
#define ECB_PRESENT
|
||||
#define ECB_COUNT 1
|
||||
|
||||
/* AES CCM mode encryption */
|
||||
#define CCM_PRESENT
|
||||
#define CCM_COUNT 1
|
||||
|
||||
/* Distributed Peripheral to Peripheral Interconnect */
|
||||
#define DPPI_PRESENT
|
||||
#define DPPI_COUNT 1
|
||||
|
||||
#define DPPI_CH_NUM 16
|
||||
#define DPPI_GROUP_NUM 6
|
||||
|
||||
/* Event Generator Unit */
|
||||
#define EGU_PRESENT
|
||||
#define EGU_COUNT 1
|
||||
|
||||
#define EGU0_CH_NUM 16
|
||||
|
||||
/* Timer/Counter */
|
||||
#define TIMER_PRESENT
|
||||
#define TIMER_COUNT 3
|
||||
|
||||
#define TIMER0_MAX_SIZE 32
|
||||
#define TIMER1_MAX_SIZE 32
|
||||
#define TIMER2_MAX_SIZE 32
|
||||
|
||||
#define TIMER0_CC_NUM 8
|
||||
#define TIMER1_CC_NUM 8
|
||||
#define TIMER2_CC_NUM 8
|
||||
|
||||
/* Real Time Counter */
|
||||
#define RTC_PRESENT
|
||||
#define RTC_COUNT 2
|
||||
|
||||
#define RTC0_CC_NUM 4
|
||||
#define RTC1_CC_NUM 4
|
||||
|
||||
/* RNG */
|
||||
#define RNG_PRESENT
|
||||
#define RNG_COUNT 1
|
||||
|
||||
/* Watchdog Timer */
|
||||
#define WDT_PRESENT
|
||||
#define WDT_COUNT 1
|
||||
|
||||
/* Temperature Sensor */
|
||||
#define TEMP_PRESENT
|
||||
#define TEMP_COUNT 1
|
||||
|
||||
/* Universal Asynchronous Receiver-Transmitter with DMA */
|
||||
#define UARTE_PRESENT
|
||||
#define UARTE_COUNT 1
|
||||
|
||||
#define UARTE0_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Serial Peripheral Interface Master with DMA */
|
||||
#define SPIM_PRESENT
|
||||
#define SPIM_COUNT 1
|
||||
|
||||
#define SPIM0_MAX_DATARATE 8
|
||||
|
||||
#define SPIM0_FEATURE_HARDWARE_CSN_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_DCX_PRESENT 0
|
||||
|
||||
#define SPIM0_FEATURE_RXDELAY_PRESENT 0
|
||||
|
||||
#define SPIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Serial Peripheral Interface Slave with DMA*/
|
||||
#define SPIS_PRESENT
|
||||
#define SPIS_COUNT 1
|
||||
|
||||
#define SPIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Master with DMA */
|
||||
#define TWIM_PRESENT
|
||||
#define TWIM_COUNT 1
|
||||
|
||||
#define TWIM0_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* Two Wire Interface Slave with DMA */
|
||||
#define TWIS_PRESENT
|
||||
#define TWIS_COUNT 1
|
||||
|
||||
#define TWIS0_EASYDMA_MAXCNT_SIZE 16
|
||||
|
||||
/* GPIO Tasks and Events */
|
||||
#define GPIOTE_PRESENT
|
||||
#define GPIOTE_COUNT 1
|
||||
|
||||
#define GPIOTE_CH_NUM 8
|
||||
|
||||
#define GPIOTE_FEATURE_SET_PRESENT
|
||||
#define GPIOTE_FEATURE_CLR_PRESENT
|
||||
|
||||
/* Software Interrupts */
|
||||
#define SWI_PRESENT
|
||||
#define SWI_COUNT 4
|
||||
|
||||
/* Mutex*/
|
||||
#define MUTEX_PRESENT
|
||||
#define MUTEX_COUNT 1
|
||||
|
||||
#endif // _NRF5340_NETWORK_PERIPHERALS_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF_ERRATAS_H
|
||||
#define NRF_ERRATAS_H
|
||||
|
||||
#include "nrf.h"
|
||||
|
||||
/* Check MDK version to make sure we have the required macros */
|
||||
NRF_MDK_VERSION_ASSERT_AT_LEAST(8,34,0);
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
#include "nrf51_erratas.h"
|
||||
#include "nrf52_erratas.h"
|
||||
#include "nrf53_erratas.h"
|
||||
#ifndef ARDUINO
|
||||
#include "nrf91_erratas.h"
|
||||
#endif
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif // NRF_ERRATAS_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NRF_PERIPHERALS_H__
|
||||
#define NRF_PERIPHERALS_H__
|
||||
|
||||
/*lint ++flb "Enter library region */
|
||||
|
||||
#if defined(NRF51)
|
||||
#include "nrf51_peripherals.h"
|
||||
|
||||
#elif defined (NRF52805_XXAA)
|
||||
#include "nrf52805_peripherals.h"
|
||||
#elif defined(NRF52810_XXAA)
|
||||
#include "nrf52810_peripherals.h"
|
||||
#elif defined(NRF52811_XXAA)
|
||||
#include "nrf52811_peripherals.h"
|
||||
#elif defined(NRF52820_XXAA)
|
||||
#include "nrf52820_peripherals.h"
|
||||
#elif defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
|
||||
#include "nrf52832_peripherals.h"
|
||||
#elif defined (NRF52833_XXAA)
|
||||
#include "nrf52833_peripherals.h"
|
||||
#elif defined(NRF52840_XXAA)
|
||||
#include "nrf52840_peripherals.h"
|
||||
|
||||
#elif defined (NRF5340_XXAA_APPLICATION)
|
||||
#include "nrf5340_application_peripherals.h"
|
||||
#elif defined (NRF5340_XXAA_NETWORK)
|
||||
#include "nrf5340_network_peripherals.h"
|
||||
|
||||
#elif defined(NRF9160_XXAA)
|
||||
#include "nrf9160_peripherals.h"
|
||||
|
||||
#else
|
||||
#error "Device must be defined. See nrf.h."
|
||||
#endif
|
||||
|
||||
/*lint --flb "Leave library region" */
|
||||
|
||||
#endif // NRF_PERIPHERALS_H__
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NRF_DELAY_H
|
||||
#define _NRF_DELAY_H
|
||||
|
||||
#include "nrf.h"
|
||||
|
||||
/**
|
||||
* @brief Function for delaying execution for number of microseconds.
|
||||
*
|
||||
* @note NRF52 has instruction cache and because of that delay is not precise.
|
||||
*
|
||||
* @param number_of_ms
|
||||
*/
|
||||
/*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */
|
||||
#if defined ( __CC_ARM )
|
||||
|
||||
static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
|
||||
{
|
||||
loop
|
||||
SUBS R0, R0, #1
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
#if defined(NRF52_SERIES)
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
#endif
|
||||
BNE loop
|
||||
BX LR
|
||||
}
|
||||
|
||||
#elif defined ( __ICCARM__ )
|
||||
|
||||
static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
|
||||
{
|
||||
__ASM (
|
||||
"loop:\n\t"
|
||||
" SUBS R0, R0, #1\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
#if defined(NRF52_SERIES)
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
" NOP\n\t"
|
||||
#endif
|
||||
" BNE.n loop\n\t");
|
||||
}
|
||||
|
||||
#elif defined ( _WIN32 ) || defined ( __unix ) || defined( __APPLE__ )
|
||||
|
||||
__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us);
|
||||
|
||||
#ifndef CUSTOM_NRF_DELAY_US
|
||||
__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us)
|
||||
{}
|
||||
#endif
|
||||
|
||||
#elif defined ( __GNUC__ )
|
||||
|
||||
static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline));
|
||||
static __INLINE void nrf_delay_us(uint32_t volatile number_of_us)
|
||||
{
|
||||
register uint32_t delay __ASM ("r0") = number_of_us;
|
||||
__ASM volatile (
|
||||
#ifdef NRF51
|
||||
".syntax unified\n"
|
||||
#endif
|
||||
"1:\n"
|
||||
" SUBS %0, %0, #1\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
#if defined(NRF52_SERIES)
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
#endif
|
||||
" BNE 1b\n"
|
||||
#ifdef NRF51
|
||||
".syntax divided\n"
|
||||
#endif
|
||||
: "+r" (delay));
|
||||
}
|
||||
#endif
|
||||
|
||||
void nrf_delay_ms(uint32_t volatile number_of_ms);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,455 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_COMMON BLE SoftDevice Common
|
||||
@{
|
||||
@defgroup ble_api Events, type definitions and API calls
|
||||
@{
|
||||
|
||||
@brief Module independent events, type definitions and API calls for the BLE SoftDevice.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef BLE_H__
|
||||
#define BLE_H__
|
||||
|
||||
#include "ble_ranges.h"
|
||||
#include "ble_types.h"
|
||||
#include "ble_gap.h"
|
||||
#include "ble_l2cap.h"
|
||||
#include "ble_gatt.h"
|
||||
#include "ble_gattc.h"
|
||||
#include "ble_gatts.h"
|
||||
|
||||
/** @addtogroup BLE_COMMON_ENUMERATIONS Enumerations
|
||||
* @{ */
|
||||
|
||||
/**
|
||||
* @brief Common API SVC numbers.
|
||||
*/
|
||||
enum BLE_COMMON_SVCS
|
||||
{
|
||||
SD_BLE_ENABLE = BLE_SVC_BASE, /**< Enable and initialize the BLE stack */
|
||||
SD_BLE_EVT_GET, /**< Get an event from the pending events queue. */
|
||||
SD_BLE_TX_BUFFER_COUNT_GET, /**< Get the total number of available application transmission buffers from the BLE stack. */
|
||||
SD_BLE_UUID_VS_ADD, /**< Add a Vendor Specific UUID. */
|
||||
SD_BLE_UUID_DECODE, /**< Decode UUID bytes. */
|
||||
SD_BLE_UUID_ENCODE, /**< Encode UUID bytes. */
|
||||
SD_BLE_VERSION_GET, /**< Get the local version information (company id, Link Layer Version, Link Layer Subversion). */
|
||||
SD_BLE_USER_MEM_REPLY, /**< User Memory Reply. */
|
||||
SD_BLE_OPT_SET, /**< Set a BLE option. */
|
||||
SD_BLE_OPT_GET, /**< Get a BLE option. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief BLE Module Independent Event IDs.
|
||||
*/
|
||||
enum BLE_COMMON_EVTS
|
||||
{
|
||||
BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. @ref ble_evt_tx_complete_t */
|
||||
BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. @ref ble_evt_user_mem_request_t */
|
||||
BLE_EVT_USER_MEM_RELEASE /**< User Memory release. @ref ble_evt_user_mem_release_t */
|
||||
};
|
||||
|
||||
/**@brief Common Option IDs.
|
||||
* IDs that uniquely identify a common option.
|
||||
*/
|
||||
enum BLE_COMMON_OPTS
|
||||
{
|
||||
BLE_COMMON_OPT_RADIO_CPU_MUTEX = BLE_OPT_BASE /**< Radio CPU mutex option. @ref ble_common_opt_radio_cpu_mutex_t */
|
||||
};
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_COMMON_DEFINES Defines
|
||||
* @{ */
|
||||
|
||||
/** @brief Required pointer alignment for BLE Events.
|
||||
*/
|
||||
#define BLE_EVTS_PTR_ALIGNMENT 4
|
||||
|
||||
/** @defgroup BLE_USER_MEM_TYPES User Memory Types
|
||||
* @{ */
|
||||
#define BLE_USER_MEM_TYPE_INVALID 0x00 /**< Invalid User Memory Types. */
|
||||
#define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01 /**< User Memory for GATTS queued writes. */
|
||||
/** @} */
|
||||
|
||||
/** @brief Maximum number of Vendor Specific UUIDs.
|
||||
*/
|
||||
#define BLE_UUID_VS_MAX_COUNT 10
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_COMMON_STRUCTURES Structures
|
||||
* @{ */
|
||||
|
||||
/**@brief User Memory Block. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *p_mem; /**< Pointer to the start of the user memory block. */
|
||||
uint16_t len; /**< Length in bytes of the user memory block. */
|
||||
} ble_user_mem_block_t;
|
||||
|
||||
/**
|
||||
* @brief Event structure for @ref BLE_EVT_TX_COMPLETE.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t count; /**< Number of packets transmitted. */
|
||||
} ble_evt_tx_complete_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_EVT_USER_MEM_REQUEST. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
|
||||
} ble_evt_user_mem_request_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_EVT_USER_MEM_RELEASE. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
|
||||
ble_user_mem_block_t mem_block; /**< User memory block */
|
||||
} ble_evt_user_mem_release_t;
|
||||
|
||||
|
||||
/**@brief Event structure for events not associated with a specific function module. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t conn_handle; /**< Connection Handle on which this event occurred. */
|
||||
union
|
||||
{
|
||||
ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */
|
||||
ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */
|
||||
ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */
|
||||
} params;
|
||||
} ble_common_evt_t;
|
||||
|
||||
/**@brief BLE Event header. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t evt_id; /**< Value from a BLE_<module>_EVT series. */
|
||||
uint16_t evt_len; /**< Length in octets excluding this header. */
|
||||
} ble_evt_hdr_t;
|
||||
|
||||
/**@brief Common BLE Event type, wrapping the module specific event reports. */
|
||||
typedef struct
|
||||
{
|
||||
ble_evt_hdr_t header; /**< Event header. */
|
||||
union
|
||||
{
|
||||
ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */
|
||||
ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */
|
||||
ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */
|
||||
ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */
|
||||
ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */
|
||||
} evt;
|
||||
} ble_evt_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Version Information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t version_number; /**< Link Layer Version number for BT 4.1 spec is 7 (https://www.bluetooth.org/en-us/specification/assigned-numbers/link-layer). */
|
||||
uint16_t company_id; /**< Company ID, Nordic Semiconductor's company ID is 89 (0x0059) (https://www.bluetooth.org/apps/content/Default.aspx?doc_id=49708). */
|
||||
uint16_t subversion_number; /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */
|
||||
} ble_version_t;
|
||||
|
||||
/**@brief Mutual exclusion of radio activity and CPU execution.
|
||||
*
|
||||
* This option configures the application's access to the CPU when the radio is active. The
|
||||
* application can configure itself to be blocked from using the CPU while the radio is
|
||||
* active. By default, the application will be able to share CPU time with the SoftDevice
|
||||
* during radio activity. This parameter structure is used together with @ref sd_ble_opt_set
|
||||
* to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option.
|
||||
*
|
||||
* @note Note that the application should use this option to configure the SoftDevice to block the
|
||||
* CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on
|
||||
* hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may
|
||||
* exceed real time requirements".
|
||||
*
|
||||
* @note Note that when acting as a scanner, the mutex is only enabled for radio TX activity.
|
||||
*
|
||||
* @note @ref sd_ble_opt_get is not supported for this option.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t enable : 1; /**< Enable mutual exclusion of radio activity and the CPU execution. */
|
||||
} ble_common_opt_radio_cpu_mutex_t;
|
||||
|
||||
/**@brief Option structure for common options. */
|
||||
typedef union
|
||||
{
|
||||
ble_common_opt_radio_cpu_mutex_t radio_cpu_mutex; /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */
|
||||
} ble_common_opt_t;
|
||||
|
||||
/**@brief Common BLE Option type, wrapping the module specific options. */
|
||||
typedef union
|
||||
{
|
||||
ble_common_opt_t common_opt; /**< Common option, opt_id in BLE_COMMON_OPT_* series. */
|
||||
ble_gap_opt_t gap_opt; /**< GAP option, opt_id in BLE_GAP_OPT_* series. */
|
||||
} ble_opt_t;
|
||||
|
||||
/**
|
||||
* @brief BLE GATTS init options
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */
|
||||
} ble_enable_params_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_COMMON_FUNCTIONS Functions
|
||||
* @{ */
|
||||
|
||||
/**@brief Enable the BLE stack
|
||||
*
|
||||
* @param[in] p_ble_enable_params Pointer to ble_enable_params_t
|
||||
*
|
||||
* @details This call initializes the BLE stack, no other BLE related function can be called before this one.
|
||||
*
|
||||
* @return @ref NRF_SUCCESS BLE the BLE stack has been initialized successfully
|
||||
* @retval @ref NRF_ERROR_INVALID_STATE the BLE stack had already been initialized and cannot be reinitialized.
|
||||
* @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied.
|
||||
* @return @ref NRF_ERROR_INVALID_LENGTH The specified Attribute Table size is either too small or not a multiple of 4.
|
||||
* The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN.
|
||||
* @return @ref NRF_ERROR_NO_MEM The Attribute Table size is too large. Decrease size in @ref ble_gatts_enable_params_t.
|
||||
*/
|
||||
SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params));
|
||||
|
||||
/**@brief Get an event from the pending events queue.
|
||||
*
|
||||
* @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. This buffer <b>must be 4-byte aligned in memory</b>.
|
||||
* @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length.
|
||||
*
|
||||
* @details This call allows the application to pull a BLE event from the BLE stack. The application is signalled that an event is
|
||||
* available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt.
|
||||
* The application is free to choose whether to call this function from thread mode (main context) or directly from the Interrupt Service Routine
|
||||
* that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher priority than the application, this function should be called
|
||||
* in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack.
|
||||
* Failure to do so could potentially leave events in the internal queue without the application being aware of this fact.
|
||||
* Sizing the p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to be copied into
|
||||
* application memory. If the buffer provided is not large enough to fit the entire contents of the event, @ref NRF_ERROR_DATA_SIZE will be returned
|
||||
* and the application can then call again with a larger buffer size.
|
||||
* Please note that because of the variable length nature of some events, sizeof(ble_evt_t) will not always be large enough to fit certain events,
|
||||
* and so it is the application's responsibility to provide an amount of memory large enough so that the relevant event is copied in full.
|
||||
* The application may "peek" the event length by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return.
|
||||
*
|
||||
* @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Event pulled and stored into the supplied buffer.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND No events ready to be pulled.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer.
|
||||
*/
|
||||
SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len));
|
||||
|
||||
|
||||
/**@brief Get the total number of available application transmission buffers per link in the BLE stack.
|
||||
*
|
||||
* @details This call allows the application to obtain the total number of
|
||||
* transmission buffers available per link for application data. Please note that
|
||||
* this does not give the number of free buffers, but rather the total amount of them.
|
||||
* The application has two options to handle its own application transmission buffers:
|
||||
* - Use a simple arithmetic calculation: at boot time the application should use this function
|
||||
* to find out the total amount of buffers available to it and store it in a variable.
|
||||
* Every time a packet that consumes an application buffer is sent using any of the
|
||||
* exposed functions in this BLE API, the application should decrement that variable.
|
||||
* Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event is received by the application
|
||||
* it should retrieve the count field in such event and add that number to the same
|
||||
* variable storing the number of available packets.
|
||||
* This mechanism allows the application to be aware at any time of the number of
|
||||
* application packets available in the BLE stack's internal buffers, and therefore
|
||||
* it can know with certainty whether it is possible to send more data or it has to
|
||||
* wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds.
|
||||
* - Choose to simply not keep track of available buffers at all, and instead handle the
|
||||
* @ref BLE_ERROR_NO_TX_BUFFERS error by queueing the packet to be transmitted and
|
||||
* try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives.
|
||||
*
|
||||
* The API functions that <b>may</b> consume an application buffer depending on
|
||||
* the parameters supplied to them can be found below:
|
||||
*
|
||||
* - @ref sd_ble_gattc_write (write without response only)
|
||||
* - @ref sd_ble_gatts_hvx (notifications only)
|
||||
* - @ref sd_ble_l2cap_tx (all packets)
|
||||
*
|
||||
* @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon
|
||||
* successful return.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
*/
|
||||
SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(uint8_t *p_count));
|
||||
|
||||
|
||||
/**@brief Add a Vendor Specific UUID.
|
||||
*
|
||||
* @details This call enables the application to add a vendor specific UUID to the BLE stack's table,
|
||||
* for later use all other modules and APIs. This then allows the application to use the shorter,
|
||||
* 24-bit @ref ble_uuid_t format when dealing with both 16-bit and 128-bit UUIDs without having to
|
||||
* check for lengths and having split code paths. The way that this is accomplished is by extending the
|
||||
* grouping mechanism that the Bluetooth SIG standard base UUID uses for all other 128-bit UUIDs. The
|
||||
* type field in the @ref ble_uuid_t structure is an index (relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN)
|
||||
* to the table populated by multiple calls to this function, and the uuid field in the same structure
|
||||
* contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to the
|
||||
* application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536,
|
||||
* although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array.
|
||||
*
|
||||
* @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by
|
||||
* the 16-bit uuid field in @ref ble_uuid_t.
|
||||
*
|
||||
*
|
||||
* @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding
|
||||
* bytes 12 and 13.
|
||||
* @param[out] p_uuid_type Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully added the Vendor Specific UUID.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid.
|
||||
* @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table.
|
||||
*/
|
||||
SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type));
|
||||
|
||||
|
||||
/** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure.
|
||||
*
|
||||
* @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared
|
||||
* to the corresponding ones in each entry of the table of vendor specific UUIDs populated with @ref sd_ble_uuid_vs_add
|
||||
* to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index
|
||||
* relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type.
|
||||
*
|
||||
* @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE.
|
||||
*
|
||||
* @param[in] uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes).
|
||||
* @param[in] p_uuid_le Pointer pointing to little endian raw UUID bytes.
|
||||
* @param[out] p_uuid Pointer to a @ref ble_uuid_t structure to be filled in.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_LENGTH Invalid UUID length.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs.
|
||||
*/
|
||||
SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid));
|
||||
|
||||
|
||||
/** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit).
|
||||
*
|
||||
* @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validity and size of p_uuid is computed.
|
||||
*
|
||||
* @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes.
|
||||
* @param[out] p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes).
|
||||
* @param[out] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully encoded into the buffer.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid UUID type.
|
||||
*/
|
||||
SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le));
|
||||
|
||||
|
||||
/**@brief Get Version Information.
|
||||
*
|
||||
* @details This call allows the application to get the BLE stack version information.
|
||||
*
|
||||
* @param[out] p_version Pointer to a ble_version_t structure to be filled in.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Version information stored successfully.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY The BLE stack is busy (typically doing a locally-initiated disconnection procedure).
|
||||
*/
|
||||
SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t *p_version));
|
||||
|
||||
|
||||
/**@brief Provide a user memory block.
|
||||
*
|
||||
* @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle.
|
||||
* @param[in,out] p_block Pointer to a user memory block structure.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued a response to the peer.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection state or no execute write request pending.
|
||||
* @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time.
|
||||
*/
|
||||
SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block));
|
||||
|
||||
/**@brief Set a BLE option.
|
||||
*
|
||||
* @details This call allows the application to set the value of an option.
|
||||
*
|
||||
* @param[in] opt_id Option ID.
|
||||
* @param[in] p_opt Pointer to a ble_opt_t structure containing the option value.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Option set successfully.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time.
|
||||
* @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed.
|
||||
*/
|
||||
SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
|
||||
|
||||
|
||||
/**@brief Get a BLE option.
|
||||
*
|
||||
* @details This call allows the application to retrieve the value of an option.
|
||||
*
|
||||
* @param[in] opt_id Option ID.
|
||||
* @param[out] p_opt Pointer to a ble_opt_t structure to be filled in.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Option retrieved successfully.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Unable to retrieve the parameter at this time.
|
||||
* @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed.
|
||||
* @retval ::NRF_ERROR_NOT_SUPPORTED This option is not supported.
|
||||
*
|
||||
*/
|
||||
SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt));
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* BLE_H__ */
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_COMMON
|
||||
@{
|
||||
@addtogroup nrf_error
|
||||
@{
|
||||
@ingroup BLE_COMMON
|
||||
@}
|
||||
|
||||
@defgroup ble_err General error codes
|
||||
@{
|
||||
|
||||
@brief General error code definitions for the BLE API.
|
||||
|
||||
@ingroup BLE_COMMON
|
||||
*/
|
||||
#ifndef NRF_BLE_ERR_H__
|
||||
#define NRF_BLE_ERR_H__
|
||||
|
||||
#include "nrf_error.h"
|
||||
|
||||
/* @defgroup BLE_ERRORS Error Codes
|
||||
* @{ */
|
||||
#define BLE_ERROR_NOT_ENABLED (NRF_ERROR_STK_BASE_NUM+0x001) /**< @ref sd_ble_enable has not been called. */
|
||||
#define BLE_ERROR_INVALID_CONN_HANDLE (NRF_ERROR_STK_BASE_NUM+0x002) /**< Invalid connection handle. */
|
||||
#define BLE_ERROR_INVALID_ATTR_HANDLE (NRF_ERROR_STK_BASE_NUM+0x003) /**< Invalid attribute handle. */
|
||||
#define BLE_ERROR_NO_TX_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Buffer capacity exceeded. */
|
||||
#define BLE_ERROR_INVALID_ROLE (NRF_ERROR_STK_BASE_NUM+0x005) /**< Invalid role. */
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @defgroup BLE_ERROR_SUBRANGES Module specific error code subranges
|
||||
* @brief Assignment of subranges for module specific error codes.
|
||||
* @note For specific error codes, see ble_<module>.h or ble_error_<module>.h.
|
||||
* @{ */
|
||||
#define NRF_L2CAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x100) /**< L2CAP specific errors. */
|
||||
#define NRF_GAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x200) /**< GAP specific errors. */
|
||||
#define NRF_GATTC_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x300) /**< GATT client specific errors. */
|
||||
#define NRF_GATTS_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x400) /**< GATT server specific errors. */
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_GATT Generic Attribute Profile (GATT) Common
|
||||
@{
|
||||
@brief Common definitions and prototypes for the GATT interfaces.
|
||||
*/
|
||||
|
||||
#ifndef BLE_GATT_H__
|
||||
#define BLE_GATT_H__
|
||||
|
||||
#include "ble_types.h"
|
||||
#include "ble_ranges.h"
|
||||
|
||||
|
||||
/** @addtogroup BLE_GATT_DEFINES Defines
|
||||
* @{ */
|
||||
|
||||
/** @brief Default MTU size. */
|
||||
#define GATT_MTU_SIZE_DEFAULT 23
|
||||
|
||||
/** @brief Only the default MTU size of 23 is currently supported. */
|
||||
#define GATT_RX_MTU 23
|
||||
|
||||
|
||||
/**@brief Invalid Attribute Handle. */
|
||||
#define BLE_GATT_HANDLE_INVALID 0x0000
|
||||
|
||||
/** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources
|
||||
* @{ */
|
||||
#define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATT_WRITE_OPS GATT Write operations
|
||||
* @{ */
|
||||
#define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */
|
||||
#define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */
|
||||
#define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */
|
||||
#define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */
|
||||
#define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */
|
||||
#define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags
|
||||
* @{ */
|
||||
#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00
|
||||
#define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations
|
||||
* @{ */
|
||||
#define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */
|
||||
#define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */
|
||||
#define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes
|
||||
* @{ */
|
||||
#define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */
|
||||
#define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */
|
||||
#define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */
|
||||
#define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */
|
||||
#define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */
|
||||
#define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */
|
||||
#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */
|
||||
#define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */
|
||||
#define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */
|
||||
#define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */
|
||||
#define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */
|
||||
#define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */
|
||||
#define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */
|
||||
#define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */
|
||||
#define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */
|
||||
#define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */
|
||||
#define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats
|
||||
* @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
|
||||
* @{ */
|
||||
#define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */
|
||||
#define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */
|
||||
#define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */
|
||||
#define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */
|
||||
#define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */
|
||||
#define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */
|
||||
#define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */
|
||||
#define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */
|
||||
#define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */
|
||||
#define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */
|
||||
#define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces
|
||||
* @{
|
||||
*/
|
||||
#define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 /**< Bluetooth SIG defined Namespace. */
|
||||
#define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 /**< Namespace Description Unknown. */
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATT_STRUCTURES Structures
|
||||
* @{ */
|
||||
|
||||
/**@brief GATT Characteristic Properties. */
|
||||
typedef struct
|
||||
{
|
||||
/* Standard properties */
|
||||
uint8_t broadcast :1; /**< Broadcasting of the value permitted. */
|
||||
uint8_t read :1; /**< Reading the value permitted. */
|
||||
uint8_t write_wo_resp :1; /**< Writing the value with Write Command permitted. */
|
||||
uint8_t write :1; /**< Writing the value with Write Request permitted. */
|
||||
uint8_t notify :1; /**< Notications of the value permitted. */
|
||||
uint8_t indicate :1; /**< Indications of the value permitted. */
|
||||
uint8_t auth_signed_wr :1; /**< Writing the value with Signed Write Command permitted. */
|
||||
} ble_gatt_char_props_t;
|
||||
|
||||
/**@brief GATT Characteristic Extended Properties. */
|
||||
typedef struct
|
||||
{
|
||||
/* Extended properties */
|
||||
uint8_t reliable_wr :1; /**< Writing the value with Queued Write operations permitted. */
|
||||
uint8_t wr_aux :1; /**< Writing the Characteristic User Description descriptor permitted. */
|
||||
} ble_gatt_char_ext_props_t;
|
||||
|
||||
#endif // BLE_GATT_H__
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,441 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client
|
||||
@{
|
||||
@brief Definitions and prototypes for the GATT Client interface.
|
||||
*/
|
||||
|
||||
#ifndef BLE_GATTC_H__
|
||||
#define BLE_GATTC_H__
|
||||
|
||||
#include "ble_gatt.h"
|
||||
#include "ble_types.h"
|
||||
#include "ble_ranges.h"
|
||||
#include "nrf_svc.h"
|
||||
|
||||
/** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations
|
||||
* @{ */
|
||||
|
||||
/**@brief GATTC API SVC numbers. */
|
||||
enum BLE_GATTC_SVCS
|
||||
{
|
||||
SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */
|
||||
SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */
|
||||
SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */
|
||||
SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */
|
||||
SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */
|
||||
SD_BLE_GATTC_READ, /**< Generic read. */
|
||||
SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */
|
||||
SD_BLE_GATTC_WRITE, /**< Generic write. */
|
||||
SD_BLE_GATTC_HV_CONFIRM /**< Handle Value Confirmation. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief GATT Client Event IDs.
|
||||
*/
|
||||
enum BLE_GATTC_EVTS
|
||||
{
|
||||
BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. @ref ble_gattc_evt_prim_srvc_disc_rsp_t */
|
||||
BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. @ref ble_gattc_evt_rel_disc_rsp_t */
|
||||
BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. @ref ble_gattc_evt_char_disc_rsp_t */
|
||||
BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. @ref ble_gattc_evt_desc_disc_rsp_t */
|
||||
BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t */
|
||||
BLE_GATTC_EVT_READ_RSP, /**< Read Response event. @ref ble_gattc_evt_read_rsp_t */
|
||||
BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. @ref ble_gattc_evt_char_vals_read_rsp_t */
|
||||
BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. @ref ble_gattc_evt_write_rsp_t */
|
||||
BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. @ref ble_gattc_evt_hvx_t */
|
||||
BLE_GATTC_EVT_TIMEOUT /**< Timeout event. @ref ble_gattc_evt_timeout_t */
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTC_DEFINES Defines
|
||||
* @{ */
|
||||
|
||||
/** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC
|
||||
* @{ */
|
||||
#define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */
|
||||
/** @} */
|
||||
|
||||
/**@brief Last Attribute Handle. */
|
||||
#define BLE_GATTC_HANDLE_END 0xFFFF
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTC_STRUCTURES Structures
|
||||
* @{ */
|
||||
|
||||
/**@brief Operation Handle Range. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t start_handle; /**< Start Handle. */
|
||||
uint16_t end_handle; /**< End Handle. */
|
||||
} ble_gattc_handle_range_t;
|
||||
|
||||
|
||||
/**@brief GATT service. */
|
||||
typedef struct
|
||||
{
|
||||
ble_uuid_t uuid; /**< Service UUID. */
|
||||
ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */
|
||||
} ble_gattc_service_t;
|
||||
|
||||
|
||||
/**@brief GATT include. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Include Handle. */
|
||||
ble_gattc_service_t included_srvc; /**< Handle of the included service. */
|
||||
} ble_gattc_include_t;
|
||||
|
||||
|
||||
/**@brief GATT characteristic. */
|
||||
typedef struct
|
||||
{
|
||||
ble_uuid_t uuid; /**< Characteristic UUID. */
|
||||
ble_gatt_char_props_t char_props; /**< Characteristic Properties. */
|
||||
uint8_t char_ext_props : 1; /**< Extended properties present. */
|
||||
uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */
|
||||
uint16_t handle_value; /**< Handle of the Characteristic Value. */
|
||||
} ble_gattc_char_t;
|
||||
|
||||
|
||||
/**@brief GATT descriptor. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Descriptor Handle. */
|
||||
ble_uuid_t uuid; /**< Descriptor UUID. */
|
||||
} ble_gattc_desc_t;
|
||||
|
||||
|
||||
/**@brief Write Parameters. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */
|
||||
uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */
|
||||
uint16_t handle; /**< Handle to the attribute to be written. */
|
||||
uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */
|
||||
uint16_t len; /**< Length of data in bytes. */
|
||||
uint8_t *p_value; /**< Pointer to the value data. */
|
||||
} ble_gattc_write_params_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count; /**< Service count. */
|
||||
ble_gattc_service_t services[1]; /**< Service data, variable length. */
|
||||
} ble_gattc_evt_prim_srvc_disc_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count; /**< Include count. */
|
||||
ble_gattc_include_t includes[1]; /**< Include data, variable length. */
|
||||
} ble_gattc_evt_rel_disc_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count; /**< Characteristic count. */
|
||||
ble_gattc_char_t chars[1]; /**< Characteristic data, variable length. */
|
||||
} ble_gattc_evt_char_disc_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count; /**< Descriptor count. */
|
||||
ble_gattc_desc_t descs[1]; /**< Descriptor data, variable length. */
|
||||
} ble_gattc_evt_desc_disc_rsp_t;
|
||||
|
||||
/**@brief GATT read by UUID handle value pair. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t).
|
||||
Please note that this pointer is absolute to the memory provided by the user when retrieving the event,
|
||||
so it will effectively point to a location inside the handle_value array. */
|
||||
} ble_gattc_handle_value_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count; /**< Handle-Value Pair Count. */
|
||||
uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */
|
||||
ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list, variable length. */
|
||||
} ble_gattc_evt_char_val_by_uuid_read_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
uint16_t offset; /**< Offset of the attribute data. */
|
||||
uint16_t len; /**< Attribute data length. */
|
||||
uint8_t data[1]; /**< Attribute data, variable length. */
|
||||
} ble_gattc_evt_read_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t len; /**< Concatenated Attribute values length. */
|
||||
uint8_t values[1]; /**< Attribute values, variable length. */
|
||||
} ble_gattc_evt_char_vals_read_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */
|
||||
uint16_t offset; /**< Data offset. */
|
||||
uint16_t len; /**< Data length. */
|
||||
uint8_t data[1]; /**< Data, variable length. */
|
||||
} ble_gattc_evt_write_rsp_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Handle to which the HVx operation applies. */
|
||||
uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */
|
||||
uint16_t len; /**< Attribute data length. */
|
||||
uint8_t data[1]; /**< Attribute data, variable length. */
|
||||
} ble_gattc_evt_hvx_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */
|
||||
} ble_gattc_evt_timeout_t;
|
||||
|
||||
/**@brief GATTC event structure. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t conn_handle; /**< Connection Handle on which event occured. */
|
||||
uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
|
||||
uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */
|
||||
union
|
||||
{
|
||||
ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */
|
||||
ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */
|
||||
ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */
|
||||
ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */
|
||||
ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */
|
||||
ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */
|
||||
ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */
|
||||
ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */
|
||||
ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */
|
||||
ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */
|
||||
} params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */
|
||||
} ble_gattc_evt_t;
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTC_FUNCTIONS Functions
|
||||
* @{ */
|
||||
|
||||
/**@brief Initiate or continue a GATT Primary Service Discovery procedure.
|
||||
*
|
||||
* @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle.
|
||||
* If the last service has not been reached, this function must be called again with an updated start handle value to continue the search.
|
||||
*
|
||||
* @note If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with
|
||||
* type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] start_handle Handle to start searching from.
|
||||
* @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid));
|
||||
|
||||
|
||||
/**@brief Initiate or continue a GATT Relationship Discovery procedure.
|
||||
*
|
||||
* @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached,
|
||||
* this must be called again with an updated handle range to continue the search.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range));
|
||||
|
||||
|
||||
/**@brief Initiate or continue a GATT Characteristic Discovery procedure.
|
||||
*
|
||||
* @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached,
|
||||
* this must be called again with an updated handle range to continue the discovery.
|
||||
*
|
||||
* @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with
|
||||
* type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range));
|
||||
|
||||
|
||||
/**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure.
|
||||
*
|
||||
* @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached,
|
||||
* this must be called again with an updated handle range to continue the discovery.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range));
|
||||
|
||||
|
||||
/**@brief Initiate or continue a GATT Read using Characteristic UUID procedure.
|
||||
*
|
||||
* @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached,
|
||||
* this must be called again with an updated handle range to continue the discovery.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_uuid Pointer to a Characteristic value UUID to read.
|
||||
* @param[in] p_handle_range A pointer to the range of handles to perform this procedure on.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range));
|
||||
|
||||
|
||||
/**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure.
|
||||
*
|
||||
* @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor
|
||||
* to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the
|
||||
* complete value.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] handle The handle of the attribute to be read.
|
||||
* @param[in] offset Offset into the attribute value to be read.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset));
|
||||
|
||||
|
||||
/**@brief Initiate a GATT Read Multiple Characteristic Values procedure.
|
||||
*
|
||||
* @details This function initiates a GATT Read Multiple Characteristic Values procedure.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read.
|
||||
* @param[in] handle_count The number of handles in p_handles.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Client procedure already in progress.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count));
|
||||
|
||||
|
||||
/**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.
|
||||
*
|
||||
* @details This function can perform all write procedures described in GATT.
|
||||
*
|
||||
* @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore
|
||||
* generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the
|
||||
* standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response
|
||||
* has been received from the peer. Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] p_write_params A pointer to a write parameters structure.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully started the Write procedure.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Procedure already in progress.
|
||||
* @retval ::BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params));
|
||||
|
||||
|
||||
/**@brief Send a Handle Value Confirmation to the GATT Server.
|
||||
*
|
||||
* @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
|
||||
* @param[in] handle The handle of the attribute in the indication.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed.
|
||||
* @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle));
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* BLE_GATTC_H__ */
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,639 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_GATTS Generic Attribute Profile (GATT) Server
|
||||
@{
|
||||
@brief Definitions and prototypes for the GATTS interface.
|
||||
*/
|
||||
|
||||
#ifndef BLE_GATTS_H__
|
||||
#define BLE_GATTS_H__
|
||||
|
||||
#include "ble_types.h"
|
||||
#include "ble_ranges.h"
|
||||
#include "ble_l2cap.h"
|
||||
#include "ble_gap.h"
|
||||
#include "ble_gatt.h"
|
||||
#include "nrf_svc.h"
|
||||
|
||||
/** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations
|
||||
* @{ */
|
||||
|
||||
/**
|
||||
* @brief GATTS API SVC numbers.
|
||||
*/
|
||||
enum BLE_GATTS_SVCS
|
||||
{
|
||||
SD_BLE_GATTS_SERVICE_ADD = BLE_GATTS_SVC_BASE, /**< Add a service. */
|
||||
SD_BLE_GATTS_INCLUDE_ADD, /**< Add an included service. */
|
||||
SD_BLE_GATTS_CHARACTERISTIC_ADD, /**< Add a characteristic. */
|
||||
SD_BLE_GATTS_DESCRIPTOR_ADD, /**< Add a generic attribute. */
|
||||
SD_BLE_GATTS_VALUE_SET, /**< Set an attribute value. */
|
||||
SD_BLE_GATTS_VALUE_GET, /**< Get an attribute value. */
|
||||
SD_BLE_GATTS_HVX, /**< Handle Value Notification or Indication. */
|
||||
SD_BLE_GATTS_SERVICE_CHANGED, /**< Perform a Service Changed Indication to one or more peers. */
|
||||
SD_BLE_GATTS_RW_AUTHORIZE_REPLY, /**< Reply to an authorization request for a read or write operation on one or more attributes. */
|
||||
SD_BLE_GATTS_SYS_ATTR_SET, /**< Set the persistent system attributes for a connection. */
|
||||
SD_BLE_GATTS_SYS_ATTR_GET, /**< Retrieve the persistent system attributes. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief GATT Server Event IDs.
|
||||
*/
|
||||
enum BLE_GATTS_EVTS
|
||||
{
|
||||
BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. @ref ble_gatts_evt_write_t */
|
||||
BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request.@ref ble_gatts_evt_rw_authorize_request_t */
|
||||
BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending, awaiting a sd_ble_gatts_sys_attr_set(). @ref ble_gatts_evt_sys_attr_missing_t */
|
||||
BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. @ref ble_gatts_evt_hvc_t */
|
||||
BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */
|
||||
BLE_GATTS_EVT_TIMEOUT /**< Timeout. @ref ble_gatts_evt_timeout_t */
|
||||
};
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTS_DEFINES Defines
|
||||
* @{ */
|
||||
|
||||
/** @defgroup BLE_ERRORS_GATTS SVC return values specific to GATTS
|
||||
* @{ */
|
||||
#define BLE_ERROR_GATTS_INVALID_ATTR_TYPE (NRF_GATTS_ERR_BASE + 0x000) /**< Invalid attribute type. */
|
||||
#define BLE_ERROR_GATTS_SYS_ATTR_MISSING (NRF_GATTS_ERR_BASE + 0x001) /**< System Attributes missing. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_ATTR_LENS_MAX Maximum attribute lengths
|
||||
* @{ */
|
||||
#define BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */
|
||||
#define BLE_GATTS_VAR_ATTR_LEN_MAX (512) /**< Maximum length for variable length Attribute Values. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_SRVC_TYPES GATT Server Service Types
|
||||
* @{ */
|
||||
#define BLE_GATTS_SRVC_TYPE_INVALID 0x00 /**< Invalid Service Type. */
|
||||
#define BLE_GATTS_SRVC_TYPE_PRIMARY 0x01 /**< Primary Service. */
|
||||
#define BLE_GATTS_SRVC_TYPE_SECONDARY 0x02 /**< Secondary Type. */
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types
|
||||
* @{ */
|
||||
#define BLE_GATTS_ATTR_TYPE_INVALID 0x00 /**< Invalid Attribute Type. */
|
||||
#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL 0x01 /**< Primary Service Declaration. */
|
||||
#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL 0x02 /**< Secondary Service Declaration. */
|
||||
#define BLE_GATTS_ATTR_TYPE_INC_DECL 0x03 /**< Include Declaration. */
|
||||
#define BLE_GATTS_ATTR_TYPE_CHAR_DECL 0x04 /**< Characteristic Declaration. */
|
||||
#define BLE_GATTS_ATTR_TYPE_CHAR_VAL 0x05 /**< Characteristic Value. */
|
||||
#define BLE_GATTS_ATTR_TYPE_DESC 0x06 /**< Descriptor. */
|
||||
#define BLE_GATTS_ATTR_TYPE_OTHER 0x07 /**< Other, non-GATT specific type. */
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @defgroup BLE_GATTS_OPS GATT Server Operations
|
||||
* @{ */
|
||||
#define BLE_GATTS_OP_INVALID 0x00 /**< Invalid Operation. */
|
||||
#define BLE_GATTS_OP_WRITE_REQ 0x01 /**< Write Request. */
|
||||
#define BLE_GATTS_OP_WRITE_CMD 0x02 /**< Write Command. */
|
||||
#define BLE_GATTS_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */
|
||||
#define BLE_GATTS_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */
|
||||
#define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL 0x05 /**< Execute Write Request: Cancel all prepared writes. */
|
||||
#define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW 0x06 /**< Execute Write Request: Immediately execute all prepared writes. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_VLOCS GATT Value Locations
|
||||
* @{ */
|
||||
#define BLE_GATTS_VLOC_INVALID 0x00 /**< Invalid Location. */
|
||||
#define BLE_GATTS_VLOC_STACK 0x01 /**< Attribute Value is located in stack memory, no user memory is required. */
|
||||
#define BLE_GATTS_VLOC_USER 0x02 /**< Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack
|
||||
will read and write directly to the memory using the pointer provided in the APIs. There are no alignment requirements for the buffer. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_AUTHORIZE_TYPES GATT Server Authorization Types
|
||||
* @{ */
|
||||
#define BLE_GATTS_AUTHORIZE_TYPE_INVALID 0x00 /**< Invalid Type. */
|
||||
#define BLE_GATTS_AUTHORIZE_TYPE_READ 0x01 /**< Authorize a Read Operation. */
|
||||
#define BLE_GATTS_AUTHORIZE_TYPE_WRITE 0x02 /**< Authorize a Write Request Operation. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_SYS_ATTR_FLAGS System Attribute Flags
|
||||
* @{ */
|
||||
#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0) /**< Restrict system attributes to system services only. */
|
||||
#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1) /**< Restrict system attributes to user services only. */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size
|
||||
* @{
|
||||
*/
|
||||
#define BLE_GATTS_ATTR_TAB_SIZE_MIN 216 /**< Minimum Attribute Table size */
|
||||
#define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT 0x0000 /**< Default Attribute Table size (0x700 bytes for this version of the SoftDevice). */
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTS_STRUCTURES Structures
|
||||
* @{ */
|
||||
|
||||
/**
|
||||
* @brief BLE GATTS init options
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t service_changed:1; /**< Include the Service Changed characteristic in the Attribute Table. */
|
||||
uint32_t attr_tab_size; /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */
|
||||
} ble_gatts_enable_params_t;
|
||||
|
||||
/**@brief Attribute metadata. */
|
||||
typedef struct
|
||||
{
|
||||
ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */
|
||||
ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */
|
||||
uint8_t vlen :1; /**< Variable length attribute. */
|
||||
uint8_t vloc :2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/
|
||||
uint8_t rd_auth :1; /**< Read authorization and value will be requested from the application on every read operation. */
|
||||
uint8_t wr_auth :1; /**< Write authorization will be requested from the application on every Write Request operation (but not Write Command). */
|
||||
} ble_gatts_attr_md_t;
|
||||
|
||||
|
||||
/**@brief GATT Attribute. */
|
||||
typedef struct
|
||||
{
|
||||
ble_uuid_t *p_uuid; /**< Pointer to the attribute UUID. */
|
||||
ble_gatts_attr_md_t *p_attr_md; /**< Pointer to the attribute metadata structure. */
|
||||
uint16_t init_len; /**< Initial attribute value length in bytes. */
|
||||
uint16_t init_offs; /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */
|
||||
uint16_t max_len; /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */
|
||||
uint8_t* p_value; /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer
|
||||
that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location.
|
||||
The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/
|
||||
} ble_gatts_attr_t;
|
||||
|
||||
/**@brief GATT Attribute Value. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t len; /**< Length in bytes to be written or read. Length in bytes written or read after successful return.*/
|
||||
uint16_t offset; /**< Attribute value offset. */
|
||||
uint8_t *p_value; /**< Pointer to where value is stored or will be stored.
|
||||
If value is stored in user memory, only the attribute length is updated when p_value == NULL.
|
||||
Set to NULL when reading to obtain the complete length of the attribute value */
|
||||
} ble_gatts_value_t;
|
||||
|
||||
|
||||
/**@brief GATT Attribute Context. */
|
||||
typedef struct
|
||||
{
|
||||
ble_uuid_t srvc_uuid; /**< Service UUID. */
|
||||
ble_uuid_t char_uuid; /**< Characteristic UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */
|
||||
ble_uuid_t desc_uuid; /**< Descriptor UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */
|
||||
uint16_t srvc_handle; /**< Service Handle. */
|
||||
uint16_t value_handle; /**< Characteristic Value Handle if applicable (BLE_GATT_HANDLE_INVALID otherwise). */
|
||||
uint8_t type; /**< Attribute Type, see @ref BLE_GATTS_ATTR_TYPES. */
|
||||
} ble_gatts_attr_context_t;
|
||||
|
||||
|
||||
/**@brief GATT Characteristic Presentation Format. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t format; /**< Format of the value, see @ref BLE_GATT_CPF_FORMATS. */
|
||||
int8_t exponent; /**< Exponent for integer data types. */
|
||||
uint16_t unit; /**< Unit from Bluetooth Assigned Numbers. */
|
||||
uint8_t name_space; /**< Namespace from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */
|
||||
uint16_t desc; /**< Namespace description from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */
|
||||
} ble_gatts_char_pf_t;
|
||||
|
||||
|
||||
/**@brief GATT Characteristic metadata. */
|
||||
typedef struct
|
||||
{
|
||||
ble_gatt_char_props_t char_props; /**< Characteristic Properties. */
|
||||
ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic Extended Properties. */
|
||||
uint8_t *p_char_user_desc; /**< Pointer to a UTF-8 encoded string (non-NULL terminated), NULL if the descriptor is not required. */
|
||||
uint16_t char_user_desc_max_size; /**< The maximum size in bytes of the user description descriptor. */
|
||||
uint16_t char_user_desc_size; /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */
|
||||
ble_gatts_char_pf_t* p_char_pf; /**< Pointer to a presentation format structure or NULL if the CPF descriptor is not required. */
|
||||
ble_gatts_attr_md_t* p_user_desc_md; /**< Attribute metadata for the User Description descriptor, or NULL for default values. */
|
||||
ble_gatts_attr_md_t* p_cccd_md; /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */
|
||||
ble_gatts_attr_md_t* p_sccd_md; /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */
|
||||
} ble_gatts_char_md_t;
|
||||
|
||||
|
||||
/**@brief GATT Characteristic Definition Handles. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t value_handle; /**< Handle to the characteristic value. */
|
||||
uint16_t user_desc_handle; /**< Handle to the User Description descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
|
||||
uint16_t cccd_handle; /**< Handle to the Client Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
|
||||
uint16_t sccd_handle; /**< Handle to the Server Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
|
||||
} ble_gatts_char_handles_t;
|
||||
|
||||
|
||||
/**@brief GATT HVx parameters. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Characteristic Value Handle. */
|
||||
uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */
|
||||
uint16_t offset; /**< Offset within the attribute value. */
|
||||
uint16_t *p_len; /**< Length in bytes to be written, length in bytes written after successful return. */
|
||||
uint8_t *p_data; /**< Actual data content, use NULL to use the current attribute value. */
|
||||
} ble_gatts_hvx_params_t;
|
||||
|
||||
/**@brief GATT Read Authorization parameters. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
|
||||
uint8_t update : 1; /**< If set, data supplied in p_data will be used in the ATT response. */
|
||||
uint16_t offset; /**< Offset of the attribute value being updated. */
|
||||
uint16_t len; /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */
|
||||
uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */
|
||||
} ble_gatts_read_authorize_params_t;
|
||||
|
||||
/**@brief GATT Write Authorization parameters. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
|
||||
} ble_gatts_write_authorize_params_t;
|
||||
|
||||
/**@brief GATT Read or Write Authorize Reply parameters. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */
|
||||
union {
|
||||
ble_gatts_read_authorize_params_t read; /**< Read authorization parameters. */
|
||||
ble_gatts_write_authorize_params_t write; /**< Write authorization parameters. */
|
||||
} params; /**< Reply Parameters. */
|
||||
} ble_gatts_rw_authorize_reply_params_t;
|
||||
|
||||
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */
|
||||
ble_gatts_attr_context_t context; /**< Attribute Context. */
|
||||
uint16_t offset; /**< Offset for the write operation. */
|
||||
uint16_t len; /**< Length of the received data. */
|
||||
uint8_t data[1]; /**< Received data, variable length. */
|
||||
} ble_gatts_evt_write_t;
|
||||
|
||||
/**@brief Event substructure for authorized read requests, see @ref ble_gatts_evt_rw_authorize_request_t. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
ble_gatts_attr_context_t context; /**< Attribute Context. */
|
||||
uint16_t offset; /**< Offset for the read operation. */
|
||||
} ble_gatts_evt_read_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type; /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */
|
||||
union {
|
||||
ble_gatts_evt_read_t read; /**< Attribute Read Parameters. */
|
||||
ble_gatts_evt_write_t write; /**< Attribute Write Parameters. */
|
||||
} request; /**< Request Parameters. */
|
||||
} ble_gatts_evt_rw_authorize_request_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t hint; /**< Hint (currently unused). */
|
||||
} ble_gatts_evt_sys_attr_missing_t;
|
||||
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTS_EVT_HVC. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t handle; /**< Attribute Handle. */
|
||||
} ble_gatts_evt_hvc_t;
|
||||
|
||||
/**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */
|
||||
} ble_gatts_evt_timeout_t;
|
||||
|
||||
|
||||
/**@brief GATT Server event callback event structure. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t conn_handle; /**< Connection Handle on which the event occurred. */
|
||||
union
|
||||
{
|
||||
ble_gatts_evt_write_t write; /**< Write Event Parameters. */
|
||||
ble_gatts_evt_rw_authorize_request_t authorize_request; /**< Read or Write Authorize Request Parameters. */
|
||||
ble_gatts_evt_sys_attr_missing_t sys_attr_missing; /**< System attributes missing. */
|
||||
ble_gatts_evt_hvc_t hvc; /**< Handle Value Confirmation Event Parameters. */
|
||||
ble_gatts_evt_timeout_t timeout; /**< Timeout Event. */
|
||||
} params; /**< Event Parameters. */
|
||||
} ble_gatts_evt_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup BLE_GATTS_FUNCTIONS Functions
|
||||
* @{ */
|
||||
|
||||
/**@brief Add a service declaration to the Attribute Table.
|
||||
*
|
||||
* @param[in] type Toggles between primary and secondary services, see @ref BLE_GATTS_SRVC_TYPES.
|
||||
* @param[in] p_uuid Pointer to service UUID.
|
||||
* @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored.
|
||||
*
|
||||
* @note Secondary Services are only relevant in the context of the entity that references them, it is therefore forbidden to
|
||||
* add a secondary service declaration that is not referenced by another service later in the Attribute Table.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully added a service declaration.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, Vendor Specific UUIDs need to be present in the table.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle));
|
||||
|
||||
|
||||
/**@brief Add an include declaration to the Attribute Table.
|
||||
*
|
||||
* @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time).
|
||||
*
|
||||
* @note The included service must already be present in the Attribute Table prior to this call.
|
||||
*
|
||||
* @param[in] service_handle Handle of the service where the included service is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
|
||||
* @param[in] inc_srvc_handle Handle of the included service.
|
||||
* @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully added an include declaration.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_INCLUDE_ADD, uint32_t, sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle));
|
||||
|
||||
|
||||
/**@brief Add a characteristic declaration, a characteristic value declaration and optional characteristic descriptor declarations to the Attribute Table.
|
||||
*
|
||||
* @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential population is supported at this time).
|
||||
*
|
||||
* @note Several restrictions apply to the parameters, such as matching permissions between the user description descriptor and the writeable auxiliaries bits,
|
||||
* readable (no security) and writeable (selectable) CCCDs and SCCDs and valid presentation format values.
|
||||
*
|
||||
* @note If no metadata is provided for the optional descriptors, their permissions will be derived from the characteristic permissions.
|
||||
*
|
||||
* @param[in] service_handle Handle of the service where the characteristic is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
|
||||
* @param[in] p_char_md Characteristic metadata.
|
||||
* @param[in] p_attr_char_value Pointer to the attribute structure corresponding to the characteristic value.
|
||||
* @param[out] p_handles Pointer to the structure where the assigned handles will be stored.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully added a characteristic.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a service context is required.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_CHARACTERISTIC_ADD, uint32_t, sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles));
|
||||
|
||||
|
||||
/**@brief Add a descriptor to the Attribute Table.
|
||||
*
|
||||
* @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time).
|
||||
*
|
||||
* @param[in] char_handle Handle of the characteristic where the descriptor is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
|
||||
* @param[in] p_attr Pointer to the attribute structure.
|
||||
* @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully added a descriptor.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, characteristic handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a characteristic context is required.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle));
|
||||
|
||||
/**@brief Set the value of a given attribute.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used.
|
||||
* @param[in] handle Attribute handle.
|
||||
* @param[in,out] p_value Attribute value information.
|
||||
*
|
||||
* @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully set the value of the attribute.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
|
||||
* @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
|
||||
* @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value));
|
||||
|
||||
/**@brief Get the value of a given attribute.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used.
|
||||
* @param[in] handle Attribute handle.
|
||||
* @param[in,out] p_value Attribute value information.
|
||||
*
|
||||
* @note If the attribute value is longer than the size of the supplied buffer,
|
||||
* p_len will return the total attribute value length (excluding offset),
|
||||
* and not the number of bytes actually returned in p_data.
|
||||
* The application may use this information to allocate a suitable buffer size.
|
||||
*
|
||||
* @note When retrieving system attribute values with this function, the connection handle
|
||||
* may refer to an already disconnected connection. Refer to the documentation of
|
||||
* @ref sd_ble_gatts_sys_attr_get for further information.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully retrieved the value of the attribute.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
|
||||
* @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value));
|
||||
|
||||
/**@brief Notify or Indicate an attribute value.
|
||||
*
|
||||
* @details This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation
|
||||
* (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that
|
||||
* the application can atomically perform a value update and a server initiated transaction with a single API call.
|
||||
* If the application chooses to indicate an attribute value, a @ref BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from
|
||||
* the peer.
|
||||
*
|
||||
* @note The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution.
|
||||
* When receiveing the error codes @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and
|
||||
* @ref BLE_ERROR_NO_TX_BUFFERS the Attribute Table has been updated.
|
||||
* The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len).
|
||||
*
|
||||
* @note It is important to note that a notification will <b>consume an application buffer</b>, and will therefore
|
||||
* generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. An indication on the other hand will use the
|
||||
* standard server internal buffer and thus will only generate a @ref BLE_GATTS_EVT_HVC event as soon as the confirmation
|
||||
* has been received from the peer. Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle.
|
||||
* @param[in] p_hvx_params Pointer to an HVx parameters structure. If the p_data member contains a non-NULL pointer the attribute value will be updated with
|
||||
* the contents pointed by it before sending the notification or indication.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate.
|
||||
* @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
|
||||
* @retval ::NRF_ERROR_BUSY Procedure already in progress.
|
||||
* @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
|
||||
* @retval ::BLE_ERROR_NO_TX_BUFFERS There are no available buffers to send the data, applies only to notifications.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params));
|
||||
|
||||
/**@brief Indicate the Service Changed attribute value.
|
||||
*
|
||||
* @details This call will send a Handle Value Indication to one or more peers connected to inform them that the Attribute
|
||||
* Table layout has changed. As soon as the peer has confirmed the indication, a @ref BLE_GATTS_EVT_SC_CONFIRM event will
|
||||
* be issued.
|
||||
*
|
||||
* @note Some of the restrictions and limitations that apply to @ref sd_ble_gatts_hvx also apply here.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle.
|
||||
* @param[in] start_handle Start of affected attribute handle range.
|
||||
* @param[in] end_handle End of affected attribute handle range.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, notifications or indications must be enabled in the CCCD.
|
||||
* @retval ::NRF_ERROR_BUSY Procedure already in progress.
|
||||
* @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle));
|
||||
|
||||
/**@brief Respond to a Read/Write authorization request.
|
||||
*
|
||||
* @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle.
|
||||
* @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no authorization request pending.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid,
|
||||
* or for Read Authorization reply: requested handles not replied with,
|
||||
* or for Write Authorization reply: handle supplied does not match requested handle.
|
||||
* @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params));
|
||||
|
||||
|
||||
/**@brief Update persistent system attribute information.
|
||||
*
|
||||
* @details Supply information about persistent system attributes to the stack,
|
||||
* previously obtained using @ref sd_ble_gatts_sys_attr_get.
|
||||
* This call is only allowed for active connections, and is usually
|
||||
* made immediately after a connection is established with an known bonded device,
|
||||
* often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING.
|
||||
*
|
||||
* p_sysattrs may point directly to the application's stored copy of the system attributes
|
||||
* obtained using @ref sd_ble_gatts_sys_attr_get.
|
||||
* If the pointer is NULL, the system attribute info is initialized, assuming that
|
||||
* the application does not have any previously saved system attribute data for this device.
|
||||
*
|
||||
* @note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration.
|
||||
*
|
||||
* @note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially.
|
||||
* This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or
|
||||
* reset the SoftDevice to return to a known state.
|
||||
*
|
||||
* @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified.
|
||||
* @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle.
|
||||
* @param[in] p_sys_attr_data Pointer to a saved copy of system attributes supplied to the stack, or NULL.
|
||||
* @param[in] len Size of data pointed by p_sys_attr_data, in octets.
|
||||
* @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully set the system attribute information.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
|
||||
* @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
* @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags));
|
||||
|
||||
|
||||
/**@brief Retrieve persistent system attribute information from the stack.
|
||||
*
|
||||
* @details This call is used to retrieve information about values to be stored perisistently by the application
|
||||
* during the lifetime of a connection or after it has been terminated. When a new connection is established with the same bonded device,
|
||||
* the system attribute information retrieved with this function should be restored using using @ref sd_ble_gatts_sys_attr_set.
|
||||
* If retrieved after disconnection, the data should be read before a new connection established. The connection handle for
|
||||
* the previous, now disconnected, connection will remain valid until a new one is created to allow this API call to refer to it.
|
||||
* Connection handles belonging to active connections can be used as well, but care should be taken since the system attributes
|
||||
* may be written to at any time by the peer during a connection's lifetime.
|
||||
*
|
||||
* @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be returned.
|
||||
* @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be returned.
|
||||
*
|
||||
* @param[in] conn_handle Connection handle of the recently terminated connection.
|
||||
* @param[out] p_sys_attr_data Pointer to a buffer where updated information about system attributes will be filled in. NULL can be provided to
|
||||
* obtain the length of the data
|
||||
* @param[in,out] p_len Size of application buffer if p_sys_attr_data is not NULL. Unconditially updated to actual length of system attribute data.
|
||||
* @param[in] flags Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully retrieved the system attribute information.
|
||||
* @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND No system attributes found.
|
||||
*/
|
||||
SVCALL(SD_BLE_GATTS_SYS_ATTR_GET, uint32_t, sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags));
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif // BLE_GATTS_H__
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_COMMON
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BLE_HCI_H__
|
||||
#define BLE_HCI_H__
|
||||
|
||||
/** @defgroup BLE_HCI_STATUS_CODES Bluetooth status codes
|
||||
* @{ */
|
||||
|
||||
#define BLE_HCI_STATUS_CODE_SUCCESS 0x00 /**< Success. */
|
||||
#define BLE_HCI_STATUS_CODE_UNKNOWN_BTLE_COMMAND 0x01 /**< Unknown BLE Command. */
|
||||
#define BLE_HCI_STATUS_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 /**< Unknown Connection Identifier. */
|
||||
/*0x03 Hardware Failure
|
||||
0x04 Page Timeout
|
||||
*/
|
||||
#define BLE_HCI_AUTHENTICATION_FAILURE 0x05 /**< Authentication Failure. */
|
||||
#define BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING 0x06 /**< Pin or Key missing. */
|
||||
#define BLE_HCI_MEMORY_CAPACITY_EXCEEDED 0x07 /**< Memory Capacity Exceeded. */
|
||||
#define BLE_HCI_CONNECTION_TIMEOUT 0x08 /**< Connection Timeout. */
|
||||
/*0x09 Connection Limit Exceeded
|
||||
0x0A Synchronous Connection Limit To A Device Exceeded
|
||||
0x0B ACL Connection Already Exists*/
|
||||
#define BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED 0x0C /**< Command Disallowed. */
|
||||
/*0x0D Connection Rejected due to Limited Resources
|
||||
0x0E Connection Rejected Due To Security Reasons
|
||||
0x0F Connection Rejected due to Unacceptable BD_ADDR
|
||||
0x10 Connection Accept Timeout Exceeded
|
||||
0x11 Unsupported Feature or Parameter Value*/
|
||||
#define BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS 0x12 /**< Invalid BLE Command Parameters. */
|
||||
#define BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13 /**< Remote User Terminated Connection. */
|
||||
#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES 0x14 /**< Remote Device Terminated Connection due to low resources.*/
|
||||
#define BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF 0x15 /**< Remote Device Terminated Connection due to power off. */
|
||||
#define BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION 0x16 /**< Local Host Terminated Connection. */
|
||||
/*
|
||||
0x17 Repeated Attempts
|
||||
0x18 Pairing Not Allowed
|
||||
0x19 Unknown LMP PDU
|
||||
*/
|
||||
#define BLE_HCI_UNSUPPORTED_REMOTE_FEATURE 0x1A /**< Unsupported Remote Feature. */
|
||||
/*
|
||||
0x1B SCO Offset Rejected
|
||||
0x1C SCO Interval Rejected
|
||||
0x1D SCO Air Mode Rejected*/
|
||||
#define BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS 0x1E /**< Invalid LMP Parameters. */
|
||||
#define BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR 0x1F /**< Unspecified Error. */
|
||||
/*0x20 Unsupported LMP Parameter Value
|
||||
0x21 Role Change Not Allowed
|
||||
*/
|
||||
#define BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT 0x22 /**< LMP Response Timeout. */
|
||||
/*0x23 LMP Error Transaction Collision*/
|
||||
#define BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED 0x24 /**< LMP PDU Not Allowed. */
|
||||
/*0x25 Encryption Mode Not Acceptable
|
||||
0x26 Link Key Can Not be Changed
|
||||
0x27 Requested QoS Not Supported
|
||||
*/
|
||||
#define BLE_HCI_INSTANT_PASSED 0x28 /**< Instant Passed. */
|
||||
#define BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED 0x29 /**< Pairing with Unit Key Unsupported. */
|
||||
#define BLE_HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A /**< Different Transaction Collision. */
|
||||
/*
|
||||
0x2B Reserved
|
||||
0x2C QoS Unacceptable Parameter
|
||||
0x2D QoS Rejected
|
||||
0x2E Channel Classification Not Supported
|
||||
0x2F Insufficient Security
|
||||
0x30 Parameter Out Of Mandatory Range
|
||||
0x31 Reserved
|
||||
0x32 Role Switch Pending
|
||||
0x33 Reserved
|
||||
0x34 Reserved Slot Violation
|
||||
0x35 Role Switch Failed
|
||||
0x36 Extended Inquiry Response Too Large
|
||||
0x37 Secure Simple Pairing Not Supported By Host.
|
||||
0x38 Host Busy - Pairing
|
||||
0x39 Connection Rejected due to No Suitable Channel Found*/
|
||||
#define BLE_HCI_CONTROLLER_BUSY 0x3A /**< Controller Busy. */
|
||||
#define BLE_HCI_CONN_INTERVAL_UNACCEPTABLE 0x3B /**< Connection Interval Unacceptable. */
|
||||
#define BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT 0x3C /**< Directed Adverisement Timeout. */
|
||||
#define BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE 0x3D /**< Connection Terminated due to MIC Failure. */
|
||||
#define BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED 0x3E /**< Connection Failed to be Established. */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#endif // BLE_HCI_H__
|
||||
|
||||
/** @} */
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP)
|
||||
@{
|
||||
@brief Definitions and prototypes for the L2CAP interface.
|
||||
*/
|
||||
|
||||
#ifndef BLE_L2CAP_H__
|
||||
#define BLE_L2CAP_H__
|
||||
|
||||
#include "ble_types.h"
|
||||
#include "ble_ranges.h"
|
||||
#include "ble_err.h"
|
||||
#include "nrf_svc.h"
|
||||
|
||||
/**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations
|
||||
* @{ */
|
||||
|
||||
/**@brief L2CAP API SVC numbers. */
|
||||
enum BLE_L2CAP_SVCS
|
||||
{
|
||||
SD_BLE_L2CAP_CID_REGISTER = BLE_L2CAP_SVC_BASE, /**< Register a CID. */
|
||||
SD_BLE_L2CAP_CID_UNREGISTER, /**< Unregister a CID. */
|
||||
SD_BLE_L2CAP_TX /**< Transmit a packet. */
|
||||
};
|
||||
|
||||
/**@brief L2CAP Event IDs. */
|
||||
enum BLE_L2CAP_EVTS
|
||||
{
|
||||
BLE_L2CAP_EVT_RX = BLE_L2CAP_EVT_BASE /**< L2CAP packet received. */
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
/**@addtogroup BLE_L2CAP_DEFINES Defines
|
||||
* @{ */
|
||||
|
||||
/**@defgroup BLE_ERRORS_L2CAP SVC return values specific to L2CAP
|
||||
* @{ */
|
||||
#define BLE_ERROR_L2CAP_CID_IN_USE (NRF_L2CAP_ERR_BASE + 0x000) /**< CID already in use. */
|
||||
/** @} */
|
||||
|
||||
/**@brief Default L2CAP MTU. */
|
||||
#define BLE_L2CAP_MTU_DEF (23)
|
||||
|
||||
/**@brief Invalid Channel Identifier. */
|
||||
#define BLE_L2CAP_CID_INVALID (0x0000)
|
||||
|
||||
/**@brief Dynamic Channel Identifier base. */
|
||||
#define BLE_L2CAP_CID_DYN_BASE (0x0040)
|
||||
|
||||
/**@brief Maximum amount of dynamic CIDs. */
|
||||
#define BLE_L2CAP_CID_DYN_MAX (8)
|
||||
|
||||
/** @} */
|
||||
|
||||
/**@addtogroup BLE_L2CAP_STRUCTURES Structures
|
||||
* @{ */
|
||||
|
||||
/**@brief Packet header format for L2CAP transmission. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t len; /**< Length of valid info in data member. */
|
||||
uint16_t cid; /**< Channel ID on which packet is transmitted. */
|
||||
} ble_l2cap_header_t;
|
||||
|
||||
|
||||
/**@brief L2CAP Received packet event report. */
|
||||
typedef struct
|
||||
{
|
||||
ble_l2cap_header_t header; /**< L2CAP packet header. */
|
||||
uint8_t data[1]; /**< Packet data, variable length. */
|
||||
} ble_l2cap_evt_rx_t;
|
||||
|
||||
|
||||
/**@brief L2CAP event callback event structure. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t conn_handle; /**< Connection Handle on which event occured. */
|
||||
union
|
||||
{
|
||||
ble_l2cap_evt_rx_t rx; /**< RX Event parameters. */
|
||||
} params; /**< Event Parameters. */
|
||||
} ble_l2cap_evt_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
/**@addtogroup BLE_L2CAP_FUNCTIONS Functions
|
||||
* @{ */
|
||||
|
||||
/**@brief Register a CID with L2CAP.
|
||||
*
|
||||
* @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID.
|
||||
*
|
||||
* @param[in] cid L2CAP CID.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully registered a CID with the L2CAP layer.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CID must be above @ref BLE_L2CAP_CID_DYN_BASE.
|
||||
* @retval ::BLE_ERROR_L2CAP_CID_IN_USE L2CAP CID already in use.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
*/
|
||||
SVCALL(SD_BLE_L2CAP_CID_REGISTER, uint32_t, sd_ble_l2cap_cid_register(uint16_t cid));
|
||||
|
||||
/**@brief Unregister a CID with L2CAP.
|
||||
*
|
||||
* @details This unregisters a previously registerd higher protocol layer with the L2CAP multiplexer.
|
||||
*
|
||||
* @param[in] cid L2CAP CID.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully unregistered the CID.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND CID not previously registered.
|
||||
*/
|
||||
SVCALL(SD_BLE_L2CAP_CID_UNREGISTER, uint32_t, sd_ble_l2cap_cid_unregister(uint16_t cid));
|
||||
|
||||
/**@brief Transmit an L2CAP packet.
|
||||
*
|
||||
* @note It is important to note that a call to this function will <b>consume an application buffer</b>, and will therefore
|
||||
* generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted.
|
||||
* Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details.
|
||||
*
|
||||
* @param[in] conn_handle Connection Handle.
|
||||
* @param[in] p_header Pointer to a packet header containing length and CID.
|
||||
* @param[in] p_data Pointer to the data to be transmitted.
|
||||
*
|
||||
* @retval ::NRF_SUCCESS Successfully queued an L2CAP packet for transmission.
|
||||
* @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
|
||||
* @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register.
|
||||
* @retval ::NRF_ERROR_NOT_FOUND CID not found.
|
||||
* @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
|
||||
* @retval ::BLE_ERROR_NO_TX_BUFFERS Not enough application buffers available.
|
||||
* @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF.
|
||||
*/
|
||||
SVCALL(SD_BLE_L2CAP_TX, uint32_t, sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_t const *p_header, uint8_t const *p_data));
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif // BLE_L2CAP_H__
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software must only be used in a processor manufactured by Nordic
|
||||
* Semiconductor ASA, or in a processor manufactured by a third party that
|
||||
* is used in combination with a processor manufactured by Nordic Semiconductor.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@addtogroup BLE_COMMON
|
||||
@{
|
||||
@defgroup ble_ranges Module specific SVC, event and option number subranges
|
||||
@{
|
||||
|
||||
@brief Definition of SVC, event and option number subranges for each API module.
|
||||
|
||||
@note
|
||||
SVCs, event and option numbers are split into subranges for each API module.
|
||||
Each module receives its entire allocated range of SVC calls, whether implemented or not,
|
||||
but return BLE_ERROR_NOT_SUPPORTED for unimplemented or undefined calls in its range.
|
||||
|
||||
Note that the symbols BLE_<module>_SVC_LAST is the end of the allocated SVC range,
|
||||
rather than the last SVC function call actually defined and implemented.
|
||||
|
||||
Specific SVC, event and option values are defined in each module's ble_<module>.h file,
|
||||
which defines names of each individual SVC code based on the range start value.
|
||||
*/
|
||||
|
||||
#ifndef BLE_RANGES_H__
|
||||
#define BLE_RANGES_H__
|
||||
|
||||
#define BLE_SVC_BASE 0x60 /**< Common BLE SVC base. */
|
||||
#define BLE_SVC_LAST 0x6B /**< Total: 12. */
|
||||
|
||||
#define BLE_RESERVED_SVC_BASE 0x6C /**< Reserved BLE SVC base. */
|
||||
#define BLE_RESERVED_SVC_LAST 0x6F /**< Total: 4. */
|
||||
|
||||
#define BLE_GAP_SVC_BASE 0x70 /**< GAP BLE SVC base. */
|
||||
#define BLE_GAP_SVC_LAST 0x8F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTC_SVC_BASE 0x90 /**< GATTC BLE SVC base. */
|
||||
#define BLE_GATTC_SVC_LAST 0x9F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTS_SVC_BASE 0xA0 /**< GATTS BLE SVC base. */
|
||||
#define BLE_GATTS_SVC_LAST 0xAF /**< Total: 16. */
|
||||
|
||||
#define BLE_L2CAP_SVC_BASE 0xB0 /**< L2CAP BLE SVC base. */
|
||||
#define BLE_L2CAP_SVC_LAST 0xBF /**< Total: 16. */
|
||||
|
||||
|
||||
#define BLE_EVT_INVALID 0x00 /**< Invalid BLE Event. */
|
||||
|
||||
#define BLE_EVT_BASE 0x01 /**< Common BLE Event base. */
|
||||
#define BLE_EVT_LAST 0x0F /**< Total: 15. */
|
||||
|
||||
#define BLE_GAP_EVT_BASE 0x10 /**< GAP BLE Event base. */
|
||||
#define BLE_GAP_EVT_LAST 0x2F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTC_EVT_BASE 0x30 /**< GATTC BLE Event base. */
|
||||
#define BLE_GATTC_EVT_LAST 0x4F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTS_EVT_BASE 0x50 /**< GATTS BLE Event base. */
|
||||
#define BLE_GATTS_EVT_LAST 0x6F /**< Total: 32. */
|
||||
|
||||
#define BLE_L2CAP_EVT_BASE 0x70 /**< L2CAP BLE Event base. */
|
||||
#define BLE_L2CAP_EVT_LAST 0x8F /**< Total: 32. */
|
||||
|
||||
|
||||
#define BLE_OPT_INVALID 0x00 /**< Invalid BLE Option. */
|
||||
|
||||
#define BLE_OPT_BASE 0x01 /**< Common BLE Option base. */
|
||||
#define BLE_OPT_LAST 0x1F /**< Total: 31. */
|
||||
|
||||
#define BLE_GAP_OPT_BASE 0x20 /**< GAP BLE Option base. */
|
||||
#define BLE_GAP_OPT_LAST 0x3F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTC_OPT_BASE 0x40 /**< GATTC BLE Option base. */
|
||||
#define BLE_GATTC_OPT_LAST 0x5F /**< Total: 32. */
|
||||
|
||||
#define BLE_GATTS_OPT_BASE 0x60 /**< GATTS BLE Option base. */
|
||||
#define BLE_GATTS_OPT_LAST 0x7F /**< Total: 32. */
|
||||
|
||||
#define BLE_L2CAP_OPT_BASE 0x80 /**< L2CAP BLE Option base. */
|
||||
#define BLE_L2CAP_OPT_LAST 0x9F /**< Total: 32. */
|
||||
|
||||
#endif /* BLE_RANGES_H__ */
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user