mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -12,6 +12,7 @@ extern "C" {
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum {
|
||||
FuriHalPwmOutputIdNone,
|
||||
FuriHalPwmOutputIdTim1PA7,
|
||||
FuriHalPwmOutputIdLptim2PA4,
|
||||
} FuriHalPwmOutputId;
|
||||
|
||||
@@ -73,6 +73,7 @@ const GpioPinRecord gpio_pins[] = {
|
||||
{.pin = &gpio_ext_pa7,
|
||||
.name = "PA7",
|
||||
.channel = FuriHalAdcChannel12,
|
||||
.pwm_output = FuriHalPwmOutputIdTim1PA7,
|
||||
.number = 2,
|
||||
.debug = false},
|
||||
{.pin = &gpio_ext_pa6,
|
||||
@@ -83,6 +84,7 @@ const GpioPinRecord gpio_pins[] = {
|
||||
{.pin = &gpio_ext_pa4,
|
||||
.name = "PA4",
|
||||
.channel = FuriHalAdcChannel9,
|
||||
.pwm_output = FuriHalPwmOutputIdLptim2PA4,
|
||||
.number = 4,
|
||||
.debug = false},
|
||||
{.pin = &gpio_ext_pb3,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal_adc.h>
|
||||
#include <furi_hal_pwm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -40,6 +41,7 @@ typedef struct {
|
||||
const GpioPin* pin;
|
||||
const char* name;
|
||||
const FuriHalAdcChannel channel;
|
||||
const FuriHalPwmOutputId pwm_output;
|
||||
const uint8_t number;
|
||||
const bool debug;
|
||||
} GpioPinRecord;
|
||||
|
||||
@@ -392,10 +392,11 @@ static void cdc_on_suspend(usbd_device* dev);
|
||||
|
||||
static usbd_respond cdc_ep_config(usbd_device* dev, uint8_t cfg);
|
||||
static usbd_respond cdc_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_callback* callback);
|
||||
|
||||
static usbd_device* usb_dev;
|
||||
static FuriHalUsbInterface* cdc_if_cur = NULL;
|
||||
static bool connected = false;
|
||||
static CdcCallbacks* callbacks[IF_NUM_MAX] = {NULL};
|
||||
static volatile FuriHalUsbInterface* cdc_if_cur = NULL;
|
||||
static volatile bool connected = false;
|
||||
static volatile CdcCallbacks* callbacks[IF_NUM_MAX] = {NULL};
|
||||
static void* cb_ctx[IF_NUM_MAX];
|
||||
|
||||
FuriHalUsbInterface usb_cdc_single = {
|
||||
@@ -506,8 +507,10 @@ uint8_t furi_hal_cdc_get_ctrl_line_state(uint8_t if_num) {
|
||||
void furi_hal_cdc_send(uint8_t if_num, uint8_t* buf, uint16_t len) {
|
||||
if(if_num == 0) {
|
||||
usbd_ep_write(usb_dev, CDC0_TXD_EP, buf, len);
|
||||
} else {
|
||||
} else if(if_num == 1) {
|
||||
usbd_ep_write(usb_dev, CDC1_TXD_EP, buf, len);
|
||||
} else {
|
||||
furi_crash();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,8 +518,10 @@ int32_t furi_hal_cdc_receive(uint8_t if_num, uint8_t* buf, uint16_t max_len) {
|
||||
int32_t len = 0;
|
||||
if(if_num == 0) {
|
||||
len = usbd_ep_read(usb_dev, CDC0_RXD_EP, buf, max_len);
|
||||
} else {
|
||||
} else if(if_num == 1) {
|
||||
len = usbd_ep_read(usb_dev, CDC1_RXD_EP, buf, max_len);
|
||||
} else {
|
||||
furi_crash();
|
||||
}
|
||||
return (len < 0) ? 0 : len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user