-
Notifications
You must be signed in to change notification settings - Fork 3k
Add UBLOX_onboard_modem_api for power up UBLOX_C027. #12610
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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
This file contains hidden or 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
62 changes: 62 additions & 0 deletions
62
targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/UBLOX_onboard_modem_api.c
This file contains hidden or 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,62 @@ | ||
| /* mbed Microcontroller Library | ||
| * Copyright (c) 2020 ARM Limited | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #if MBED_CONF_NSAPI_PRESENT | ||
|
|
||
| #include "UBLOX_onboard_modem_api.h" | ||
| #include "gpio_api.h" | ||
| #include "platform/mbed_wait_api.h" | ||
| #include "platform/mbed_thread.h" | ||
| #include "PinNames.h" | ||
|
|
||
| static void press_power_button(time_ms) | ||
| { | ||
| gpio_t gpio; | ||
|
|
||
| gpio_init_out_ex(&gpio, MDMPWRON, 0); | ||
| thread_sleep_for(time_ms); | ||
| gpio_write(&gpio, 1); | ||
| } | ||
|
|
||
| void onboard_modem_init() | ||
| { | ||
| //currently USB is not supported, so pass 0 to disable USB | ||
| //This call does everything except actually pressing the power button | ||
| ublox_mdm_powerOn(0); | ||
| } | ||
|
|
||
| void onboard_modem_deinit() | ||
| { | ||
| ublox_mdm_powerOff(); | ||
| } | ||
|
|
||
| void onboard_modem_power_up() | ||
| { | ||
| /* keep the power line low for 150 microseconds */ | ||
| press_power_button(150); | ||
|
|
||
| /* give modem a little time to respond */ | ||
| thread_sleep_for(100); | ||
| } | ||
|
|
||
| void onboard_modem_power_down() | ||
| { | ||
| /* keep the power line low for 1 seconds */ | ||
| press_power_button(1000); | ||
| } | ||
|
|
||
| #endif //MBED_CONF_NSAPI_PRESENT |
54 changes: 54 additions & 0 deletions
54
targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/UBLOX_onboard_modem_api.h
This file contains hidden or 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,54 @@ | ||
| /* mbed Microcontroller Library | ||
| * Copyright (c) 2020 ARM Limited | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef UBLOX_ONBOARD_MODEM_API_H_ | ||
| #define UBLOX_ONBOARD_MODEM_API_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| /** Sets the modem up for powering on | ||
| * modem_init() will be equivalent to plugging in the device, i.e., | ||
| * attaching power and serial port. | ||
| */ | ||
| void onboard_modem_init(void); | ||
|
|
||
| /** Sets the modem in unplugged state | ||
| * modem_deinit() will be equivalent to pulling the plug off of the device, i.e., | ||
| * detaching power and serial port. | ||
| * This puts the modem in lowest power state. | ||
| */ | ||
| void onboard_modem_deinit(void); | ||
|
|
||
| /** Powers up the modem | ||
| * modem_power_up() will be equivalent to pressing the soft power button. | ||
| * The driver may repeat this if the modem is not responsive to AT commands. | ||
|
|
||
| */ | ||
| void onboard_modem_power_up(void); | ||
|
|
||
| /** Powers down the modem | ||
| * modem_power_down() will be equivalent to turning off the modem by button press. | ||
| */ | ||
| void onboard_modem_power_down(void); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* UBLOX_ONBOARD_MODEM_API_H_ */ | ||
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.
Uh oh!
There was an error while loading. Please reload this page.