mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
move crazyflie syslink to board directory
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
# COPYRIGHT OWNER 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__syslink
|
||||
MAIN syslink
|
||||
STACK_MAIN 1300
|
||||
SRCS
|
||||
syslink_main.cpp
|
||||
syslink_bridge.cpp
|
||||
syslink_memory.cpp
|
||||
syslink_params.c
|
||||
syslink.c
|
||||
DEPENDS
|
||||
)
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CRTP_PORT_CONSOLE 0x00
|
||||
#define CRTP_PORT_PARAM 0x02
|
||||
#define CRTP_PORT_COMMANDER 0x03
|
||||
#define CRTP_PORT_MEM 0x04
|
||||
#define CRTP_PORT_LOG 0x05
|
||||
|
||||
#define CRTP_PORT_MAVLINK 0x08 // Non-standard port for transmitting mavlink messages
|
||||
|
||||
#define CRTP_PORT_PLATFORM 0x0D
|
||||
#define CRTP_PORT_DEBUG 0x0E
|
||||
#define CRTP_PORT_LINK 0x0F
|
||||
|
||||
#define CRTP_NULL(x) (((x).header & 0xf3) == 0xf3)
|
||||
|
||||
// 1 byte header + 31 bytes data = 32 (max ESB packet size)
|
||||
// With the NRF51, this could be increased to ~250, but the Crazyradio PA uses a NRF24 which can't do this
|
||||
#define CRTP_MAX_DATA_SIZE 31
|
||||
|
||||
typedef struct {
|
||||
uint8_t size; // Total size of this message, including the header (placed here to overlap with syslink length field)
|
||||
union {
|
||||
uint8_t header;
|
||||
struct {
|
||||
uint8_t channel : 2;
|
||||
uint8_t link : 2;
|
||||
uint8_t port : 4;
|
||||
};
|
||||
};
|
||||
|
||||
uint8_t data[CRTP_MAX_DATA_SIZE];
|
||||
} __attribute__((packed)) crtp_message_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
float roll; // -20 to 20
|
||||
float pitch;
|
||||
float yaw; // -150 to 150
|
||||
uint16_t thrust;
|
||||
} crtp_commander;
|
||||
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* Definitions for crazyflie related drivers */
|
||||
|
||||
#ifndef _DRV_CRAZYFLIE_H
|
||||
#define _DRV_CRAZYFLIE_H
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
|
||||
#define DECK_DEVICE_PATH "/dev/deck"
|
||||
|
||||
|
||||
|
||||
/* structure of the data stored in deck memory */
|
||||
typedef struct {
|
||||
uint8_t header; // Should be 0xEB
|
||||
uint32_t pins;
|
||||
uint8_t vendorId;
|
||||
uint8_t productId;
|
||||
uint8_t crc;
|
||||
uint8_t data[104];
|
||||
|
||||
} __attribute__((packed)) deck_descriptor_t;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ioctl() definitions
|
||||
*/
|
||||
|
||||
#define _DECKIOCBASE (0x4100)
|
||||
#define _DECKIOC(_n) (_PX4_IOC(_DECKIOCBASE, _n))
|
||||
|
||||
/** get the number of connected deck memory devices */
|
||||
#define DECKIOGNUM _DECKIOC(0)
|
||||
|
||||
/** set the index of the current deck memory being accessed */
|
||||
#define DECKIOSNUM _DECKIOC(1)
|
||||
|
||||
#define DECKIOID _DECKIOC(2)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,153 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file syslink.c
|
||||
*
|
||||
* Crazyflie Syslink protocol implementation
|
||||
*
|
||||
* @author Dennis Shtatnov <densht@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <poll.h>
|
||||
#include <termios.h>
|
||||
|
||||
|
||||
#include "syslink.h"
|
||||
|
||||
|
||||
const char *syslink_magic = "\xbc\xcf";
|
||||
|
||||
void syslink_parse_init(syslink_parse_state *state)
|
||||
{
|
||||
state->state = SYSLINK_STATE_START;
|
||||
state->index = 0;
|
||||
}
|
||||
|
||||
|
||||
int syslink_parse_char(syslink_parse_state *state, char c, syslink_message_t *msg)
|
||||
{
|
||||
|
||||
switch (state->state) {
|
||||
case SYSLINK_STATE_START:
|
||||
if (c == syslink_magic[state->index]) {
|
||||
state->index++;
|
||||
|
||||
} else {
|
||||
state->index = 0;
|
||||
}
|
||||
|
||||
if (syslink_magic[state->index] == '\x00') {
|
||||
state->state = SYSLINK_STATE_TYPE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SYSLINK_STATE_TYPE:
|
||||
msg->type = c;
|
||||
state->state = SYSLINK_STATE_LENGTH;
|
||||
break;
|
||||
|
||||
case SYSLINK_STATE_LENGTH:
|
||||
msg->length = c;
|
||||
|
||||
if (c > SYSLINK_MAX_DATA_LEN) { // Too long
|
||||
state->state = SYSLINK_STATE_START;
|
||||
|
||||
} else {
|
||||
state->state = c > 0 ? SYSLINK_STATE_DATA : SYSLINK_STATE_CKSUM;
|
||||
}
|
||||
|
||||
state->index = 0;
|
||||
break;
|
||||
|
||||
case SYSLINK_STATE_DATA:
|
||||
msg->data[state->index++] = c;
|
||||
|
||||
if (state->index >= msg->length) {
|
||||
state->state = SYSLINK_STATE_CKSUM;
|
||||
state->index = 0;
|
||||
syslink_compute_cksum(msg);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SYSLINK_STATE_CKSUM:
|
||||
if (c != msg->cksum[state->index]) {
|
||||
PX4_INFO("Bad checksum");
|
||||
state->state = SYSLINK_STATE_START;
|
||||
state->index = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
state->index++;
|
||||
|
||||
if (state->index >= (int)sizeof(msg->cksum)) {
|
||||
state->state = SYSLINK_STATE_START;
|
||||
state->index = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Computes Fletcher 8bit checksum per RFC1146
|
||||
A := A + D[i]
|
||||
B := B + A
|
||||
*/
|
||||
void syslink_compute_cksum(syslink_message_t *msg)
|
||||
{
|
||||
uint8_t a = 0, b = 0;
|
||||
uint8_t *Di = (uint8_t *)msg, *end = Di + (2 + msg->length) * sizeof(uint8_t);
|
||||
|
||||
while (Di < end) {
|
||||
a = a + *Di;
|
||||
b = b + a;
|
||||
++Di;
|
||||
}
|
||||
|
||||
msg->cksum[0] = a;
|
||||
msg->cksum[1] = b;
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
extern const char *syslink_magic;
|
||||
|
||||
#define SYSLINK_GROUP 0xF0
|
||||
|
||||
#define SYSLINK_RADIO 0x00
|
||||
#define SYSLINK_RADIO_RAW 0x00
|
||||
#define SYSLINK_RADIO_CHANNEL 0x01
|
||||
#define SYSLINK_RADIO_DATARATE 0x02
|
||||
#define SYSLINK_RADIO_CONTWAVE 0x03
|
||||
#define SYSLINK_RADIO_RSSI 0x04
|
||||
#define SYSLINK_RADIO_ADDRESS 0x05
|
||||
|
||||
#define SYSLINK_PM 0x10
|
||||
#define SYSLINK_PM_SOURCE 0x10
|
||||
#define SYSLINK_PM_ONOFF_SWITCHOFF 0x11
|
||||
#define SYSLINK_PM_BATTERY_VOLTAGE 0x12
|
||||
#define SYSLINK_PM_BATTERY_STATE 0x13
|
||||
#define SYSLINK_PM_BATTERY_AUTOUPDATE 0x14
|
||||
|
||||
#define SYSLINK_OW 0x20
|
||||
#define SYSLINK_OW_SCAN 0x20
|
||||
#define SYSLINK_OW_GETINFO 0x21
|
||||
#define SYSLINK_OW_READ 0x22
|
||||
#define SYSLINK_OW_WRITE 0x23
|
||||
|
||||
// Limited by the CRTP packet which is limited by the ESB protocol used by the NRF
|
||||
#define SYSLINK_MAX_DATA_LEN 32
|
||||
|
||||
#define SYSLINK_RADIO_RATE_250K 0
|
||||
#define SYSLINK_RADIO_RATE_1M 1
|
||||
#define SYSLINK_RADIO_RATE_2M 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t data[SYSLINK_MAX_DATA_LEN];
|
||||
uint8_t cksum[2];
|
||||
} __attribute__((packed)) syslink_message_t;
|
||||
|
||||
|
||||
#define OW_SIZE 112
|
||||
#define OW_READ_BLOCK 29
|
||||
#define OW_WRITE_BLOCK 26 // TODO: Use even, but can be up to 27
|
||||
|
||||
typedef struct {
|
||||
uint8_t nmems;
|
||||
} __attribute__((packed)) syslink_ow_scan_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t family; // Should by 0x0D for most chips
|
||||
uint8_t sn[6];
|
||||
uint8_t crc;
|
||||
} __attribute__((packed)) syslink_ow_id_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t idx;
|
||||
uint8_t id[8];
|
||||
} __attribute__((packed)) syslink_ow_getinfo_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t idx;
|
||||
uint16_t addr;
|
||||
uint8_t data[OW_READ_BLOCK];
|
||||
} __attribute__((packed)) syslink_ow_read_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t idx;
|
||||
uint16_t addr;
|
||||
uint16_t length;
|
||||
uint8_t data[OW_WRITE_BLOCK];
|
||||
} __attribute__((packed)) syslink_ow_write_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
SYSLINK_STATE_START = 0,
|
||||
SYSLINK_STATE_TYPE,
|
||||
SYSLINK_STATE_LENGTH,
|
||||
SYSLINK_STATE_DATA,
|
||||
SYSLINK_STATE_CKSUM
|
||||
} SYSLINK_STATE;
|
||||
|
||||
typedef struct {
|
||||
SYSLINK_STATE state;
|
||||
int index;
|
||||
|
||||
} syslink_parse_state;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void syslink_parse_init(syslink_parse_state *state);
|
||||
|
||||
// Returns true if a full message was parsed
|
||||
extern int syslink_parse_char(syslink_parse_state *state, char c, syslink_message_t *msg);
|
||||
|
||||
extern void syslink_compute_cksum(syslink_message_t *msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,162 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @file syslink_bridge.cpp
|
||||
*
|
||||
* Character device for talking to the radio as a plain serial port
|
||||
*/
|
||||
|
||||
#include "syslink_main.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
|
||||
SyslinkBridge::SyslinkBridge(Syslink *link) :
|
||||
CDev("/dev/bridge0"),
|
||||
_link(link),
|
||||
_readbuffer(16, sizeof(crtp_message_t))
|
||||
{
|
||||
_msg_to_send.header = 0;
|
||||
_msg_to_send.size = sizeof(_msg_to_send.header);
|
||||
_msg_to_send.port = CRTP_PORT_MAVLINK;
|
||||
_msg_to_send_size_remaining = CRTP_MAX_DATA_SIZE - 1; // to send 30 bytes of data
|
||||
//ideally _msg_to_send.data size should be CRTP_MAX_DATA_SIZE but cfbridge does not receive 31 bytes of data due to a bug somewhere
|
||||
}
|
||||
|
||||
int
|
||||
SyslinkBridge::init()
|
||||
{
|
||||
int ret = CDev::init();
|
||||
|
||||
/* if init failed, bail now */
|
||||
if (ret != OK) {
|
||||
PX4_DEBUG("CDev init failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
pollevent_t
|
||||
SyslinkBridge::poll_state(struct file *filp)
|
||||
{
|
||||
pollevent_t state = 0;
|
||||
|
||||
if (!_readbuffer.empty()) {
|
||||
state |= POLLIN;
|
||||
}
|
||||
|
||||
if (_link->_writebuffer.space() > 0) {
|
||||
state |= POLLOUT;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SyslinkBridge::read(struct file *filp, char *buffer, size_t buflen)
|
||||
{
|
||||
int nread = 0;
|
||||
crtp_message_t msg;
|
||||
|
||||
while (!_readbuffer.empty() && buflen >= sizeof(CRTP_MAX_DATA_SIZE)) {
|
||||
_readbuffer.get(&msg, sizeof(msg));
|
||||
int size = msg.size - sizeof(msg.header);
|
||||
memcpy(buffer, &msg.data, size);
|
||||
|
||||
nread += size;
|
||||
buffer += size;
|
||||
buflen -= size;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SyslinkBridge::write(struct file *filp, const char *buffer, size_t buflen)
|
||||
{
|
||||
int buflen_rem = buflen;
|
||||
|
||||
while (buflen_rem > 0) {
|
||||
|
||||
int datasize = MIN(_msg_to_send_size_remaining, buflen_rem);
|
||||
_msg_to_send.size += datasize;
|
||||
memcpy(&_msg_to_send.data[CRTP_MAX_DATA_SIZE - 1 - _msg_to_send_size_remaining], buffer, datasize);
|
||||
|
||||
buffer += datasize;
|
||||
_msg_to_send_size_remaining -= datasize;
|
||||
buflen_rem -= datasize;
|
||||
|
||||
|
||||
if (_msg_to_send_size_remaining == 0) {
|
||||
|
||||
if (_link->_writebuffer.force(&_msg_to_send, sizeof(crtp_message_t))) {
|
||||
PX4_WARN("write buffer overflow");
|
||||
}
|
||||
|
||||
_msg_to_send.size = sizeof(_msg_to_send.header);
|
||||
_msg_to_send_size_remaining = CRTP_MAX_DATA_SIZE - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return buflen;
|
||||
}
|
||||
|
||||
int
|
||||
SyslinkBridge::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
// All termios commands should be silently ignored as they are handled
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case FIONSPACE:
|
||||
*((int *) arg) = _link->_writebuffer.space() * CRTP_MAX_DATA_SIZE;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
/* give it to the superclass */
|
||||
CDev::ioctl(filp, cmd, arg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SyslinkBridge::pipe_message(crtp_message_t *msg)
|
||||
{
|
||||
_readbuffer.force(msg, sizeof(msg->size) + msg->size);
|
||||
poll_notify(POLLIN);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,220 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <battery/battery.h>
|
||||
|
||||
#include <drivers/device/device.h>
|
||||
#include <drivers/device/ringbuffer.h>
|
||||
|
||||
#include <uORB/uORB.h>
|
||||
|
||||
#include "syslink.h"
|
||||
#include "crtp.h"
|
||||
|
||||
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
||||
|
||||
|
||||
typedef enum {
|
||||
BAT_DISCHARGING = 0,
|
||||
BAT_CHARGING = 1,
|
||||
BAT_CHARGED = 2
|
||||
} battery_state;
|
||||
|
||||
|
||||
class SyslinkBridge;
|
||||
class SyslinkMemory;
|
||||
|
||||
class Syslink
|
||||
{
|
||||
public:
|
||||
Syslink();
|
||||
|
||||
int start();
|
||||
|
||||
int set_datarate(uint8_t datarate);
|
||||
int set_channel(uint8_t channel);
|
||||
int set_address(uint64_t addr);
|
||||
|
||||
int is_good(int i) { return _params_ack[i] != 0; }
|
||||
|
||||
int pktrate;
|
||||
int nullrate;
|
||||
int rxrate;
|
||||
int txrate;
|
||||
|
||||
private:
|
||||
|
||||
friend class SyslinkBridge;
|
||||
friend class SyslinkMemory;
|
||||
|
||||
int open_serial(const char *dev);
|
||||
|
||||
void handle_message(syslink_message_t *msg);
|
||||
void handle_raw(syslink_message_t *sys);
|
||||
void handle_radio(syslink_message_t *sys);
|
||||
void handle_bootloader(syslink_message_t *sys);
|
||||
|
||||
// Handles other types of messages that we don't really care about, but
|
||||
// will be maintained with the bare minimum implementation for supporting
|
||||
// other crazyflie libraries
|
||||
void handle_raw_other(syslink_message_t *sys);
|
||||
|
||||
int send_bytes(const void *data, size_t len);
|
||||
|
||||
// Checksums and transmits a syslink message
|
||||
int send_message(syslink_message_t *msg);
|
||||
|
||||
int send_queued_raw_message();
|
||||
|
||||
void update_params(bool force_set);
|
||||
|
||||
int _syslink_task;
|
||||
bool _task_running;
|
||||
bool _bootloader_mode;
|
||||
|
||||
int _count;
|
||||
int _null_count;
|
||||
int _count_in;
|
||||
int _count_out;
|
||||
hrt_abstime _lasttime;
|
||||
hrt_abstime _lasttxtime; // Last time a radio message was sent
|
||||
hrt_abstime _lastrxtime; // Last time a radio message was recieved
|
||||
|
||||
int _fd;
|
||||
|
||||
// For receiving raw syslink messages to send from other processes
|
||||
ringbuffer::RingBuffer _queue;
|
||||
|
||||
// Stores data that was needs to be written as a raw message
|
||||
ringbuffer::RingBuffer _writebuffer;
|
||||
SyslinkBridge *_bridge;
|
||||
SyslinkMemory *_memory;
|
||||
|
||||
int _params_sub;
|
||||
|
||||
// Current parameter values
|
||||
int32_t _channel, _rate;
|
||||
uint64_t _addr;
|
||||
hrt_abstime _params_update[3]; // Time at which the parameters were updated
|
||||
hrt_abstime _params_ack[3]; // Time at which the parameters were acknowledged by the nrf module
|
||||
|
||||
orb_advert_t _battery_pub;
|
||||
orb_advert_t _rc_pub;
|
||||
orb_advert_t _cmd_pub;
|
||||
|
||||
struct battery_status_s _battery_status;
|
||||
|
||||
Battery _battery;
|
||||
|
||||
int32_t _rssi;
|
||||
battery_state _bstate;
|
||||
|
||||
px4_sem_t memory_sem;
|
||||
|
||||
syslink_message_t memory_msg;
|
||||
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
|
||||
void task_main();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class SyslinkBridge : public cdev::CDev
|
||||
{
|
||||
|
||||
public:
|
||||
SyslinkBridge(Syslink *link);
|
||||
virtual ~SyslinkBridge() = default;
|
||||
|
||||
virtual int init();
|
||||
|
||||
virtual ssize_t read(struct file *filp, char *buffer, size_t buflen);
|
||||
virtual ssize_t write(struct file *filp, const char *buffer, size_t buflen);
|
||||
virtual int ioctl(struct file *filp, int cmd, unsigned long arg);
|
||||
|
||||
// Makes the message available for reading to processes reading from the bridge
|
||||
void pipe_message(crtp_message_t *msg);
|
||||
|
||||
protected:
|
||||
|
||||
virtual pollevent_t poll_state(struct file *filp);
|
||||
|
||||
private:
|
||||
|
||||
Syslink *_link;
|
||||
|
||||
// Stores data that was received from syslink but not yet read by another driver
|
||||
ringbuffer::RingBuffer _readbuffer;
|
||||
|
||||
crtp_message_t _msg_to_send;
|
||||
int _msg_to_send_size_remaining;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class SyslinkMemory : public cdev::CDev
|
||||
{
|
||||
|
||||
public:
|
||||
SyslinkMemory(Syslink *link);
|
||||
virtual ~SyslinkMemory() = default;
|
||||
|
||||
virtual int init();
|
||||
|
||||
virtual ssize_t read(struct file *filp, char *buffer, size_t buflen);
|
||||
virtual ssize_t write(struct file *filp, const char *buffer, size_t buflen);
|
||||
virtual int ioctl(struct file *filp, int cmd, unsigned long arg);
|
||||
|
||||
private:
|
||||
friend class Syslink;
|
||||
|
||||
Syslink *_link;
|
||||
|
||||
int _activeI;
|
||||
|
||||
syslink_message_t msgbuf;
|
||||
|
||||
uint8_t scan();
|
||||
void getinfo(int i);
|
||||
|
||||
int read(int i, uint16_t addr, char *buf, int length);
|
||||
int write(int i, uint16_t addr, const char *buf, int length);
|
||||
|
||||
void sendAndWait();
|
||||
|
||||
};
|
||||
@@ -0,0 +1,170 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "syslink_main.h"
|
||||
|
||||
#include "drv_deck.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
||||
SyslinkMemory::SyslinkMemory(Syslink *link) :
|
||||
CDev(DECK_DEVICE_PATH),
|
||||
_link(link),
|
||||
_activeI(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SyslinkMemory::init()
|
||||
{
|
||||
int ret = CDev::init();
|
||||
|
||||
/* if init failed, bail now */
|
||||
if (ret != OK) {
|
||||
PX4_DEBUG("CDev init failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SyslinkMemory::read(struct file *filp, char *buffer, size_t buflen)
|
||||
{
|
||||
return read(_activeI, 0, buffer, buflen);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
SyslinkMemory::write(struct file *filp, const char *buffer, size_t buflen)
|
||||
{
|
||||
// For now, unsupported
|
||||
return -1;
|
||||
// return buflen;
|
||||
}
|
||||
|
||||
int
|
||||
SyslinkMemory::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case DECKIOGNUM:
|
||||
*((int *) arg) = scan();
|
||||
return 0;
|
||||
|
||||
case DECKIOSNUM:
|
||||
_activeI = *((int *) arg);
|
||||
return 0;
|
||||
|
||||
case DECKIOID: {
|
||||
syslink_ow_getinfo_t *data = (syslink_ow_getinfo_t *) &msgbuf.data;
|
||||
getinfo(_activeI);
|
||||
*((uint8_t **)arg) = data->id;
|
||||
return 8;
|
||||
}
|
||||
|
||||
default:
|
||||
CDev::ioctl(filp, cmd, arg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
SyslinkMemory::scan()
|
||||
{
|
||||
syslink_ow_scan_t *data = (syslink_ow_scan_t *) &msgbuf.data;
|
||||
msgbuf.type = SYSLINK_OW_SCAN;
|
||||
msgbuf.length = 0;
|
||||
sendAndWait();
|
||||
|
||||
return data->nmems;
|
||||
}
|
||||
|
||||
void
|
||||
SyslinkMemory::getinfo(int i)
|
||||
{
|
||||
syslink_ow_getinfo_t *data = (syslink_ow_getinfo_t *) &msgbuf.data;
|
||||
msgbuf.type = SYSLINK_OW_GETINFO;
|
||||
msgbuf.length = 1;
|
||||
data->idx = i;
|
||||
sendAndWait();
|
||||
}
|
||||
|
||||
int
|
||||
SyslinkMemory::read(int i, uint16_t addr, char *buf, int length)
|
||||
{
|
||||
syslink_ow_read_t *data = (syslink_ow_read_t *) &msgbuf.data;
|
||||
msgbuf.type = SYSLINK_OW_READ;
|
||||
|
||||
int nread = 0;
|
||||
|
||||
while (nread < length) {
|
||||
|
||||
msgbuf.length = 3;
|
||||
data->idx = i;
|
||||
data->addr = addr;
|
||||
sendAndWait();
|
||||
|
||||
// Number of bytes actually read
|
||||
int n = MIN(length - nread, msgbuf.length - 3);
|
||||
|
||||
if (n == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(buf, data->data, n);
|
||||
nread += n;
|
||||
buf += n;
|
||||
addr += n;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
int
|
||||
SyslinkMemory::write(int i, uint16_t addr, const char *buf, int length)
|
||||
{
|
||||
// TODO: Unimplemented
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
SyslinkMemory::sendAndWait()
|
||||
{
|
||||
// TODO: Force the syslink thread to wake up
|
||||
_link->_queue.force(&msgbuf, sizeof(msgbuf));
|
||||
px4_sem_wait(&_link->memory_sem);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. 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 PX4 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 THE
|
||||
* COPYRIGHT OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file syslink_params.c
|
||||
*
|
||||
* Parameters defined by the syslink module and the exposed NRF51 radio
|
||||
*
|
||||
* @author Dennis Shtatnov <densht@gmail.com>
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
|
||||
/**
|
||||
* Operating channel of the NRF51
|
||||
*
|
||||
* @min 0
|
||||
* @max 125
|
||||
* @group Syslink
|
||||
*/
|
||||
PARAM_DEFINE_INT32(SLNK_RADIO_CHAN, 80);
|
||||
|
||||
/**
|
||||
* Operating datarate of the NRF51
|
||||
*
|
||||
* @min 0
|
||||
* @max 2
|
||||
* @group Syslink
|
||||
*/
|
||||
PARAM_DEFINE_INT32(SLNK_RADIO_RATE, 2);
|
||||
|
||||
/**
|
||||
* Operating address of the NRF51 (most significant byte)
|
||||
*
|
||||
* @group Syslink
|
||||
*/
|
||||
PARAM_DEFINE_INT32(SLNK_RADIO_ADDR1, 231); // 0xE7
|
||||
|
||||
/**
|
||||
* Operating address of the NRF51 (least significant 4 bytes)
|
||||
*
|
||||
* @group Syslink
|
||||
*/
|
||||
PARAM_DEFINE_INT32(SLNK_RADIO_ADDR2, 3890735079); // 0xE7E7E7E7
|
||||
Reference in New Issue
Block a user