Code factorization
This commit is contained in:
@@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
#include "../open9x.h"
|
#include "../open9x.h"
|
||||||
|
|
||||||
|
void btInit()
|
||||||
|
{
|
||||||
|
uint32_t baudrate = (g_eeGeneral.btBaudrate==0 ? 115200 : (g_eeGeneral.btBaudrate==1 ? 9600 : 19200));
|
||||||
|
UART3_Configure(baudrate, Master_frequency);
|
||||||
|
}
|
||||||
|
|
||||||
class Fifo32
|
class Fifo32
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#ifndef bluetooth_h
|
#ifndef bluetooth_h
|
||||||
#define bluetooth_h
|
#define bluetooth_h
|
||||||
|
|
||||||
|
void btInit();
|
||||||
void btTask(void* pdata);
|
void btTask(void* pdata);
|
||||||
void btPushByte(uint8_t data);
|
void btPushByte(uint8_t data);
|
||||||
|
|
||||||
|
|||||||
@@ -328,8 +328,7 @@ void menuProcSetup(uint8_t event)
|
|||||||
case ITEM_SETUP_BT_BAUDRATE:
|
case ITEM_SETUP_BT_BAUDRATE:
|
||||||
g_eeGeneral.btBaudrate = selectMenuItem(y, PSTR("BT Baudrate"), PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
|
g_eeGeneral.btBaudrate = selectMenuItem(y, PSTR("BT Baudrate"), PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
uint32_t baudrate = (g_eeGeneral.btBaudrate==0 ? 115200 : (g_eeGeneral.btBaudrate==1 ? 9600 : 19200));
|
btInit();
|
||||||
UART3_Configure(baudrate, Master_frequency);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-16
@@ -3116,23 +3116,10 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
|||||||
#if defined(PCBARM)
|
#if defined(PCBARM)
|
||||||
setVolume(g_eeGeneral.speakerVolume);
|
setVolume(g_eeGeneral.speakerVolume);
|
||||||
PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright;
|
PWM->PWM_CH_NUM[0].PWM_CDTYUPD = g_eeGeneral.backlightBright;
|
||||||
|
|
||||||
#if defined(BLUETOOTH)
|
|
||||||
uint32_t brate ;
|
|
||||||
switch (g_eeGeneral.btBaudrate) {
|
|
||||||
default :
|
|
||||||
case 0 :
|
|
||||||
brate = 115200 ;
|
|
||||||
break ;
|
|
||||||
case 1 :
|
|
||||||
brate = 9600 ;
|
|
||||||
break ;
|
|
||||||
case 2 :
|
|
||||||
brate = 19200 ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
UART3_Configure(brate, Master_frequency);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBARM) && defined(BLUETOOTH)
|
||||||
|
btInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
||||||
|
|||||||
Reference in New Issue
Block a user