Serial experiements

tinySA
erikkaashoek 6 years ago
parent ac606f09e3
commit a7ae6d4197

@ -132,7 +132,7 @@
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL FALSE
#define HAL_USE_SERIAL TRUE
#endif
/**

@ -16,9 +16,14 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
//#define HAL_USE_SERIAL 1
//#define STM32_SERIAL_USE_USART1 1
#include "ch.h"
#include "hal.h"
//#include "hal_serial.h"
#include "usbcfg.h"
#ifdef __VNA__
#include "si5351.h"
@ -2591,6 +2596,39 @@ static DACConfig dac1cfg1 = {
};
#endif
#if 0
/*
* UART driver configuration structure.
*/
static UARTConfig uart_cfg_1 = {
NULL, //txend1,
NULL, //txend2,
NULL, //rxend,
NULL, //rxchar,
NULL, //rxerr,
800000,
0,
0, //USART_CR2_LINEN,
0
};
#endif
#if 1
static const SerialConfig default_config =
{
9600,
0,
USART_CR2_STOP2_BITS,
0
};
#endif
myWrite(char *buf)
{
int len = strlen(buf);
while(len-- > 0)
sdPut(&SD1,*buf++);
}
// Main thread stack size defined in makefile USE_PROCESS_STACKSIZE = 0x200
// Profile stack usage (enable threads command by def ENABLE_THREADS_COMMAND) show:
@ -2625,7 +2663,35 @@ int main(void)
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
/*
#if 0
/*
* UART initialize
*/
uartStart(&UARTD1, &uart_cfg_1);
uartStartSend(&UARTD1, 1, "H");
uartStartReceive(&UARTD1, 1, buf);
#endif
#if 1
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(1)); // USART1 TX.
palSetPadMode(GPIOA,10, PAL_MODE_ALTERNATE(1)); // USART1 RX.
uint8_t buf[10];
sdStart(&SD1,&default_config);
osalThreadSleepMilliseconds(10);
myWrite("Hallo!?");
osalThreadSleepMilliseconds(10);
sdReadTimeout(&SD1,buf,10, 10);
sdWrite(&SD1,(const uint8_t *)"Test123",7);
osalThreadSleepMilliseconds(10);
sdReadTimeout(&SD1,buf,10, 10);
#endif
/*
* SPI LCD Initialize
*/
ili9341_init();

@ -201,7 +201,7 @@
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 TRUE
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USART1_IRQ_PRIORITY 3
#define STM32_UART_USART2_IRQ_PRIORITY 3

@ -888,7 +888,7 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
return(0);
float signal_path_loss;
if (setting_mode == M_LOW)
signal_path_loss = -9.5; // Loss in dB
signal_path_loss = -9.5; // Loss in dB, -9.5 for v0.1, -12.5 for v0.2
else
signal_path_loss = 7; // Loss in dB (+ is gain)
float subRSSI = SI4432_RSSI(lf, MODE_SELECT(setting_mode))+settingLevelOffset()+ setting_attenuate - signal_path_loss;

Loading…
Cancel
Save

Powered by TurnKey Linux.