mirror of
https://github.com/bettse/seader.git
synced 2026-06-07 17:32:20 +00:00
Switch to LPTIM2PA4
This commit is contained in:
@@ -54,11 +54,16 @@ void seader_uart_serial_init(Seader* seader, uint8_t uart_ch) {
|
||||
seader_uart->serial_handle, seader_uart_on_irq_rx_dma_cb, seader_uart, false);
|
||||
} else {
|
||||
furi_hal_serial_init(seader_uart->serial_handle, RAW_BAUDRATE_DEFAULT);
|
||||
furi_hal_serial_configure_framing(
|
||||
seader_uart->serial_handle,
|
||||
FuriHalSerialDataBits8,
|
||||
FuriHalSerialParityEven,
|
||||
FuriHalSerialStopBits2);
|
||||
|
||||
furi_hal_serial_dma_rx_start(
|
||||
seader_uart->serial_handle, seader_uart_on_irq_rx_dma_cb, seader_uart, false);
|
||||
|
||||
furi_hal_pwm_start(FuriHalPwmOutputIdTim1PA7, PWM_FREQ, 50);
|
||||
furi_hal_pwm_start(FuriHalPwmOutputIdLptim2PA4, PWM_FREQ, 50);
|
||||
|
||||
furi_hal_gpio_init(RESET_PIN, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_write(RESET_PIN, true); // Active low, so set high
|
||||
@@ -83,7 +88,7 @@ void seader_uart_serial_deinit(Seader* seader) {
|
||||
seader_uart->serial_handle = NULL;
|
||||
|
||||
if(seader->worker->sam_comm_type == SeaderSamCommunicationTypeRaw) {
|
||||
furi_hal_pwm_stop(FuriHalPwmOutputIdTim1PA7);
|
||||
furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
|
||||
|
||||
furi_hal_gpio_init_simple(RESET_PIN, GpioModeAnalog);
|
||||
furi_hal_gpio_write(RESET_PIN, false);
|
||||
@@ -136,9 +141,9 @@ size_t seader_uart_process_buffer_raw(Seader* seader, uint8_t* cmd, size_t cmd_l
|
||||
|
||||
if(ppsSetup) {
|
||||
if(memcmp(PPS, cmd, sizeof(PPS)) == 0) {
|
||||
FURI_LOG_I(TAG, "PPS received, setting baudrate to 230400");
|
||||
// On paper (based on PPS) the baudrate should be 223125, but in practice 230400 works fine
|
||||
seader_uart_set_baudrate(seader->uart, 230400);
|
||||
// If you ever have issue with this, try bumping it to 230400
|
||||
FURI_LOG_I(TAG, "PPS received, setting baudrate to 223125");
|
||||
seader_uart_set_baudrate(seader->uart, 223125);
|
||||
|
||||
//seader_t_1_set_IFSD(seader);
|
||||
|
||||
@@ -174,6 +179,7 @@ size_t seader_uart_process_buffer_raw(Seader* seader, uint8_t* cmd, size_t cmd_l
|
||||
hasSAM = true;
|
||||
|
||||
// In order to get the transmission to work, we fudge the baudrate here
|
||||
/*
|
||||
seader_uart_set_baudrate(seader_uart, 9900);
|
||||
|
||||
furi_hal_serial_configure_framing(
|
||||
@@ -181,7 +187,7 @@ size_t seader_uart_process_buffer_raw(Seader* seader, uint8_t* cmd, size_t cmd_l
|
||||
FuriHalSerialDataBits8,
|
||||
FuriHalSerialParityEven,
|
||||
FuriHalSerialStopBits2);
|
||||
|
||||
*/
|
||||
// 5.2.3 PPS - Protocol Parameter Selection
|
||||
// 0xFF, 0x11, 0x96, 0x78
|
||||
seader_uart_send(seader_uart, PPS, sizeof(PPS));
|
||||
|
||||
Reference in New Issue
Block a user