Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • e-24/public/ahoi/firmware
1 result
Show changes
Commits on Source (2)
BSD 3-Clause License
Copyright (c) 2022, Hamburg University of Technology (TUHH).
Copyright (c) 2023, Hamburg University of Technology (TUHH).
All rights reserved.
Redistribution and use in source and binary forms, with or without
......
/**
* Copyright 2016-2021
* Copyright 2016-2023
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......@@ -64,6 +64,7 @@
#include "csrc/aci_test_freq.c"
#include "csrc/aci_test_sweep.c"
#include "csrc/aci_test_noise.c"
#include "csrc/aci_test_sound.c"
#include "csrc/aci_powerlevel.c"
#include "csrc/aci_rxlevel.c"
#include "csrc/aci_packetstat.c"
......@@ -111,6 +112,7 @@ cmdTbl[ACI_TYPE_RANGINGDELAY-PACKET_TYPE_CMD_OFFSET] = aci_rangingdelay_processC
cmdTbl[ACI_TYPE_TEST_FREQ-PACKET_TYPE_CMD_OFFSET] = aci_test_freq_processCmd;
cmdTbl[ACI_TYPE_TEST_SWEEP-PACKET_TYPE_CMD_OFFSET] = aci_test_sweep_processCmd;
cmdTbl[ACI_TYPE_TEST_NOISE-PACKET_TYPE_CMD_OFFSET] = aci_test_noise_processCmd;
cmdTbl[ACI_TYPE_TEST_SOUND-PACKET_TYPE_CMD_OFFSET] = aci_test_sound_processCmd;
cmdTbl[ACI_TYPE_POWERLEVEL-PACKET_TYPE_CMD_OFFSET] = aci_powerlevel_processCmd;
cmdTbl[ACI_TYPE_RXLEVEL-PACKET_TYPE_CMD_OFFSET] = aci_rxlevel_processCmd;
cmdTbl[ACI_TYPE_PACKETSTAT-PACKET_TYPE_CMD_OFFSET] = aci_packetstat_processCmd;
......@@ -146,6 +148,7 @@ rspTbl[ACI_TYPE_RANGINGDELAY-PACKET_TYPE_CMD_OFFSET] = aci_rangingdelay_fillRepl
rspTbl[ACI_TYPE_TEST_FREQ-PACKET_TYPE_CMD_OFFSET] = aci_test_freq_fillReply;
rspTbl[ACI_TYPE_TEST_SWEEP-PACKET_TYPE_CMD_OFFSET] = aci_test_sweep_fillReply;
rspTbl[ACI_TYPE_TEST_NOISE-PACKET_TYPE_CMD_OFFSET] = aci_test_noise_fillReply;
rspTbl[ACI_TYPE_TEST_SOUND-PACKET_TYPE_CMD_OFFSET] = aci_test_sound_fillReply;
rspTbl[ACI_TYPE_POWERLEVEL-PACKET_TYPE_CMD_OFFSET] = aci_powerlevel_fillReply;
rspTbl[ACI_TYPE_RXLEVEL-PACKET_TYPE_CMD_OFFSET] = aci_rxlevel_fillReply;
rspTbl[ACI_TYPE_PACKETSTAT-PACKET_TYPE_CMD_OFFSET] = aci_packetstat_fillReply;
......
/**
* Copyright 2016-2020
* Copyright 2016-2023
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......
/**
* Copyright 2016-2021
* Copyright 2016-2023
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......@@ -64,6 +64,7 @@ ACI_TYPE_RANGINGDELAY = 0xA8,
ACI_TYPE_TEST_FREQ = 0xB1,
ACI_TYPE_TEST_SWEEP = 0xB2,
ACI_TYPE_TEST_NOISE = 0xB3,
ACI_TYPE_TEST_SOUND = 0xB4,
ACI_TYPE_POWERLEVEL = 0xB8,
ACI_TYPE_RXLEVEL = 0xB9,
ACI_TYPE_PACKETSTAT = 0xC0,
......
/**
* Copyright 2016-2019
* Copyright 2016-2023
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......
......@@ -35,6 +35,7 @@ RANGINGDELAY = 0xA8 // setup ranging delay
TEST_FREQ = 0xB1 // send frequency test signal
TEST_SWEEP = 0xB2 // send all frequencies as sequential test signal
TEST_NOISE = 0xB3 // send all frequencies as simultaneous signal
TEST_SOUND = 0xB4 // send a low-frequency (audible sound)
POWERLEVEL = 0xB8 // get power value
RXLEVEL = 0xB9 // get strength of preamble in noise
......
/**
* Copyright 2023
*
* Bernd-Christian Renner, and
* Hamburg University of Technology (TUHH).
* 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 the copyright holder 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
* 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.
*/
#include "aci.h"
#include "aci/types/test_sound_cmd.h"
#include "aci_test_sound.h"
#include <hal_adda.h>
/**************************************************************************
* private prototypes
*/
/**************************************************************************
* variables
*/
/*
* This file was auto-generated by genFsk.py for the range 4500:1000:4500 Hz
*/
static const fp16_t FREQ_TEST_SOUND[TX_FACTOR * SAMPLES_PER_SYMBOL] = {
0x0000, 0x0964, 0x1294, 0x1b5d, 0x238e, 0x2afa, 0x3179, 0x36e5,
0x3b20, 0x3e14, 0x3fb1, 0x3fec, 0x3ec5, 0x3c42, 0x3871, 0x3367,
0x2d41, 0x261f, 0x1e2b, 0x158f, 0x0c7c, 0x0323, 0xf9bb, 0xf074,
0xe783, 0xdf19, 0xd767, 0xd095, 0xcaca, 0xc626, 0xc2c2, 0xc0b2,
0xc000, 0xc0b2, 0xc2c2, 0xc626, 0xcaca, 0xd095, 0xd767, 0xdf19,
0xe783, 0xf074, 0xf9bb, 0x0323, 0x0c7c, 0x158f, 0x1e2b, 0x261f,
0x2d41, 0x3367, 0x3871, 0x3c42, 0x3ec5, 0x3fec, 0x3fb1, 0x3e14,
0x3b20, 0x36e5, 0x3179, 0x2afa, 0x238e, 0x1b5d, 0x1294, 0x0964,
0x0000, 0xf69c, 0xed6c, 0xe4a3, 0xdc72, 0xd506, 0xce87, 0xc91b,
0xc4e0, 0xc1ec, 0xc04f, 0xc014, 0xc13b, 0xc3be, 0xc78f, 0xcc99,
0xd2bf, 0xd9e1, 0xe1d5, 0xea71, 0xf384, 0xfcdd, 0x0645, 0x0f8c,
0x187d, 0x20e7, 0x2899, 0x2f6b, 0x3536, 0x39da, 0x3d3e, 0x3f4e,
0x4000, 0x3f4e, 0x3d3e, 0x39da, 0x3536, 0x2f6b, 0x2899, 0x20e7,
0x187d, 0x0f8c, 0x0645, 0xfcdd, 0xf384, 0xea71, 0xe1d5, 0xd9e1,
0xd2bf, 0xcc99, 0xc78f, 0xc3be, 0xc13b, 0xc014, 0xc04f, 0xc1ec,
0xc4e0, 0xc91b, 0xce87, 0xd506, 0xdc72, 0xe4a3, 0xed6c, 0xf69c,
0x0000, 0x0964, 0x1294, 0x1b5d, 0x238e, 0x2afa, 0x3179, 0x36e5,
0x3b20, 0x3e14, 0x3fb1, 0x3fec, 0x3ec5, 0x3c42, 0x3871, 0x3367,
0x2d41, 0x261f, 0x1e2b, 0x158f, 0x0c7c, 0x0323, 0xf9bb, 0xf074,
0xe783, 0xdf19, 0xd767, 0xd095, 0xcaca, 0xc626, 0xc2c2, 0xc0b2,
0xc000, 0xc0b2, 0xc2c2, 0xc626, 0xcaca, 0xd095, 0xd767, 0xdf19,
0xe783, 0xf074, 0xf9bb, 0x0323, 0x0c7c, 0x158f, 0x1e2b, 0x261f,
0x2d41, 0x3367, 0x3871, 0x3c42, 0x3ec5, 0x3fec, 0x3fb1, 0x3e14,
0x3b20, 0x36e5, 0x3179, 0x2afa, 0x238e, 0x1b5d, 0x1294, 0x0964,
0x0000, 0xf69c, 0xed6c, 0xe4a3, 0xdc72, 0xd506, 0xce87, 0xc91b,
0xc4e0, 0xc1ec, 0xc04f, 0xc014, 0xc13b, 0xc3be, 0xc78f, 0xcc99,
0xd2bf, 0xd9e1, 0xe1d5, 0xea71, 0xf384, 0xfcdd, 0x0645, 0x0f8c,
0x187d, 0x20e7, 0x2899, 0x2f6b, 0x3536, 0x39da, 0x3d3e, 0x3f4e,
0x4000, 0x3f4e, 0x3d3e, 0x39da, 0x3536, 0x2f6b, 0x2899, 0x20e7,
0x187d, 0x0f8c, 0x0645, 0xfcdd, 0xf384, 0xea71, 0xe1d5, 0xd9e1,
0xd2bf, 0xcc99, 0xc78f, 0xc3be, 0xc13b, 0xc014, 0xc04f, 0xc1ec,
0xc4e0, 0xc91b, 0xce87, 0xd506, 0xdc72, 0xe4a3, 0xed6c, 0xf69c,
0x0000, 0x0964, 0x1294, 0x1b5d, 0x238e, 0x2afa, 0x3179, 0x36e5,
0x3b20, 0x3e14, 0x3fb1, 0x3fec, 0x3ec5, 0x3c42, 0x3871, 0x3367,
0x2d41, 0x261f, 0x1e2b, 0x158f, 0x0c7c, 0x0323, 0xf9bb, 0xf074,
0xe783, 0xdf19, 0xd767, 0xd095, 0xcaca, 0xc626, 0xc2c2, 0xc0b2,
0xc000, 0xc0b2, 0xc2c2, 0xc626, 0xcaca, 0xd095, 0xd767, 0xdf19,
0xe783, 0xf074, 0xf9bb, 0x0323, 0x0c7c, 0x158f, 0x1e2b, 0x261f,
0x2d41, 0x3367, 0x3871, 0x3c42, 0x3ec5, 0x3fec, 0x3fb1, 0x3e14,
0x3b20, 0x36e5, 0x3179, 0x2afa, 0x238e, 0x1b5d, 0x1294, 0x0964,
0x0000, 0xf69c, 0xed6c, 0xe4a3, 0xdc72, 0xd506, 0xce87, 0xc91b,
0xc4e0, 0xc1ec, 0xc04f, 0xc014, 0xc13b, 0xc3be, 0xc78f, 0xcc99,
0xd2bf, 0xd9e1, 0xe1d5, 0xea71, 0xf384, 0xfcdd, 0x0645, 0x0f8c,
0x187d, 0x20e7, 0x2899, 0x2f6b, 0x3536, 0x39da, 0x3d3e, 0x3f4e,
0x4000, 0x3f4e, 0x3d3e, 0x39da, 0x3536, 0x2f6b, 0x2899, 0x20e7,
0x187d, 0x0f8c, 0x0645, 0xfcdd, 0xf384, 0xea71, 0xe1d5, 0xd9e1,
0xd2bf, 0xcc99, 0xc78f, 0xc3be, 0xc13b, 0xc014, 0xc04f, 0xc1ec,
0xc4e0, 0xc91b, 0xce87, 0xd506, 0xdc72, 0xe4a3, 0xed6c, 0xf69c,
0x0000, 0x0964, 0x1294, 0x1b5d, 0x238e, 0x2afa, 0x3179, 0x36e5,
0x3b20, 0x3e14, 0x3fb1, 0x3fec, 0x3ec5, 0x3c42, 0x3871, 0x3367,
0x2d41, 0x261f, 0x1e2b, 0x158f, 0x0c7c, 0x0323, 0xf9bb, 0xf074,
0xe783, 0xdf19, 0xd767, 0xd095, 0xcaca, 0xc626, 0xc2c2, 0xc0b2,
0xc000, 0xc0b2, 0xc2c2, 0xc626, 0xcaca, 0xd095, 0xd767, 0xdf19,
0xe783, 0xf074, 0xf9bb, 0x0323, 0x0c7c, 0x158f, 0x1e2b, 0x261f,
0x2d41, 0x3367, 0x3871, 0x3c42, 0x3ec5, 0x3fec, 0x3fb1, 0x3e14,
0x3b20, 0x36e5, 0x3179, 0x2afa, 0x238e, 0x1b5d, 0x1294, 0x0964,
0x0000, 0xf69c, 0xed6c, 0xe4a3, 0xdc72, 0xd506, 0xce87, 0xc91b,
0xc4e0, 0xc1ec, 0xc04f, 0xc014, 0xc13b, 0xc3be, 0xc78f, 0xcc99,
0xd2bf, 0xd9e1, 0xe1d5, 0xea71, 0xf384, 0xfcdd, 0x0645, 0x0f8c,
0x187d, 0x20e7, 0x2899, 0x2f6b, 0x3536, 0x39da, 0x3d3e, 0x3f4e,
0x4000, 0x3f4e, 0x3d3e, 0x39da, 0x3536, 0x2f6b, 0x2899, 0x20e7,
0x187d, 0x0f8c, 0x0645, 0xfcdd, 0xf384, 0xea71, 0xe1d5, 0xd9e1,
0xd2bf, 0xcc99, 0xc78f, 0xc3be, 0xc13b, 0xc014, 0xc04f, 0xc1ec,
0xc4e0, 0xc91b, 0xce87, 0xd506, 0xdc72, 0xe4a3, 0xed6c, 0xf69c };
/**************************************************************************
* private functions
*/
// determine number of symbols from duration in ms, round to nearest
#define MS_TO_SYMBOLS(t) ((MS_TO_TICKS(t) + SAMPLES_PER_SYMBOL / 2) / SAMPLES_PER_SYMBOL)
/**************************************************************************
* public functions
*/
void
aci_test_sound_processCmd(const mm_packet_t * pkt)
{
uint16_t i, j;
uint16_t dur;
aci_test_sound_cmd_t * p = (aci_test_sound_cmd_t *)pkt->payload;
// sanity check
if (pkt->header.len != sizeof(aci_test_sound_cmd_t)) {
return;
}
// obtain and check parameters
dur = MS_TO_SYMBOLS(10 * p->dur); // p->dur in 1/100 ms
if (dur < MS_TO_SYMBOLS(10)) {
dur = MS_TO_SYMBOLS(10);
} else if (dur > MS_TO_SYMBOLS(2500)) {
dur = MS_TO_SYMBOLS(2500);
}
// init tx mode
adda_activateTransmission();
// repeat symbol to match duration
for (j = 0; j < dur; j++) {
for (i = 0; i < TX_FACTOR*SAMPLES_PER_SYMBOL; i++) {
adda_setSample(FREQ_TEST_SOUND[i]);
}
}
adda_setNeutralSample();
// wait until transmitter runs out of samples
while (adda_hasSample()) {
;
}
// return to rx mode
adda_activateSampling();
}
uint8_t
aci_test_sound_fillReply(uint8_t * payload)
{
return 0;
}
/**
* Copyright 2023
*
* Bernd-Christian Renner, and
* Hamburg University of Technology (TUHH).
* 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 the copyright holder 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
* 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 ACI_TEST_SOUND_H
#define ACI_TEST_SOUND_H
#include "types.h"
/**
* send
*/
extern void
aci_test_sound_processCmd(const mm_packet_t * pkt);
extern uint8_t
aci_test_sound_fillReply(uint8_t * payload);
#endif /* ACI_TEST_NOISE_H */
typedef struct __attribute__ ((__packed__)) {
uint8_t dur; // hundreds of seconds (ca.)
} aci_test_sound_cmd_t;