【Putake Tuwhera】 Mata DWIN me te Waea Android Rua-ara Hononga Mana Whakahoki Waiata

–Mai i te Huinga Kaiwhakawhanake DWIN

Ko tenei take mo koe ki te pana i te keehi puna-tuwhera tohu-toa o te huinga kaiwhakawhanake DWIN - mata DWIN me te waea Android e rua-ara te whakahaere hononga puoro purei puoro. Engineers i roto i te kōwae Nihokikorangi ki te whakatutuki i te DWIN mata mohio me te tauwhitinga raraunga waea Android, ka taea e nga kaiwhakamahi ngawari te whakahaere i te waea Android, te puku kohiko USB i roto i te purei waiata, okioki, huri i te waiata me nga tautuhinga tangi, wheako mata mohio me te waea Android rua- ara whakahaere watea.

1.C51 Hoahoa
(1) Ka taunekeneke te tauranga rangatū T5L ki te kōwae Nihokikorangi ki te whakarereke i te mana purei, te whakarite i te rōrahi, me te panui i te mana Nihokikorangi, ko te waahanga o te tohu tohu e whai ake nei:
int matua(kore)
{
INIT_CPU();
T2_Te wera();
UART4_Init();
EA=1;
//UART4_SendStr(“hello”, sizeof(“hello”));
//WDT_ON();//Whakahurihia te Tiaki.
ia(1)
{
//WDT_RST();//Waewae te kuri
Tukanga();
}
}
kore UART4_Init(kore)
{
// UART4 Tautuhinga reiti Baud:
//BODE2_DIV_H=Te auau Mains CPU/(8*Baud rate) .
//206438400/8/115200=224=0xe0
//206438400/8/921600=28=0x1C
//206438400/8=25804800/230400=112=0×70
SCON2T=0×80;
SCON2R=0×80;
BODE2_DIV_H=0×00;//FCLK/(8*DIV) 
BODE2_DIV_L=0xe0;// 921600 Reiti Baud
//BODE2_DIV_H=0×00;
//FCLK/(8*DIV)
//BODE2_DIV_L=0×70;
//ES3T=1;
ES2R=1;
EA=1;
}
karekau TenMsHandle(kore)
{
if(!TenmsFlag)
hoki mai;
TenmsFlag=0;
SourcePress();//Tone generator
PlayCtrPress(); // Huringa ahua purei
VolCtrSlider(); // Huringa rōrahi
VolLogSlider(); // Huringa Rōrahi
ReadBtState();//Panui te mana Nihokikorangi
}
korekore PūtakePress(kore)
{
charTouchKey[2]={0,0};
u8Sdata[2];
read_dgusii_vp(0×3000,TouchKey,1);
ki te(TouchKey[1]==0)
hoki mai;
Raraunga[1]=0;
whakakā(TouchKey[1])
{
take1://U kōpae
Raraunga[0]=1;
SendDataToBT(Write_Run_Mode,Sdata,1);
pakaru;
take2:// RainaWawahoTauru Whakauru
Raraunga[0]=2;
SendDataToBT(Write_Run_Mode,Sdata,1);
pakaru;
take3: // Nihokikorangi
Raraunga[0]=3;
SendDataToBT(Write_Run_Mode,Sdata,1);
pakaru;
}
write_dgusii_vp(0×3003,TouchKey,1);
memset(TouchKey,0, rahinga(TouchKey));
write_dgusii_vp(0×3000,TouchKey,1);
ReadBtStatecount=0;
}
karekau PlayCtrPress(kore)
{
charTouchKey[2]={0,0};
u8Sdata[2];
read_dgusii_vp(0×3001,TouchKey,1);
ki te(TouchKey[1]==0)
hoki mai;
Raraunga[1]=0;
whakakā(TouchKey[1])
{
take1:// Waiata o mua
Raraunga[0]=1;
SendDataToBT(Write_Next_Pre_PT,Sdata,1);
pakaru;
take2: // Tatari Whakahoki
Raraunga[0]=2;
SendDataToBT(Write_Next_Pre_PT,Sdata,1);
pakaru;
take3:// Waiata ka whai ake
Raraunga[0]=3;
SendDataToBT(Write_Next_Pre_PT,Sdata,1);
pakaru;
}
memset(TouchKey,0, rahinga(TouchKey));
write_dgusii_vp(0×3001,TouchKey,1);
ReadBtStatecount=0;
}

(2)Ko te kete rorohiko Android ka tuhia ma te QT, ko te nuinga o te mohio ki te hononga Nihokikorangi me te whakahaere korero me te mata atamai, ko tetahi waahanga o te tohu tohutoro e whai ake nei:
ui->setupUi(this);
bluetooth_ble_Tool=hou Bluetooth_ble_Tool(“dwin_bt(BLE)”);
ui->label_localBT_Name->setText(bluetooth_ble_Tool->getLocalName());
hono(bluetooth_ble_Tool,&Bluetooth_ble_Tool::BlueSearchConnectState,
tenei,&BLE_PairPage::BlueSearchConnectState);
//btchat=hou BtChat();
//btchat->set_ble_Tool(bluetooth_ble_Tool);
//btchat->init_Whārangi();
//btchat->huna();
devicecommHandle=Hōu PūrereComm();
devicecommHandle->set_ble_Tool(bluetooth_ble_Tool);
devicecommHandle->InitDevice();
mwin=mainwin hou();
iti-> huna ();
hono(mwin,&mainwin:layChangeMode,
devicecommHandle,&DeviceComm:layChangeMode);// Tuhia te huringa aratau i tukuna
hono(mwin,&mainwin:layCtrPreNextSt,
devicecommHandle,&DeviceComm:layCtrPreNextSt);// lit. tuhia nga wahanga o runga me raro o te waiata
hono(mwin,&mainwin:layMusicVolChange,
devicecommHandle,&DeviceComm:layMusicVolChange);// Tuhia te huringa oro ki raro
hono(PūrerecommHandle,&PūrereComm::ReadPlayMode,
tenei,[=](int mode){// Te whakatakoto i te aratau o naianei
qDebug() qDebug() B_Upan->setChecked(teka);
mwin->B_AUX->setChecked(teka);
mwin->B_BT->setChecked(teka);
if(aratau==1)
mwin->B_Upan->setChecked(pono);
atu ki te(aratau ==2)
mwin->B_AUX->setChecked(pono);
atu ki te(aratau ==3)
mwin->B_BT->setChecked(pono);
});
hono(devicecommHandle,&DeviceComm::ReadPlayMusicVol,
tenei,[=](int vol){// Tautuhi i te Whakaatu Rōrahi
mwin->QS_MainVol->setValue(vol);
});
hono(taputapu_bletooth_ble_Utauta,&Utauta_bletooth_ble_Tool::BLE_Link_error,
tenei,[=](){
tenei-> whakaatu ();
iti-> huna ();
devicecommHandle->TimerStopReadDeviceST();
this->ui->progressBar->setValue(0);
});
karekau BLE_PairPage::on_pushButton_clicked(){
bluetooth_ble_Tool->SetOperUuidServer(QBluetoothUuid(serviceUuid));
//ui->label_localBT->mārama();
//ui->label_localBT_Name->setText(bluetooth_ble_Tool->getLocalName());
bluetooth_ble_Tool->startFindConnectBle();
//bluetooth_ble_Tool->startStateprogressBar();
ui->PushButton->setEnabled(teka);
ui->PushButton->setText("Rapu");
hono(taputapu_bletooth_ble_Utauta,&Utauta_bletooth_ble_Tool::BlueBLE_FindDevice kua oti,
tenei,[=](bool ok){
ui->PushButton->setEnabled(pono);
ui->PushButton->setText("Tīmata te kimi i te Nihokikorangi hono ");
if(ok==teka) {
QMessageBox::information(this,tr(“Search Status”),” Kaore e taea te rapu i te taputapu, tena koa tirohia mena kua huri ke te taputapu, mena kua hono ke atu tetahi waea pūkoro ki a ia?”);} }); }
karekau BLE_PairPage::BlueSearchConnectState(Bluetooth_ble_Tool::startStateprogressBar_em Hononga, int progress){
ui->progressBar->setValue(te ahunga whakamua);
if(Linkst>=Bluetooth_ble_Tool::Ble_OtherError){
QMessageBox::mohiohio(this,tr(“hononga tere”),bluetooth_ble_Tool->getErrorinfo());
ui->label_tips->setText(bluetooth_ble_Tool->getErrorinfo());}
atu ki te(Hononga>=Bluetooth_ble_Tool::Ble_Deconnect_device){
QMessageBox::mohiohio(this,tr(“hononga tere “),” buggy “);
ui->label_tips->setText("buggy");}
atu mena(Linkst==Bluetooth_ble_Tool::Ble_Connect_characterOk){// QMessageBox::information(
tenei,tr(“kua hono pai “), bluetooth_ble_Tool->getErrorinfo());
ui->label_tips->setText("kua hono pai ");
tenei-> huna ();
mwin-> whakaatu ();
devicecommHandle->TimerStartReadDeviceST(100);
//btchat->show();
// momotu(bluetooth_ble_Tool,&Bluetooth_ble_Tool::BlueSearchConnectState,
//this,&BLE_PairPage::BlueSearchConnectState); }
atu{
ui->label_tips->setText("Te rapu hononga "); }


Te wa tuku: Mei-23-2024