-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bsp][lpc55sxx]add: rw007_lpc55sxx_port.c #7450
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
bsp/lpc55sxx/lpc55s69_nxp_evk/board/ports/rw007_lpc55sxx_port.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2006-2023, RT-Thread Development Team | ||
Z8MAN8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2023-05-06 ChuShicheng the first version | ||
*/ | ||
|
||
#include <rtthread.h> | ||
Z8MAN8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <rtdevice.h> | ||
#include <drv_pin.h> | ||
#include <board.h> | ||
#include <spi_wifi_rw007.h> | ||
|
||
extern void spi_wifi_isr(int vector); | ||
|
||
#define RW007_INT_BUSY_PIN GET_PINS(1, 5) | ||
#define RW007_RST_PIN GET_PINS(1, 8) | ||
|
||
static void rw007_gpio_init(void) | ||
{ | ||
/* Configure IO */ | ||
rt_pin_mode(RW007_RST_PIN, PIN_MODE_OUTPUT); | ||
rt_pin_mode(RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLDOWN); | ||
|
||
/* Reset rw007 and config mode */ | ||
rt_pin_write(RW007_RST_PIN, PIN_LOW); | ||
rt_thread_delay(rt_tick_from_millisecond(100)); | ||
rt_pin_write(RW007_RST_PIN, PIN_HIGH); | ||
|
||
/* Wait rw007 ready(exit busy stat) */ | ||
while(!rt_pin_read(RW007_INT_BUSY_PIN)) | ||
{ | ||
rt_thread_delay(5); | ||
} | ||
|
||
rt_thread_delay(rt_tick_from_millisecond(200)); | ||
rt_pin_mode(RW007_INT_BUSY_PIN, PIN_MODE_INPUT_PULLUP); | ||
} | ||
|
||
int wifi_spi_device_init(void) | ||
{ | ||
char sn_version[32]; | ||
|
||
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t pin); | ||
|
||
rw007_gpio_init(); | ||
rt_hw_spi_device_attach("spi8", "wspi", GET_PINS(1, 1)); | ||
rt_hw_wifi_init("wspi"); | ||
|
||
rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION); | ||
rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP); | ||
|
||
rw007_sn_get(sn_version); | ||
rt_kprintf("\nrw007 sn: [%s]\n", sn_version); | ||
rw007_version_get(sn_version); | ||
rt_kprintf("rw007 ver: [%s]\n\n", sn_version); | ||
|
||
return 0; | ||
} | ||
INIT_APP_EXPORT(wifi_spi_device_init); | ||
|
||
static void int_wifi_irq(void * p) | ||
{ | ||
((void)p); | ||
spi_wifi_isr(0); | ||
} | ||
|
||
void spi_wifi_hw_init(void) | ||
{ | ||
rt_pin_attach_irq(RW007_INT_BUSY_PIN, PIN_IRQ_MODE_FALLING, int_wifi_irq, 0); | ||
rt_pin_irq_enable(RW007_INT_BUSY_PIN, RT_TRUE); | ||
} | ||
|
||
|
||
Z8MAN8 marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.path.join(cwd, 'MCUX_Config', 'board')