1
0
mirror of https://github.com/peterantypas/maiana.git synced 2025-05-29 13:50:29 -07:00

More cleanup

This commit is contained in:
Peter Antypas 2016-05-31 06:23:39 -07:00
parent 693874feef
commit 03a34f255b
14 changed files with 72 additions and 45 deletions

View File

@ -22,8 +22,8 @@
<layer number="26" name="bNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="27" name="tValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="28" name="bValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="no" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="no" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="yes" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="yes" active="yes"/>
<layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/>
<layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/>
<layer number="33" name="tFinish" color="6" fill="3" visible="no" active="yes"/>
@ -146,7 +146,7 @@
<wire x1="73.6475" y1="0" x2="73.6475" y2="36.82" width="0" layer="20"/>
<wire x1="73.6475" y1="36.82" x2="0" y2="36.82" width="0" layer="20"/>
<wire x1="0" y1="36.82" x2="0" y2="0" width="0" layer="20"/>
<rectangle x1="55.88" y1="22.225" x2="59.055" y2="25.4" layer="29"/>
<rectangle x1="55.88" y1="22.225" x2="59.055" y2="25.4" layer="30"/>
<text x="47.9425" y="21.2725" size="0.6096" layer="25" font="vector" ratio="10">5V</text>
<text x="40.9575" y="21.2725" size="0.6096" layer="25" font="vector" ratio="10">GND</text>
<text x="0.9525" y="33.9725" size="0.6096" layer="25" font="vector" ratio="10" rot="R90">5V</text>
@ -160,9 +160,10 @@
<text x="73.3425" y="9.2075" size="0.6096" layer="25" font="vector" ratio="10" rot="R90">3V</text>
<text x="73.3425" y="9.2075" size="0.6096" layer="25" font="vector" ratio="10" rot="R90">3V</text>
<text x="53.0225" y="35.8775" size="0.6096" layer="25" font="vector" ratio="10">3V</text>
<text x="44.7675" y="9.525" size="0.8128" layer="25" font="vector" ratio="10">AIS Logic State
Rev 3.1
<text x="44.7675" y="9.525" size="0.8128" layer="25" font="vector" ratio="10">AIS Logic Stage
Rev 3.2
(c) 2016 Peter Antypas</text>
<rectangle x1="55.88" y1="22.225" x2="59.055" y2="25.4" layer="29"/>
</plain>
<libraries>
<library name="adafruit">
@ -1256,6 +1257,8 @@ design rules under a new name.</description>
<attribute name="NAME" x="7.5438" y="6.5913" size="0.6096" layer="25" font="vector" ratio="10"/>
<attribute name="VALUE" x="6.985" y="5.3975" size="1.27" layer="27"/>
</element>
<element name="R9" library="SparkFun-Passives" package="0603-RES" value="10K" x="23.495" y="10.795"/>
<element name="R10" library="SparkFun-Passives" package="0603-RES" value="10K" x="23.495" y="6.0325"/>
</elements>
<signals>
<signal name="GND">
@ -1370,7 +1373,7 @@ design rules under a new name.</description>
<via x="39.0525" y="31.4325" extent="1-16" drill="0.3302"/>
<via x="40.9575" y="29.5275" extent="1-16" drill="0.3302"/>
<via x="22.86" y="18.0975" extent="1-16" drill="0.3302"/>
<via x="25.0825" y="10.795" extent="1-16" drill="0.3302"/>
<via x="24.765" y="8.255" extent="1-16" drill="0.3302"/>
<via x="23.1775" y="13.97" extent="1-16" drill="0.3302"/>
<via x="50.8" y="20.955" extent="1-16" drill="0.3302"/>
<via x="31.4325" y="9.8425" extent="1-16" drill="0.3302"/>
@ -1497,7 +1500,8 @@ design rules under a new name.</description>
<wire x1="32.7025" y1="27.725" x2="32.805" y2="27.6225" width="0.254" layer="1"/>
<wire x1="24.695" y1="7.305" x2="27.9425" y2="7.305" width="0.254" layer="1"/>
<wire x1="27.9425" y1="7.305" x2="28.575" y2="7.9375" width="0.254" layer="1"/>
<wire x1="28.575" y1="7.9375" x2="28.575" y2="12.28" width="0.254" layer="1"/>
<wire x1="28.575" y1="7.9375" x2="28.575" y2="10.795" width="0.254" layer="1"/>
<wire x1="28.575" y1="10.795" x2="28.575" y2="12.28" width="0.254" layer="1"/>
<wire x1="28.575" y1="12.28" x2="28.4725" y2="12.3825" width="0.254" layer="1"/>
<wire x1="53.2375" y1="20.955" x2="54.2925" y2="20.955" width="0.254" layer="1"/>
<wire x1="6.6675" y1="32.2825" x2="6.6675" y2="33.44" width="0.254" layer="1"/>
@ -1513,6 +1517,11 @@ design rules under a new name.</description>
<wire x1="53.0225" y1="18.415" x2="53.0225" y2="20.74" width="0.254" layer="1"/>
<wire x1="53.0225" y1="20.74" x2="53.2375" y2="20.955" width="0.254" layer="1"/>
<wire x1="24.695" y1="7.305" x2="24.695" y2="6.3825" width="0.254" layer="1"/>
<contactref element="R9" pad="2"/>
<contactref element="R10" pad="2"/>
<wire x1="24.345" y1="6.0325" x2="24.695" y2="6.0325" width="0.4064" layer="1"/>
<wire x1="24.695" y1="6.0325" x2="24.695" y2="6.3825" width="0.4064" layer="1"/>
<wire x1="24.345" y1="10.795" x2="28.575" y2="10.795" width="0.254" layer="1"/>
</signal>
<signal name="N$3">
<contactref element="C10" pad="1"/>
@ -1914,10 +1923,14 @@ design rules under a new name.</description>
<signal name="I2C_SCL">
<contactref element="U$1" pad="P$42"/>
<contactref element="U$2" pad="1"/>
<wire x1="22.295" y1="9.205" x2="22.295" y2="14.9925" width="0.254" layer="1"/>
<wire x1="22.295" y1="9.205" x2="22.295" y2="10.4775" width="0.254" layer="1"/>
<wire x1="22.295" y1="10.795" x2="22.295" y2="14.9925" width="0.254" layer="1"/>
<wire x1="22.295" y1="14.9925" x2="23.495" y2="16.51" width="0.254" layer="1"/>
<wire x1="23.495" y1="16.51" x2="26.5632375" y2="16.51" width="0.254" layer="1"/>
<wire x1="26.5632375" y1="16.51" x2="27.29801875" y2="17.24478125" width="0.254" layer="1"/>
<contactref element="R9" pad="1"/>
<wire x1="22.645" y1="10.795" x2="22.295" y2="10.795" width="0.254" layer="1"/>
<wire x1="22.295" y1="10.795" x2="22.295" y2="10.4775" width="0.254" layer="1"/>
</signal>
<signal name="I2C_SDA">
<contactref element="U$1" pad="P$43"/>
@ -1931,6 +1944,9 @@ design rules under a new name.</description>
<wire x1="24.4475" y1="15.24" x2="26.00034375" y2="15.24" width="0.254" layer="1"/>
<wire x1="26.00034375" y1="15.24" x2="27.651571875" y2="16.891228125" width="0.254" layer="1"/>
<wire x1="22.295" y1="7.305" x2="22.295" y2="6.3825" width="0.254" layer="1"/>
<contactref element="R10" pad="1"/>
<wire x1="22.645" y1="6.0325" x2="22.295" y2="6.0325" width="0.4064" layer="1"/>
<wire x1="22.295" y1="6.0325" x2="22.295" y2="6.3825" width="0.4064" layer="1"/>
</signal>
<signal name="VDD1">
<contactref element="C13" pad="1"/>

BIN
eagle/logic.brd.pdf Normal file

Binary file not shown.

View File

@ -4656,6 +4656,9 @@ Please use FRAME-LEDGER/FRAME-LETTER for schematics now.</description>
<part name="PPS" library="adafruit" deviceset="PINHD-1X1" device=""/>
<part name="GPS" library="adafruit" deviceset="PINHD-1X1" device=""/>
<part name="FRAME1" library="SparkFun-Retired" deviceset="FRAME-A3" device=""/>
<part name="R9" library="SparkFun-Passives" deviceset="RESISTOR" device="0603-RES" value="10K"/>
<part name="R10" library="SparkFun-Passives" deviceset="RESISTOR" device="0603-RES" value="10K"/>
<part name="+3V7" library="supply1" deviceset="+3V3" device=""/>
</parts>
<sheets>
<sheet>
@ -4867,6 +4870,11 @@ Please use FRAME-LEDGER/FRAME-LETTER for schematics now.</description>
<attribute name="VALUE" x="-64.77" y="-73.025" size="1.778" layer="96" rot="R270"/>
</instance>
<instance part="FRAME1" gate="G$1" x="-190.5" y="-114.3"/>
<instance part="R9" gate="G$1" x="-67.31" y="-10.16" rot="R90"/>
<instance part="R10" gate="G$1" x="-71.12" y="-25.4" rot="R90"/>
<instance part="+3V7" gate="G$1" x="-67.31" y="0" smashed="yes">
<attribute name="VALUE" x="-63.5" y="3.81" size="1.778" layer="96" rot="R180"/>
</instance>
</instances>
<busses>
</busses>
@ -5209,6 +5217,15 @@ Please use FRAME-LEDGER/FRAME-LETTER for schematics now.</description>
<wire x1="-77.47" y1="-53.34" x2="-80.645" y2="-53.34" width="0.1524" layer="91"/>
<pinref part="+3V6" gate="G$1" pin="+3V3"/>
</segment>
<segment>
<pinref part="R10" gate="G$1" pin="2"/>
<wire x1="-71.12" y1="-20.32" x2="-71.12" y2="-5.08" width="0.1524" layer="91"/>
<pinref part="R9" gate="G$1" pin="2"/>
<wire x1="-71.12" y1="-5.08" x2="-67.31" y2="-5.08" width="0.1524" layer="91"/>
<wire x1="-67.31" y1="-5.08" x2="-67.31" y2="-2.54" width="0.1524" layer="91"/>
<junction x="-67.31" y="-5.08"/>
<pinref part="+3V7" gate="G$1" pin="+3V3"/>
</segment>
</net>
<net name="N$3" class="0">
<segment>
@ -5505,8 +5522,11 @@ Please use FRAME-LEDGER/FRAME-LETTER for schematics now.</description>
</segment>
<segment>
<pinref part="U$2" gate="G$1" pin="SCL"/>
<wire x1="-60.96" y1="-15.24" x2="-73.66" y2="-15.24" width="0.1524" layer="91"/>
<wire x1="-60.96" y1="-15.24" x2="-67.31" y2="-15.24" width="0.1524" layer="91"/>
<label x="-74.93" y="-15.24" size="1.778" layer="95" rot="R180" xref="yes"/>
<pinref part="R9" gate="G$1" pin="1"/>
<wire x1="-67.31" y1="-15.24" x2="-73.66" y2="-15.24" width="0.1524" layer="91"/>
<junction x="-67.31" y="-15.24"/>
</segment>
</net>
<net name="I2C_SDA" class="0">
@ -5518,7 +5538,10 @@ Please use FRAME-LEDGER/FRAME-LETTER for schematics now.</description>
<segment>
<pinref part="U$2" gate="G$1" pin="SDA"/>
<label x="-75.565" y="-30.48" size="1.778" layer="95" rot="R180" xref="yes"/>
<wire x1="-60.96" y1="-30.48" x2="-74.93" y2="-30.48" width="0.1524" layer="91"/>
<wire x1="-60.96" y1="-30.48" x2="-71.12" y2="-30.48" width="0.1524" layer="91"/>
<pinref part="R10" gate="G$1" pin="1"/>
<wire x1="-71.12" y1="-30.48" x2="-74.93" y2="-30.48" width="0.1524" layer="91"/>
<junction x="-71.12" y="-30.48"/>
</segment>
</net>
<net name="VDD1" class="0">

BIN
eagle/logic.sch.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,7 +47,7 @@ private:
void spiOn();
void spiOff();
protected:
SPI_TypeDef *mSPI ; // The SPI bus we use
SPI_TypeDef *mSPI; // The SPI bus we use
GPIO_TypeDef *mSDNP; // The MCU GPIO assigned to SDN for this IC (GPIOA, GPIOB or GPIOC)
GPIO_TypeDef *mCSP; // The MCU GPIO assigned to CS for SPI
GPIO_TypeDef *mGPIO1P; // The MCU GPIO assigned to GPIO1 of the IC

View File

@ -85,6 +85,20 @@ void Transceiver::transmitCW(VHFChannel channel)
}
void Transceiver::setTXPower(tx_power_level powerLevel)
{
const pa_params &pwr = POWER_TABLE[powerLevel];
SET_PROPERTY_PARAMS p;
p.Group = 0x22;
p.NumProperties = 3;
p.StartProperty = 0x00;
p.Data[0] = pwr.pa_mode;
p.Data[1] = pwr.pa_level;
p.Data[2] = pwr.pa_bias_clkduty;
sendCmd(SET_PROPERTY, &p, 6, NULL, 0);
}
void Transceiver::configureForTX(tx_power_level powerLevel)
{
/*
@ -117,17 +131,9 @@ void Transceiver::configureForTX(tx_power_level powerLevel)
gpiocfg.GENCFG = 0x00; // No change
sendCmd(GPIO_PIN_CFG, &gpiocfg, sizeof gpiocfg, &gpiocfg, sizeof gpiocfg);
const pa_params &pwr = POWER_TABLE[powerLevel];
SET_PROPERTY_PARAMS p;
p.Group = 0x22;
p.NumProperties = 3;
p.StartProperty = 0x00;
p.Data[0] = pwr.pa_mode;
p.Data[1] = pwr.pa_level;
p.Data[2] = pwr.pa_bias_clkduty;
sendCmd(SET_PROPERTY, &p, 6, NULL, 0);
setTXPower(powerLevel);
// BYP setting is in table
const pa_params &pwr = POWER_TABLE[powerLevel];
if ( pwr.bypass )
GPIO_SetBits(mBYPPort, mBYPPin);
else
@ -155,7 +161,8 @@ void Transceiver::onBitClock()
// If we have an assigned packet and we're on the correct channel, at the right bit of the time slot,
// and the RSSI is within 6dB of the noise floor for this channel, then fire!!!
if ( mSlotBitNumber == CCA_SLOT_BIT+1 && mTXPacket && mTXPacket->channel() == mChannel && mRXPacket->rssi() < NoiseFloorDetector::instance().getNoiseFloor(mChannel) + 12 ) {
uint8_t noiseFloor = NoiseFloorDetector::instance().getNoiseFloor(mChannel);
if ( mSlotBitNumber == CCA_SLOT_BIT+1 && mTXPacket && mTXPacket->channel() == mChannel && mRXPacket->rssi() < noiseFloor + 12 ) {
startTransmitting();
}
}

View File

@ -37,10 +37,10 @@ public:
void transmitCW(VHFChannel channel);
protected:
void configure();
private:
void startTransmitting();
void configureForTX(tx_power_level pwr);
void setTXPower(tx_power_level pwr);
private:
TXPacket *mTXPacket;
GPIO_TypeDef *mCTXPort;

View File

@ -70,31 +70,12 @@
// Default interval for message 24 A&B (static data report)
#define MSG_24_TX_INTERVAL 180
#define CCA_SLOT_BIT 8
// The spec calls for Class B transmitters to listen for the first 20 bits of each frame before transmitting.
// It takes the Si4463 a few bits' time to switch from RX to TX, so I arbitrarily picked the 12th bit.
#define CCA_SLOT_BIT 11
// Extra debugging using halting assertions
#define DEV_MODE 1
/*
* Ideally, these should come from some non-volatile storage on board, but for now
* we just define them here.
*
* NOTE: It is against US Coast Guard regulations to transmit AIS messages with an invalid MMSI. Consider yourself warned.
* That said, just about everyone developing AIS equipment does this at some point, typically in lab environments.
*
* Also, manufacturers of AIS transmitters must program the MMSI, station name and other metadata on behalf of
* their customers prior to shipping to a US address, as users are prohibited from altering those.
*
* Of course, regulations were written at a time when none would design and build their own AIS equipment in
* an open-source fashion, so they are (as usual) at least a decade behind the technology curve.
*/
//#define STATION_MMSI 987654321
//#define STATION_NAME "TEST STATION 01"
//#define STATION_CALLSIGN "N0NNNN"
#endif /* GLOBALS_H_ */