pulse_reader: add call to set GPIO pull direction

This commit is contained in:
g3gg0.de
2022-12-28 14:40:29 +01:00
parent 85fa0004fe
commit 60f56cc048
3 changed files with 20 additions and 3 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,11.3,,
Version,+,11.4,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@@ -563,8 +563,8 @@ Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t
Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t"
Function,+,bt_disconnect,void,Bt*
Function,+,bt_forget_bonded_devices,void,Bt*
Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*"
Function,+,bt_keys_storage_set_default_path,void,Bt*
Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*"
Function,+,bt_set_profile,_Bool,"Bt*, BtProfile"
Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*"
Function,+,buffered_file_stream_alloc,Stream*,Storage*
@@ -2104,6 +2104,7 @@ Function,-,pulse_reader_free,void,PulseReader*
Function,-,pulse_reader_receive,uint32_t,"PulseReader*, int"
Function,-,pulse_reader_samples,uint32_t,PulseReader*
Function,-,pulse_reader_set_bittime,void,"PulseReader*, uint32_t"
Function,-,pulse_reader_set_pull,void,"PulseReader*, GpioPull"
Function,-,pulse_reader_set_timebase,void,"PulseReader*, PulseReaderUnit"
Function,-,pulse_reader_start,void,PulseReader*
Function,-,pulse_reader_stop,void,PulseReader*
1 entry status name type params
2 Version + 11.3 11.4
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
563 Function - bsearch void* const void*, const void*, size_t, size_t, __compar_fn_t
564 Function + bt_disconnect void Bt*
565 Function + bt_forget_bonded_devices void Bt*
Function + bt_keys_storage_set_storage_path void Bt*, const char*
566 Function + bt_keys_storage_set_default_path void Bt*
567 Function + bt_keys_storage_set_storage_path void Bt*, const char*
568 Function + bt_set_profile _Bool Bt*, BtProfile
569 Function + bt_set_status_changed_callback void Bt*, BtStatusChangedCallback, void*
570 Function + buffered_file_stream_alloc Stream* Storage*
2104 Function - pulse_reader_receive uint32_t PulseReader*, int
2105 Function - pulse_reader_samples uint32_t PulseReader*
2106 Function - pulse_reader_set_bittime void PulseReader*, uint32_t
2107 Function - pulse_reader_set_pull void PulseReader*, GpioPull
2108 Function - pulse_reader_set_timebase void PulseReader*, PulseReaderUnit
2109 Function - pulse_reader_start void PulseReader*
2110 Function - pulse_reader_stop void PulseReader*
+6 -1
View File
@@ -31,6 +31,7 @@ PulseReader* pulse_reader_alloc(const GpioPin* gpio, uint32_t size) {
signal->gpio_buffer = malloc(size * sizeof(uint32_t));
signal->dma_channel = LL_DMA_CHANNEL_4;
signal->gpio = gpio;
signal->pull = GpioPullNo;
signal->size = size;
signal->timer_value = 0;
signal->pos = 0;
@@ -88,6 +89,10 @@ void pulse_reader_set_bittime(PulseReader* signal, uint32_t bit_time) {
signal->bit_time = bit_time;
}
void pulse_reader_set_pull(PulseReader* signal, GpioPull pull) {
signal->pull = pull;
}
void pulse_reader_free(PulseReader* signal) {
free(signal->timer_buffer);
free(signal->gpio_buffer);
@@ -134,7 +139,7 @@ void pulse_reader_start(PulseReader* signal) {
/* we need the EXTI to be configured as interrupt generating line, but no ISR registered */
furi_hal_gpio_init_ex(
signal->gpio, GpioModeInterruptRiseFall, GpioPullNo, GpioSpeedVeryHigh, GpioAltFnUnused);
signal->gpio, GpioModeInterruptRiseFall, signal->pull, GpioSpeedVeryHigh, GpioAltFnUnused);
/* capture current timer */
signal->pos = 0;
+11
View File
@@ -41,6 +41,7 @@ typedef struct {
uint32_t bit_time;
uint32_t dma_channel;
const GpioPin* gpio;
GpioPull pull;
LL_DMA_InitTypeDef dma_config_timer;
LL_DMA_InitTypeDef dma_config_gpio;
} PulseReader;
@@ -125,6 +126,16 @@ void pulse_reader_set_timebase(PulseReader* signal, PulseReaderUnit unit);
*/
void pulse_reader_set_bittime(PulseReader* signal, uint32_t bit_time);
/** Set GPIO pull direction
*
* Some GPIOs need pulldown, others don't. By default the
* pull direction is GpioPullNo.
*
* @param[in] signal previously allocated PulseReader object.
* @param[in] pull GPIO pull direction
*/
void pulse_reader_set_pull(PulseReader* signal, GpioPull pull);
#ifdef __cplusplus
}
#endif