mirror of
https://github.com/peterantypas/maiana.git
synced 2025-05-27 21:00:24 -07:00
Checkpoint
This commit is contained in:
parent
63e7c8cda4
commit
a7f1524689
@ -905,6 +905,8 @@
|
||||
|
||||
</option>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting.1148532259" name="Generate assembler listing (-Wa,-adhlns="$@.lst")" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.434150746" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
|
||||
</tool>
|
||||
@ -943,6 +945,8 @@
|
||||
|
||||
</option>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting.1222462616" name="Generate assembler listing (-Wa,-adhlns="$@.lst")" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.2090799641" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||
|
||||
</tool>
|
||||
@ -969,6 +973,8 @@
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.useprintffloat.1665988968" name="Use float with nano printf (-u _printf_float)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.useprintffloat" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap.1943968052" name="Print link map (-Xlinker --print-map)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.166504373" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
@ -1241,6 +1247,8 @@
|
||||
|
||||
</option>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting.1637376777" name="Generate assembler listing (-Wa,-adhlns="$@.lst")" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2109805397" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
|
||||
</tool>
|
||||
@ -1279,6 +1287,8 @@
|
||||
|
||||
</option>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting.2078718100" name="Generate assembler listing (-Wa,-adhlns="$@.lst")" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.asmlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1022917461" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||
|
||||
</tool>
|
||||
@ -1311,6 +1321,8 @@
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.strip.1180354308" name="Omit all symbol information (-s)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.strip" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap.1618924265" name="Print link map (-Xlinker --print-map)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.317754509" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
|
@ -57,8 +57,10 @@ public:
|
||||
void dispatch();
|
||||
private:
|
||||
EventQueue();
|
||||
QueueHandle_t mQueueHandle;
|
||||
StaticQueue_t mQueue;
|
||||
//QueueHandle_t mQueueHandle;
|
||||
//StaticQueue_t mQueue;
|
||||
CircularQueue<Event*> mISRQueue;
|
||||
CircularQueue<Event*> mTaskQueue;
|
||||
map<EventConsumer *, uint32_t> mConsumers;
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RXPACKET_HPP_
|
||||
@ -70,15 +70,19 @@ private:
|
||||
void addBit(uint8_t bit);
|
||||
void addBitCRC(uint8_t bit);
|
||||
private:
|
||||
uint8_t mPacket[MAX_AIS_RX_PACKET_SIZE/8+1];
|
||||
uint16_t mSize;
|
||||
uint16_t mCRC;
|
||||
mutable uint8_t mType;
|
||||
mutable uint8_t mRI;
|
||||
mutable uint32_t mMMSI;
|
||||
uint32_t mSlot;
|
||||
VHFChannel mChannel;
|
||||
uint8_t mRSSI;
|
||||
struct
|
||||
{
|
||||
uint8_t mPacket[MAX_AIS_RX_PACKET_SIZE/8+1];
|
||||
uint16_t mSize;
|
||||
uint16_t mCRC;
|
||||
mutable uint8_t mType;
|
||||
mutable uint8_t mRI;
|
||||
mutable uint32_t mMMSI;
|
||||
uint32_t mSlot;
|
||||
VHFChannel mChannel;
|
||||
uint8_t mRSSI;
|
||||
}
|
||||
mState;
|
||||
};
|
||||
|
||||
#endif /* RXPACKET_HPP_ */
|
||||
|
@ -49,7 +49,6 @@ public:
|
||||
void transmitCW(VHFChannel channel);
|
||||
VHFChannel alternateChannel(VHFChannel channel);
|
||||
|
||||
void noiseFloorUpdated(VHFChannel channel, uint8_t rssi);
|
||||
|
||||
private:
|
||||
RadioManager();
|
||||
|
@ -47,9 +47,9 @@ public:
|
||||
virtual void startReceiving(VHFChannel channel);
|
||||
virtual void onBitClock();
|
||||
virtual void timeSlotStarted(uint32_t slot);
|
||||
void startListening(VHFChannel channel);
|
||||
void switchToChannel(VHFChannel channel);
|
||||
private:
|
||||
protected:
|
||||
void startListening(VHFChannel channel);
|
||||
bool addBit(uint8_t bit);
|
||||
void resetBitScanner();
|
||||
uint8_t reportRSSI();
|
||||
|
@ -47,7 +47,6 @@ public:
|
||||
void startListening(VHFChannel channel);
|
||||
void transmitCW(VHFChannel channel);
|
||||
void processEvent(const Event &);
|
||||
void noiseFloorUpdated(VHFChannel channel, uint8_t rssi);
|
||||
|
||||
protected:
|
||||
void configure();
|
||||
@ -61,7 +60,7 @@ private:
|
||||
TXPacket *mTXPacket;
|
||||
time_t mUTC;
|
||||
time_t mLastTXTime;
|
||||
map<VHFChannel, uint8_t> mNoiseFloorCache;
|
||||
//map<VHFChannel, uint8_t> mNoiseFloorCache;
|
||||
};
|
||||
|
||||
#endif /* TRANSCEIVER_HPP_ */
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#define EVENT_QUEUE_SIZE 50
|
||||
|
||||
static Event* __queue[EVENT_QUEUE_SIZE];
|
||||
//static Event* __queue[EVENT_QUEUE_SIZE];
|
||||
|
||||
EventQueue &EventQueue::instance()
|
||||
{
|
||||
@ -40,26 +40,29 @@ EventQueue &EventQueue::instance()
|
||||
}
|
||||
|
||||
EventQueue::EventQueue()
|
||||
: mISRQueue(25), mTaskQueue(10)
|
||||
{
|
||||
}
|
||||
|
||||
void EventQueue::init()
|
||||
{
|
||||
mQueueHandle = xQueueCreateStatic(EVENT_QUEUE_SIZE, sizeof(Event*), (uint8_t*)&__queue[0], &mQueue);
|
||||
configASSERT(mQueueHandle);
|
||||
//mQueueHandle = xQueueCreateStatic(EVENT_QUEUE_SIZE, sizeof(Event*), (uint8_t*)&__queue[0], &mQueue);
|
||||
//configASSERT(mQueueHandle);
|
||||
}
|
||||
|
||||
void EventQueue::push(Event *e)
|
||||
{
|
||||
if ( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING )
|
||||
return;
|
||||
//if ( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING )
|
||||
//return;
|
||||
|
||||
BaseType_t xHighPriorityTaskWoken = pdTRUE;
|
||||
//BaseType_t xHighPriorityTaskWoken = pdTRUE;
|
||||
if ( Utils::inISR() )
|
||||
{
|
||||
//bsp_signal_high();
|
||||
xQueueSendFromISR(mQueueHandle, &e, &xHighPriorityTaskWoken);
|
||||
//xQueueSendFromISR(mQueueHandle, &e, &xHighPriorityTaskWoken);
|
||||
//bsp_signal_low();
|
||||
if ( !mISRQueue.push(e) )
|
||||
EventPool::instance().deleteEvent(e);
|
||||
#if 0
|
||||
if ( xHighPriorityTaskWoken )
|
||||
portYIELD_FROM_ISR(xHighPriorityTaskWoken);
|
||||
@ -67,7 +70,9 @@ void EventQueue::push(Event *e)
|
||||
}
|
||||
else
|
||||
{
|
||||
xQueueSend(mQueueHandle, &e, 0);
|
||||
//xQueueSend(mQueueHandle, &e, 0);
|
||||
if ( !mTaskQueue.push(e) )
|
||||
EventPool::instance().deleteEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +94,21 @@ void EventQueue::dispatch()
|
||||
{
|
||||
Event *e = nullptr;
|
||||
|
||||
while ( xQueueReceive(mQueueHandle, &e, 10) == pdTRUE )
|
||||
//while ( xQueueReceive(mQueueHandle, &e, 10) == pdTRUE )
|
||||
while (mISRQueue.pop(e))
|
||||
{
|
||||
for ( map<EventConsumer*, uint32_t>::iterator c = mConsumers.begin(); c != mConsumers.end(); ++c )
|
||||
{
|
||||
if ( c->second & e->type )
|
||||
{
|
||||
c->first->processEvent(*e);
|
||||
}
|
||||
}
|
||||
|
||||
EventPool::instance().deleteEvent(e);
|
||||
}
|
||||
|
||||
while (mTaskQueue.pop(e))
|
||||
{
|
||||
for ( map<EventConsumer*, uint32_t>::iterator c = mConsumers.begin(); c != mConsumers.end(); ++c )
|
||||
{
|
||||
|
@ -214,12 +214,11 @@ void GPS::parseSentence(const char *buff)
|
||||
#ifdef MULTIPLEXED_OUTPUT
|
||||
DataTerminal::instance ().write ("NMEA", buff);
|
||||
#else
|
||||
//
|
||||
DataTerminal::instance().write(buff);
|
||||
#endif
|
||||
|
||||
if (sentence.code ().find ("RMC") == 2)
|
||||
{
|
||||
DataTerminal::instance().write(buff);
|
||||
const vector<string> &fields = sentence.fields ();
|
||||
|
||||
/*
|
||||
|
@ -15,13 +15,15 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "RXPacket.hpp"
|
||||
|
||||
//#define memcpy my_on_steroids_memcpy
|
||||
|
||||
|
||||
RXPacket::RXPacket ()
|
||||
{
|
||||
@ -34,16 +36,18 @@ RXPacket::~RXPacket ()
|
||||
|
||||
void RXPacket::setChannel(VHFChannel channel)
|
||||
{
|
||||
mChannel = channel;
|
||||
mState.mChannel = channel;
|
||||
}
|
||||
|
||||
VHFChannel RXPacket::channel() const
|
||||
{
|
||||
return mChannel;
|
||||
return mState.mChannel;
|
||||
}
|
||||
|
||||
#if 1
|
||||
RXPacket::RXPacket(const RXPacket ©)
|
||||
{
|
||||
#if 0
|
||||
memcpy(mPacket, copy.mPacket, sizeof mPacket);
|
||||
mSize = copy.mSize;
|
||||
mCRC = copy.mCRC;
|
||||
@ -53,10 +57,13 @@ RXPacket::RXPacket(const RXPacket ©)
|
||||
mMMSI = copy.mMMSI;
|
||||
mSlot = copy.mSlot;
|
||||
mChannel = copy.mChannel;
|
||||
#endif
|
||||
memcpy(&mState, ©.mState, sizeof mState);
|
||||
}
|
||||
|
||||
RXPacket &RXPacket::operator =(const RXPacket ©)
|
||||
{
|
||||
#if 0
|
||||
memcpy(mPacket, copy.mPacket, sizeof mPacket);
|
||||
mSize = copy.mSize;
|
||||
mCRC = copy.mCRC;
|
||||
@ -66,11 +73,16 @@ RXPacket &RXPacket::operator =(const RXPacket ©)
|
||||
mMMSI = copy.mMMSI;
|
||||
mChannel = copy.mChannel;
|
||||
mSlot = copy.mSlot;
|
||||
#endif
|
||||
memcpy(&mState, ©.mState, sizeof mState);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
void RXPacket::reset()
|
||||
{
|
||||
mState = {{0}, 0, 0xffff, 0, 0, 0, 0xffffffff, CH_18, 0};
|
||||
#if 0
|
||||
mType = 0;
|
||||
mRI = 0;
|
||||
mMMSI = 0;
|
||||
@ -79,52 +91,53 @@ void RXPacket::reset()
|
||||
mSlot = 0xffffffff;
|
||||
mRSSI = 0;
|
||||
memset(mPacket, 0, sizeof mPacket);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RXPacket::setSlot(uint32_t slot)
|
||||
{
|
||||
mSlot = slot;
|
||||
mState.mSlot = slot;
|
||||
}
|
||||
|
||||
uint32_t RXPacket::slot() const
|
||||
{
|
||||
return mSlot;
|
||||
return mState.mSlot;
|
||||
}
|
||||
|
||||
|
||||
void RXPacket::setRSSI(uint8_t rssi)
|
||||
{
|
||||
mRSSI = rssi;
|
||||
mState.mRSSI = rssi;
|
||||
}
|
||||
|
||||
uint8_t RXPacket::rssi() const
|
||||
{
|
||||
return mRSSI;
|
||||
return mState.mRSSI;
|
||||
}
|
||||
|
||||
|
||||
void RXPacket::addBit(uint8_t bit)
|
||||
{
|
||||
ASSERT(mSize < MAX_AIS_RX_PACKET_SIZE);
|
||||
//ASSERT(mSize < MAX_AIS_RX_PACKET_SIZE);
|
||||
|
||||
uint16_t index = mSize / 8;
|
||||
uint8_t offset = mSize % 8;
|
||||
uint16_t index = mState.mSize / 8;
|
||||
uint8_t offset = mState.mSize % 8;
|
||||
|
||||
if ( bit )
|
||||
mPacket[index] |= ( 1 << offset );
|
||||
mState.mPacket[index] |= ( 1 << offset );
|
||||
else
|
||||
mPacket[index] &= ~( 1 << offset );
|
||||
mState.mPacket[index] &= ~( 1 << offset );
|
||||
|
||||
++mSize;
|
||||
++mState.mSize;
|
||||
}
|
||||
|
||||
uint8_t RXPacket::bit(uint16_t pos) const
|
||||
{
|
||||
if ( pos < mSize ) {
|
||||
if ( pos < mState.mSize ) {
|
||||
uint16_t index = pos / 8;
|
||||
uint8_t offset = pos % 8;
|
||||
|
||||
return (mPacket[index] & (1 << offset)) != 0;
|
||||
return (mState.mPacket[index] & (1 << offset)) != 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
@ -145,17 +158,17 @@ uint32_t RXPacket::bits(uint16_t pos, uint8_t count) const
|
||||
|
||||
void RXPacket::addBitCRC(uint8_t data)
|
||||
{
|
||||
if ( (data ^ mCRC) & 0x0001 )
|
||||
mCRC = (mCRC >> 1) ^ 0x8408;
|
||||
if ( (data ^ mState.mCRC) & 0x0001 )
|
||||
mState.mCRC = (mState.mCRC >> 1) ^ 0x8408;
|
||||
else
|
||||
mCRC >>= 1;
|
||||
mState.mCRC >>= 1;
|
||||
}
|
||||
|
||||
void RXPacket::addByte(uint8_t byte)
|
||||
{
|
||||
// The payload is LSB (inverted MSB bytes). This brings it back into MSB format
|
||||
|
||||
addBit(byte & 0x01);
|
||||
addBit(byte & 0x01);
|
||||
addBit(byte & 0x02);
|
||||
addBit(byte & 0x04);
|
||||
addBit(byte & 0x08);
|
||||
@ -179,7 +192,7 @@ void RXPacket::addByte(uint8_t byte)
|
||||
|
||||
uint16_t RXPacket::size() const
|
||||
{
|
||||
return mSize;
|
||||
return mState.mSize;
|
||||
}
|
||||
|
||||
|
||||
@ -190,26 +203,26 @@ bool RXPacket::isBad() const
|
||||
*/
|
||||
|
||||
//return mSize < 184;
|
||||
return mSize < 32;
|
||||
return mState.mSize < 32;
|
||||
}
|
||||
|
||||
uint16_t RXPacket::crc() const
|
||||
{
|
||||
return mCRC;
|
||||
return mState.mCRC;
|
||||
}
|
||||
|
||||
void RXPacket::discardCRC()
|
||||
{
|
||||
if ( mCRC == 0xffff )
|
||||
if ( mState.mCRC == 0xffff )
|
||||
return;
|
||||
mSize -= 16;
|
||||
mCRC = 0xffff;
|
||||
mState.mSize -= 16;
|
||||
mState.mCRC = 0xffff;
|
||||
|
||||
// Explicitly set those bits to zero, no matter how they align
|
||||
for ( uint8_t i = 0; i < 16; ++i )
|
||||
addBit(0);
|
||||
|
||||
mSize -= 16;
|
||||
mState.mSize -= 16;
|
||||
}
|
||||
|
||||
void RXPacket::addFillBits(uint8_t numBits)
|
||||
@ -224,43 +237,43 @@ bool RXPacket::checkCRC() const
|
||||
{
|
||||
//uint16_t rcrc = ((mCRC & 0xff00) >> 8) | ((mCRC & 0x00ff) << 8);
|
||||
//trace_printf("%.4x %.4x %.4x\n", mCRC, ~(mCRC), ~(rcrc));
|
||||
return mCRC == 0xf0b8;
|
||||
return mState.mCRC == 0xf0b8;
|
||||
|
||||
}
|
||||
|
||||
uint8_t RXPacket::messageType() const
|
||||
{
|
||||
if ( mType )
|
||||
return mType;
|
||||
if ( mState.mType )
|
||||
return mState.mType;
|
||||
|
||||
for ( int i = 0; i < 6; ++i ) {
|
||||
mType <<= 1;
|
||||
mType |= bit(i);
|
||||
mState.mType <<= 1;
|
||||
mState.mType |= bit(i);
|
||||
}
|
||||
|
||||
return mType;
|
||||
return mState.mType;
|
||||
}
|
||||
|
||||
uint8_t RXPacket::repeatIndicator() const
|
||||
{
|
||||
if ( mRI )
|
||||
return mRI;
|
||||
if ( mState.mRI )
|
||||
return mState.mRI;
|
||||
|
||||
mRI = bit(6) << 1 | bit(7);
|
||||
return mRI;
|
||||
mState.mRI = bit(6) << 1 | bit(7);
|
||||
return mState.mRI;
|
||||
}
|
||||
|
||||
uint32_t RXPacket::mmsi() const
|
||||
{
|
||||
if ( mMMSI )
|
||||
return mMMSI;
|
||||
if ( mState.mMMSI )
|
||||
return mState.mMMSI;
|
||||
|
||||
for ( int i = 8; i < 38; ++i ) {
|
||||
mMMSI <<= 1;
|
||||
mMMSI |= bit(i);
|
||||
mState.mMMSI <<= 1;
|
||||
mState.mMMSI |= bit(i);
|
||||
}
|
||||
|
||||
return mMMSI;
|
||||
return mState.mMMSI;
|
||||
}
|
||||
|
||||
|
||||
|
@ -180,14 +180,6 @@ void RadioManager::sendTestPacketNow(TXPacket *packet)
|
||||
}
|
||||
}
|
||||
|
||||
void RadioManager::noiseFloorUpdated(VHFChannel channel, uint8_t rssi)
|
||||
{
|
||||
if ( mTransceiverIC )
|
||||
{
|
||||
mTransceiverIC->noiseFloorUpdated(channel, rssi);
|
||||
}
|
||||
}
|
||||
|
||||
void rxClockCB()
|
||||
{
|
||||
RadioManager::instance().onBitClock(2);
|
||||
|
@ -56,6 +56,8 @@ bool Receiver::init()
|
||||
//DBG("Configuring IC\r\n");
|
||||
configure();
|
||||
resetBitScanner();
|
||||
//configureGPIOsForRX();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -72,6 +74,7 @@ void Receiver::switchToChannel(VHFChannel channel)
|
||||
mSwitchToChannel = channel;
|
||||
}
|
||||
|
||||
// TODO: This is a really, really long operation - over 150us !!!
|
||||
void Receiver::startListening(VHFChannel channel)
|
||||
{
|
||||
configureGPIOsForRX();
|
||||
@ -106,6 +109,7 @@ void Receiver::onBitClock()
|
||||
if ( gRadioState == RADIO_TRANSMITTING )
|
||||
return;
|
||||
|
||||
bsp_signal_high();
|
||||
|
||||
uint8_t bit = HAL_GPIO_ReadPin(mDataPort, mDataPin);
|
||||
processNRZIBit(bit);
|
||||
@ -118,6 +122,7 @@ void Receiver::onBitClock()
|
||||
#else
|
||||
++mSlotBitNumber;
|
||||
#endif
|
||||
bsp_signal_low();
|
||||
}
|
||||
|
||||
void Receiver::timeSlotStarted(uint32_t slot)
|
||||
@ -245,61 +250,36 @@ bool Receiver::addBit(uint8_t bit)
|
||||
|
||||
void Receiver::pushPacket()
|
||||
{
|
||||
//bsp_signal_high();
|
||||
#ifndef TX_TEST_MODE
|
||||
Event *p = EventPool::instance().newEvent(AIS_PACKET_EVENT);
|
||||
if ( p )
|
||||
{
|
||||
bsp_signal_high();
|
||||
p->rxPacket = mRXPacket;
|
||||
bsp_signal_low();
|
||||
EventQueue::instance().push(p);
|
||||
}
|
||||
mRXPacket.reset();
|
||||
#else
|
||||
mRXPacket.reset();
|
||||
#endif
|
||||
//bsp_signal_low();
|
||||
}
|
||||
|
||||
uint8_t Receiver::reportRSSI()
|
||||
{
|
||||
uint8_t rssi = readRSSI();
|
||||
|
||||
#if 0
|
||||
Event e(RSSI_SAMPLE_EVENT);
|
||||
e.rssiSample.channel = mChannel;
|
||||
e.rssiSample.rssi = rssi;
|
||||
EventQueue::instance().push(e);
|
||||
#endif
|
||||
|
||||
|
||||
char channel = AIS_CHANNELS[mChannel].designation;
|
||||
NoiseFloorDetector::instance().report(channel, rssi);
|
||||
|
||||
return rssi;
|
||||
}
|
||||
|
||||
void Receiver::configureGPIOsForRX()
|
||||
{
|
||||
/*
|
||||
* Configure radio GPIOs for RX:
|
||||
* GPIO 0: Don't care
|
||||
* GPIO 1: RX_DATA
|
||||
* GPIO 2: Don't care
|
||||
* GPIO 3: RX_TX_DATA_CLK
|
||||
* NIRQ : SYNC_WORD_DETECT
|
||||
*/
|
||||
|
||||
GPIO_PIN_CFG_PARAMS gpiocfg;
|
||||
gpiocfg.GPIO0 = 0x00; // No change
|
||||
gpiocfg.GPIO1 = 0x14; // RX data bits
|
||||
gpiocfg.GPIO2 = 0x00; // No change
|
||||
gpiocfg.GPIO3 = 0x1F; // RX/TX data clock
|
||||
gpiocfg.NIRQ = 0x1A; // Sync word detect
|
||||
gpiocfg.NIRQ = 0x00; // Nothing
|
||||
gpiocfg.SDO = 0x00; // No change
|
||||
gpiocfg.GENCFG = 0x00; // No change
|
||||
sendCmd(GPIO_PIN_CFG, &gpiocfg, sizeof gpiocfg, &gpiocfg, sizeof gpiocfg);
|
||||
|
||||
bsp_set_rx_mode();
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,11 +88,6 @@ void Transceiver::processEvent(const Event &e)
|
||||
}
|
||||
}
|
||||
|
||||
void Transceiver::noiseFloorUpdated(VHFChannel channel, uint8_t rssi)
|
||||
{
|
||||
mNoiseFloorCache[channel] = rssi;
|
||||
}
|
||||
|
||||
void Transceiver::transmitCW(VHFChannel channel)
|
||||
{
|
||||
startReceiving(channel);
|
||||
@ -147,15 +142,6 @@ void Transceiver::configureGPIOsForTX(tx_power_level powerLevel)
|
||||
{
|
||||
bsp_set_tx_mode();
|
||||
|
||||
/*
|
||||
* Configure radio GPIOs for TX:
|
||||
* GPIO 0: Don't care
|
||||
* GPIO 1: INPUT of TX bits
|
||||
* GPIO 2: Don't care
|
||||
* GPIO 3: RX_TX_DATA_CLK
|
||||
* NIRQ : SYNC_WORD_DETECT
|
||||
*/
|
||||
|
||||
GPIO_PIN_CFG_PARAMS gpiocfg;
|
||||
gpiocfg.GPIO0 = 0x20; // TX_STATE; low during RX and high during TX
|
||||
gpiocfg.GPIO1 = 0x04; // Input
|
||||
@ -329,21 +315,12 @@ void Transceiver::configureGPIOsForRX()
|
||||
{
|
||||
bsp_set_rx_mode();
|
||||
|
||||
/*
|
||||
* Configure radio GPIOs for RX:
|
||||
* GPIO 0: TX_STATE
|
||||
* GPIO 1: RX_DATA
|
||||
* GPIO 2: RX_TX_DATA_CLK
|
||||
* GPIO 3: RX_STATE
|
||||
* NIRQ : SYNC_WORD_DETECT
|
||||
*/
|
||||
|
||||
GPIO_PIN_CFG_PARAMS gpiocfg;
|
||||
gpiocfg.GPIO0 = 0x20; // TX_STATE; low during RX and high during TX
|
||||
gpiocfg.GPIO1 = 0x14; // RX data bits
|
||||
gpiocfg.GPIO2 = 0x1F; // RX/TX data clock
|
||||
gpiocfg.GPIO3 = 0x21; // RX_STATE; high during RX and low during TX
|
||||
gpiocfg.NIRQ = 0x1A; // Sync word detect
|
||||
gpiocfg.NIRQ = 0x00; // Nothing
|
||||
gpiocfg.SDO = 0x00; // No change
|
||||
gpiocfg.GENCFG = 0x00; // No change
|
||||
sendCmd(GPIO_PIN_CFG, &gpiocfg, sizeof gpiocfg, &gpiocfg, sizeof gpiocfg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user