Skip to content

Commit 2970e5c

Browse files
committed
Add qspi_init_direct() function to HAL API
1 parent ba12228 commit 2970e5c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

hal/qspi_api.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ extern "C" {
3939
*/
4040
typedef struct qspi_s qspi_t;
4141

42+
typedef struct {
43+
int peripheral;
44+
PinName data0_pin;
45+
int data0_function;
46+
PinName data1_pin;
47+
int data1_function;
48+
PinName data2_pin;
49+
int data2_function;
50+
PinName data3_pin;
51+
int data3_function;
52+
PinName sclk_pin;
53+
int sclk_function;
54+
PinName ssel_pin;
55+
int ssel_function;
56+
} qspi_pinmap_t;
57+
4258
/** QSPI Bus width
4359
*
4460
* Some parts of commands provide variable bus width
@@ -124,6 +140,20 @@ typedef enum qspi_status {
124140
*/
125141
qspi_status_t qspi_init(qspi_t *obj, PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel, uint32_t hz, uint8_t mode);
126142

143+
/** Initialize QSPI peripheral.
144+
*
145+
* It should initialize QSPI pins (io0-io3, sclk and ssel), set frequency, clock polarity and phase mode. The clock for the peripheral should be enabled
146+
*
147+
* @param obj QSPI object
148+
* @param pinmap pointer to structure which holds static pinmap
149+
* @param hz The bus frequency
150+
* @param mode Clock polarity and phase mode (0 - 3)
151+
* @return QSPI_STATUS_OK if initialisation successfully executed
152+
QSPI_STATUS_INVALID_PARAMETER if invalid parameter found
153+
QSPI_STATUS_ERROR otherwise
154+
*/
155+
qspi_status_t qspi_init_direct(qspi_t *obj, const qspi_pinmap_t *pinmap, uint32_t hz, uint8_t mode);
156+
127157
/** Deinitilize QSPI peripheral
128158
*
129159
* It should release pins that are associated with the QSPI object, and disable clocks for QSPI peripheral module that was associated with the object

0 commit comments

Comments
 (0)