mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 18:28:36 -07:00
Add send break support
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,78.1,,
|
||||
Version,+,78.2,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
@@ -1635,6 +1635,7 @@ Function,+,furi_hal_serial_get_gpio_pin,const GpioPin*,"FuriHalSerialHandle*, Fu
|
||||
Function,+,furi_hal_serial_init,void,"FuriHalSerialHandle*, uint32_t"
|
||||
Function,+,furi_hal_serial_is_baud_rate_supported,_Bool,"FuriHalSerialHandle*, uint32_t"
|
||||
Function,+,furi_hal_serial_resume,void,FuriHalSerialHandle*
|
||||
Function,+,furi_hal_serial_send_break,void,FuriHalSerialHandle*
|
||||
Function,+,furi_hal_serial_set_br,void,"FuriHalSerialHandle*, uint32_t"
|
||||
Function,+,furi_hal_serial_suspend,void,FuriHalSerialHandle*
|
||||
Function,+,furi_hal_serial_tx,void,"FuriHalSerialHandle*, const uint8_t*, size_t"
|
||||
|
||||
|
@@ -950,3 +950,13 @@ const GpioPin*
|
||||
|
||||
return furi_hal_serial_config[handle->id].gpio[direction];
|
||||
}
|
||||
|
||||
void furi_hal_serial_send_break(FuriHalSerialHandle* handle) {
|
||||
furi_check(handle);
|
||||
|
||||
if(handle->id == FuriHalSerialIdUsart) {
|
||||
LL_USART_RequestBreakSending(USART1);
|
||||
} else {
|
||||
LL_LPUART_RequestBreakSending(LPUART1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +239,12 @@ void furi_hal_serial_dma_rx_stop(FuriHalSerialHandle* handle);
|
||||
*/
|
||||
size_t furi_hal_serial_dma_rx(FuriHalSerialHandle* handle, uint8_t* data, size_t len);
|
||||
|
||||
/** Send a break sequence (low level for the whole character duration)
|
||||
*
|
||||
* @param handle Serial handle
|
||||
*/
|
||||
void furi_hal_serial_send_break(FuriHalSerialHandle* handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -122,7 +122,7 @@ static const struct CdcConfigDescriptorSingle cdc_cfg_desc_single = {
|
||||
.bFunctionLength = sizeof(struct usb_cdc_acm_desc),
|
||||
.bDescriptorType = USB_DTYPE_CS_INTERFACE,
|
||||
.bDescriptorSubType = USB_DTYPE_CDC_ACM,
|
||||
.bmCapabilities = 0,
|
||||
.bmCapabilities = USB_CDC_CAP_BRK,
|
||||
},
|
||||
.cdc_union =
|
||||
{
|
||||
@@ -235,7 +235,7 @@ static const struct CdcConfigDescriptorDual
|
||||
.bFunctionLength = sizeof(struct usb_cdc_acm_desc),
|
||||
.bDescriptorType = USB_DTYPE_CS_INTERFACE,
|
||||
.bDescriptorSubType = USB_DTYPE_CDC_ACM,
|
||||
.bmCapabilities = 0,
|
||||
.bmCapabilities = USB_CDC_CAP_BRK,
|
||||
},
|
||||
.cdc_union =
|
||||
{
|
||||
@@ -330,7 +330,7 @@ static const struct CdcConfigDescriptorDual
|
||||
.bFunctionLength = sizeof(struct usb_cdc_acm_desc),
|
||||
.bDescriptorType = USB_DTYPE_CS_INTERFACE,
|
||||
.bDescriptorSubType = USB_DTYPE_CDC_ACM,
|
||||
.bmCapabilities = 0,
|
||||
.bmCapabilities = USB_CDC_CAP_BRK,
|
||||
},
|
||||
.cdc_union =
|
||||
{
|
||||
@@ -680,6 +680,13 @@ static usbd_respond cdc_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_cal
|
||||
dev->status.data_ptr = &cdc_config[if_num];
|
||||
dev->status.data_count = sizeof(cdc_config[0]);
|
||||
return usbd_ack;
|
||||
case USB_CDC_SEND_BREAK:
|
||||
if(callbacks[if_num] != NULL) {
|
||||
if(callbacks[if_num]->break_callback != NULL) {
|
||||
callbacks[if_num]->break_callback(cb_ctx[if_num], req->wValue);
|
||||
}
|
||||
}
|
||||
return usbd_ack;
|
||||
default:
|
||||
return usbd_fail;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ typedef struct {
|
||||
void (*state_callback)(void* context, uint8_t state);
|
||||
void (*ctrl_line_callback)(void* context, uint8_t state);
|
||||
void (*config_callback)(void* context, struct usb_cdc_line_coding* config);
|
||||
void (*break_callback)(void* context, uint16_t duration);
|
||||
} CdcCallbacks;
|
||||
|
||||
void furi_hal_cdc_set_callbacks(uint8_t if_num, CdcCallbacks* cb, void* context);
|
||||
|
||||
Reference in New Issue
Block a user