Skip to content

Commit

Permalink
BrushedSparky: support 32ch VTX
Browse files Browse the repository at this point in the history
  • Loading branch information
peabody124 committed Nov 17, 2015
1 parent 1aa2cf9 commit ae3c9a6
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 9 deletions.
138 changes: 130 additions & 8 deletions flight/targets/sparky2/fw/pios_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,30 +154,135 @@ static void panic(int32_t code) {
void set_vtx_channel(HwSparky2VTX_ChOptions channel)
{
uint8_t chan = 0;
uint8_t band = 0xFF; // Set to "A" band

switch (channel) {
case HWSPARKY2_VTX_CH_1:
case HWSPARKY2_VTX_CH_BOSCAMACH15725:
chan = 0;
band = 0;
case HWSPARKY2_VTX_CH_BOSCAMACH25745:
chan = 1;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH35765:
chan = 2;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH45785:
chan = 3;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH55805:
chan = 4;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH65825:
chan = 5;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH75845:
chan = 6;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMACH85865:
chan = 7;
band = 0;
break;
case HWSPARKY2_VTX_CH_BOSCAMBCH15733:
chan = 0;
band = 1;
break;
case HWSPARKY2_VTX_CH_2:
case HWSPARKY2_VTX_CH_BOSCAMBCH25752:
chan = 1;
band = 1;
break;
case HWSPARKY2_VTX_CH_3:
case HWSPARKY2_VTX_CH_BOSCAMBCH35771:
chan = 2;
band = 1;
break;
case HWSPARKY2_VTX_CH_4:
case HWSPARKY2_VTX_CH_BOSCAMBCH45790:
chan = 3;
band = 1;
break;
case HWSPARKY2_VTX_CH_5:
case HWSPARKY2_VTX_CH_BOSCAMBCH55809:
chan = 4;
band = 1;
break;
case HWSPARKY2_VTX_CH_6:
case HWSPARKY2_VTX_CH_BOSCAMBCH65828:
chan = 5;
band = 1;
break;
case HWSPARKY2_VTX_CH_7:
case HWSPARKY2_VTX_CH_BOSCAMBCH75847:
chan = 6;
band = 1;
break;
case HWSPARKY2_VTX_CH_8:
case HWSPARKY2_VTX_CH_BOSCAMBCH85866:
chan = 7;
band = 1;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH15705:
chan = 0;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH25685:
chan = 1;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH35665:
chan = 2;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH45645:
chan = 3;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH55885:
chan = 4;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH65905:
chan = 5;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH75925:
chan = 6;
band = 2;
break;
case HWSPARKY2_VTX_CH_BOSCAMECH85945:
chan = 7;
band = 2;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH15740:
chan = 0;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH25760:
chan = 1;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH35780:
chan = 2;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH45800:
chan = 3;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH55820:
chan = 4;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH65840:
chan = 5;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH75860:
chan = 6;
band = 3;
break;
case HWSPARKY2_VTX_CH_AIRWAVECH85860:
chan = 7;
band = 3;
break;
}

Expand Down Expand Up @@ -211,6 +316,23 @@ void set_vtx_channel(HwSparky2VTX_ChOptions channel)
} else {
GPIO_ResetBits(GPIOB, GPIO_Pin_12);
}

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIOA, &GPIO_InitStructure);

if (band & 0x01) {
GPIO_SetBits(GPIOA, GPIO_Pin_9);
} else {
GPIO_ResetBits(GPIOA, GPIO_Pin_9);
}

if (band & 0x02) {
GPIO_SetBits(GPIOA, GPIO_Pin_10);
} else {
GPIO_ResetBits(GPIOA, GPIO_Pin_10);
}
}

/**
Expand Down
37 changes: 36 additions & 1 deletion shared/uavobjectdefinition/hwsparky2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,42 @@
<field name="MPU9250GyroLPF" units="Hz" type="enum" elements="1" options="184,92,41,20,10,5" defaultvalue="184"/>
<field name="MPU9250AccelLPF" units="Hz" type="enum" elements="1" options="460,184,92,41,20,10,5" defaultvalue="184"/>

<field name="VTX_Ch" units="Hz" type="enum" elements="1" options="1,2,3,4,5,6,7,8" defaultvalue="1"/>
<field name="VTX_Ch" units="Hz" type="enum" elements="1" defaultvalue="BoscamACh1">
<options>
<option>BoscamACh1 (5725)</option>
<option>BoscamACh2 (5745)</option>
<option>BoscamACh3 (5765)</option>
<option>BoscamACh4 (5785)</option>
<option>BoscamACh5 (5805)</option>
<option>BoscamACh6 (5825)</option>
<option>BoscamACh7 (5845)</option>
<option>BoscamACh8 (5865)</option>
<option>BoscamBCh1 (5733)</option>
<option>BoscamBCh2 (5752)</option>
<option>BoscamBCh3 (5771)</option>
<option>BoscamBCh4 (5790)</option>
<option>BoscamBCh5 (5809)</option>
<option>BoscamBCh6 (5828)</option>
<option>BoscamBCh7 (5847)</option>
<option>BoscamBCh8 (5866)</option>
<option>BoscamECh1 (5705)</option>
<option>BoscamECh2 (5685)</option>
<option>BoscamECh3 (5665)</option>
<option>BoscamECh4 (5645)</option>
<option>BoscamECh5 (5885)</option>
<option>BoscamECh6 (5905)</option>
<option>BoscamECh7 (5925)</option>
<option>BoscamECh8 (5945)</option>
<option>AirwaveCh1 (5740)</option>
<option>AirwaveCh2 (5760)</option>
<option>AirwaveCh3 (5780)</option>
<option>AirwaveCh4 (5800)</option>
<option>AirwaveCh5 (5820)</option>
<option>AirwaveCh6 (5840)</option>
<option>AirwaveCh7 (5860)</option>
<option>AirwaveCh8 (5860)</option>
</options>
</field>

<field name="Magnetometer" units="function" type="enum" elements="1" options="Internal,ExternalI2CFlexiPort,ExternalAuxI2C" defaultvalue="Internal"/>
<field name="ExtMagOrientation" units="function" type="enum" elements="1" parent="HwShared.MagOrientation" defaultvalue="Top0degCW" />
Expand Down

0 comments on commit ae3c9a6

Please sign in to comment.