Flipper Zero Firmware
Loading...
Searching...
No Matches
expansion.h File Reference

Expansion module support library. More...

#include <furi_hal_serial_types.h>

Go to the source code of this file.

Macros

#define RECORD_EXPANSION   "expansion"
 FURI record key to access the expansion object.
 

Typedefs

typedef struct Expansion Expansion
 Expansion opaque type declaration.
 

Functions

void expansion_enable (Expansion *instance)
 Enable support for expansion modules.
 
void expansion_disable (Expansion *instance)
 Disable support for expansion modules.
 
void expansion_set_listen_serial (Expansion *instance, FuriHalSerialId serial_id)
 Enable support for expansion modules on designated serial port.
 

Detailed Description

Expansion module support library.

Function Documentation

◆ expansion_disable()

void expansion_disable ( Expansion * instance)

Disable support for expansion modules.

Calling this function will cease all communications with the expansion module (if any), release the serial handle and reset the respective pins to the default state.

Note
Applications requiring serial port access MUST call this function BEFORE calling furi_hal_serial_control_acquire(). Similarly, an expansion_enable() call MUST be made right AFTER a call to furi_hal_serial_control_release() to ensure that the user settings are properly restored.
Parameters
[in,out]instancepointer to the Expansion instance.

◆ expansion_enable()

void expansion_enable ( Expansion * instance)

Enable support for expansion modules.

Calling this function will load user settings and enable expansion module support on the serial port specified in said settings.

If expansion module support was disabled in settings, this function does nothing.

Parameters
[in,out]instancepointer to the Expansion instance.

◆ expansion_set_listen_serial()

void expansion_set_listen_serial ( Expansion * instance,
FuriHalSerialId serial_id )

Enable support for expansion modules on designated serial port.

Only one serial port can be used to communicate with an expansion module at a time.

Calling this function when expansion module support is already enabled will first disable the previous setting, then enable the current one.

Warning
This function does not respect user settings for expansion modules, so calling it might leave the system in inconsistent state. Avoid using it unless absolutely necessary.
Parameters
[in,out]instancepointer to the Expansion instance.
[in]serial_idnumerical identifier of the serial.