Remove Ublox targets

pull/12935/head
Marcelo Salazar 2020-05-06 16:39:29 +01:00
parent c064035464
commit 4083469d09
43 changed files with 0 additions and 2965 deletions

View File

@ -163,15 +163,6 @@
"RZ_A1H": {
"target.macros_add" : ["MBEDTLS_TEST_NULL_ENTROPY", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES"]
},
"UBLOX_C030_U201": {
"target.features_add" : ["STORAGE", "LWIP"],
"target.network-default-interface-type" : "CELLULAR",
"lwip.ipv4-enabled" : true,
"lwip.ethernet-enabled" : false,
"lwip.ppp-enabled" : true,
"lwip.tcp-enabled" : true,
"mbed-trace.enable" : false
},
"WIO_EMW3166": {
"target.components_add" : ["SPIF"],
"spif-driver.SPI_MOSI" : "PB_15",

View File

@ -95,12 +95,6 @@
"SPI_CLK": "p15",
"SPI_CS": "p14"
},
"UBLOX_C030": {
"SPI_MOSI": "D11",
"SPI_MISO": "D12",
"SPI_CLK": "D13",
"SPI_CS": "D10"
},
"RZ_A1H": {
"SPI_MOSI": "P8_5",
"SPI_MISO": "P8_6",

View File

@ -165,9 +165,6 @@
"LPC1768": {
"mem-size": 16362
},
"UBLOX_C027": {
"mem-size": 16362
},
"ARCH_PRO": {
"mem-size": 16362
},

View File

@ -1,61 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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.
*/
#include "stm32f4xx_hal.h"
void _eth_config_mac(ETH_HandleTypeDef *heth)
{
ETH_MACInitTypeDef macconf =
{
.Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
.CarrierSense = ETH_CARRIERSENCE_ENABLE,
.ReceiveOwn = ETH_RECEIVEOWN_ENABLE,
.LoopbackMode = ETH_LOOPBACKMODE_DISABLE,
.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE,
.RetryTransmission = ETH_RETRYTRANSMISSION_DISABLE,
.AutomaticPadCRCStrip = ETH_AUTOMATICPADCRCSTRIP_DISABLE,
.BackOffLimit = ETH_BACKOFFLIMIT_10,
.DeferralCheck = ETH_DEFFERRALCHECK_DISABLE,
.ReceiveAll = ETH_RECEIVEAll_DISABLE,
.SourceAddrFilter = ETH_SOURCEADDRFILTER_DISABLE,
.PassControlFrames = ETH_PASSCONTROLFRAMES_BLOCKALL,
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
.PauseTime = 0x0U,
.ZeroQuantaPause = ETH_ZEROQUANTAPAUSE_DISABLE,
.PauseLowThreshold = ETH_PAUSELOWTHRESHOLD_MINUS4,
.UnicastPauseFrameDetect = ETH_UNICASTPAUSEFRAMEDETECT_DISABLE,
.ReceiveFlowControl = ETH_RECEIVEFLOWCONTROL_DISABLE,
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U
};
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;
} else {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_DISABLE;
}
(void) HAL_ETH_ConfigMAC(heth, &macconf);
}

View File

@ -1,143 +0,0 @@
#include <string.h>
#include "stm32f4xx_hal.h"
#include "mbed_toolchain.h"
#define C029_OTP_START_ADDRESS (0x1FFF7800U)
#define C029_OTP_END_ADDRESS (C029_OTP_START_ADDRESS + (16*32))
#define C029_MAC_ETHERNET_ID (3)
typedef MBED_PACKED(struct) C029_OTP_Header {
uint8_t id;
uint8_t len;
uint8_t data[];
} C029_OTP_Header;
static int _macRetrieved = 0;
static char _macAddr[6] = { 0x02, 0x02, 0xF7, 0xF0, 0x00, 0x00 };
static C029_OTP_Header *increment(C029_OTP_Header *pTemp)
{
uint8_t len = 0;
uint8_t id = 0;
uint8_t *p = (uint8_t*)pTemp;
memcpy((void*)&id, (void*)pTemp, 1);
if (id == 0xFF){
p++;
} else {
p++;
memcpy((void*)&len, (void*)p++, 1);
p += len;
}
return (C029_OTP_Header*)p;
}
/**
* Override HAL Eth Init function
*/
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
{
GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) {
/* Enable GPIOs clocks */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
/** ETH GPIO Configuration
RMII_REF_CLK ----------------------> PA1
RMII_MDIO -------------------------> PA2
RMII_MDC --------------------------> PC1
RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> PG2
RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13
*/
/* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_7;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB13 */
GPIO_InitStructure.Pin = GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure PC1, PC4 and PC5 */
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE();
}
}
/**
* Override HAL Eth DeInit function
*/
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
{
if (heth->Instance == ETH) {
/* Peripheral clock disable */
__HAL_RCC_ETH_CLK_DISABLE();
/** ETH GPIO Configuration
RMII_REF_CLK ----------------------> PA1
RMII_MDIO -------------------------> PA2
RMII_MDC --------------------------> PC1
RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> PG2
RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
/* Disable the Ethernet global Interrupt */
NVIC_DisableIRQ(ETH_IRQn);
}
}
uint8_t mbed_otp_mac_address(char *mac)
{
C029_OTP_Header *pFound = NULL;
C029_OTP_Header *pTemp = (C029_OTP_Header*)C029_OTP_START_ADDRESS;
C029_OTP_Header temp;
if (_macRetrieved == 0) {
while ((pTemp >= (C029_OTP_Header*)C029_OTP_START_ADDRESS) && (pTemp < (C029_OTP_Header*)C029_OTP_END_ADDRESS)){
memcpy((void*)&temp, (void*)pTemp, sizeof(temp));
if (temp.id == C029_MAC_ETHERNET_ID){
pFound = pTemp;
break;
}
pTemp = increment(pTemp);
}
if (pFound != NULL) {
memcpy(_macAddr, pFound->data, 6);
_macRetrieved = 1;
}
}
memcpy(mac, _macAddr, 6);
return 1;
}

View File

@ -1,324 +0,0 @@
/*---------------------------------------------------------------------------
* Copyright (c) 2019, u-blox Malmö, All Rights Reserved
* 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 DEVICE_WIFI
#include "mbed_interface.h"
#include "mbed_assert.h"
#include "netsocket/nsapi_types.h"
#include "wifi_emac.h"
#include "cb_wlan_target_data.h"
#include "cb_wlan_types.h"
#include "cb_wlan.h"
#include "cb_otp.h"
#include "cb_main.h"
#define OdinWiFiEMAC_MTU_SIZE (1500U)
static const char _ifname[] = "WL0";
cb_boolean handleWlanTargetCopyFromDataFrame(uint8_t* buffer, cbWLANTARGET_dataFrame* frame, uint32_t size, uint32_t offsetInFrame);
cb_boolean handleWlanTargetCopyToDataFrame(cbWLANTARGET_dataFrame* frame, uint8_t* buffer, uint32_t size, uint32_t offsetInFrame);
cbWLANTARGET_dataFrame* handleWlanTargetAllocDataFrame(uint32_t size);
void handleWlanTargetFreeDataFrame(cbWLANTARGET_dataFrame* frame);
cb_uint32 handleWlanTargetGetDataFrameSize(cbWLANTARGET_dataFrame* frame);
cb_uint8 handleWlanTargetGetDataFrameTID(cbWLANTARGET_dataFrame* frame);
void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data);
void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo);
void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf);
static const cbWLANTARGET_Callback _wlanTargetCallback =
{
handleWlanTargetCopyFromDataFrame,
handleWlanTargetCopyToDataFrame,
handleWlanTargetAllocDataFrame,
handleWlanTargetFreeDataFrame,
handleWlanTargetGetDataFrameSize,
handleWlanTargetGetDataFrameTID
};
void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data)
{
OdinWiFiEMAC &instance = OdinWiFiEMAC::get_instance();
bool linkUp = false;
bool sendCb = true;
(void)dummy;
(void)data;
switch (status) {
case cbWLAN_STATUS_CONNECTED:
case cbWLAN_STATUS_AP_UP:
linkUp = true;
break;
case cbWLAN_STATUS_STOPPED:
case cbWLAN_STATUS_ERROR:
case cbWLAN_STATUS_DISCONNECTED:
case cbWLAN_STATUS_CONNECTION_FAILURE:
case cbWLAN_STATUS_AP_DOWN:
break;
case cbWLAN_STATUS_CONNECTING:
default:
sendCb = false;
break;
}
if (sendCb && instance.emac_link_state_cb) {
instance.emac_link_state_cb(linkUp);
}
}
void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo)
{
OdinWiFiEMAC &instance = OdinWiFiEMAC::get_instance();
(void)dummy;
if (instance.emac_link_input_cb) {
instance.emac_link_input_cb((void*)packetInfo->rxData);
}
}
cb_boolean handleWlanTargetCopyFromDataFrame(uint8_t* buffer, cbWLANTARGET_dataFrame* frame, uint32_t size, uint32_t offsetInFrame)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
MBED_ASSERT(mem != NULL);
emac_mem_buf_t* phead = static_cast<emac_mem_buf_t *>(frame);
emac_mem_buf_t* pbuf;
uint32_t copySize, bytesCopied = 0, pbufOffset = 0;
MBED_ASSERT(frame != NULL);
MBED_ASSERT(buffer != NULL);
pbuf = phead;
while (pbuf != NULL) {
if ((pbufOffset + mem->get_len(pbuf)) >= offsetInFrame) {
copySize = cb_MIN(size, mem->get_len(pbuf) - (offsetInFrame - pbufOffset));
memcpy(buffer, (int8_t *)mem->get_ptr(pbuf) + (offsetInFrame - pbufOffset), copySize);
buffer += copySize;
bytesCopied += copySize;
pbuf = mem->get_next(pbuf);
break;
}
pbufOffset += mem->get_len(pbuf);
pbuf = mem->get_next(pbuf);
}
while (pbuf != NULL && bytesCopied < size) {
copySize = cb_MIN(mem->get_len(pbuf), size - bytesCopied);
memcpy(buffer, mem->get_ptr(pbuf), copySize);
buffer += copySize;
bytesCopied += copySize;
pbuf = mem->get_next(pbuf);
}
MBED_ASSERT(bytesCopied <= size);
return (bytesCopied == size);
}
cb_boolean handleWlanTargetCopyToDataFrame(cbWLANTARGET_dataFrame* frame, uint8_t* buffer, uint32_t size, uint32_t offsetInFrame)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
MBED_ASSERT(mem != NULL);
emac_mem_buf_t* phead = static_cast<emac_mem_buf_t *>(frame);
emac_mem_buf_t* pbuf;
uint32_t copySize, bytesCopied = 0, pbufOffset = 0;
MBED_ASSERT(frame != NULL);
MBED_ASSERT(buffer != NULL);
pbuf = phead;
while (pbuf != NULL) {
if ((pbufOffset + mem->get_len(pbuf)) >= offsetInFrame) {
copySize = cb_MIN(size, mem->get_len(pbuf) - (offsetInFrame - pbufOffset));
memcpy((uint8_t *)mem->get_ptr(pbuf) + (offsetInFrame - pbufOffset), buffer, copySize);
buffer += copySize;
bytesCopied += copySize;
pbuf = mem->get_next(pbuf);
break;
}
pbufOffset += mem->get_len(pbuf);
pbuf = mem->get_next(pbuf);
}
while (pbuf != NULL && bytesCopied < size) {
copySize = cb_MIN(mem->get_len(pbuf), size - bytesCopied);
memcpy(mem->get_ptr(pbuf), buffer, copySize);
buffer += copySize;
bytesCopied += copySize;
pbuf = mem->get_next(pbuf);
}
MBED_ASSERT(bytesCopied <= size);
return (bytesCopied == size);
}
cbWLANTARGET_dataFrame* handleWlanTargetAllocDataFrame(uint32_t size)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
MBED_ASSERT(mem != NULL);
return (cbWLANTARGET_dataFrame*)mem->alloc_pool(size, 0);
}
void handleWlanTargetFreeDataFrame(cbWLANTARGET_dataFrame* frame)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
MBED_ASSERT(mem != NULL);
mem->free(static_cast<emac_mem_buf_t *>(frame));
}
uint32_t handleWlanTargetGetDataFrameSize(cbWLANTARGET_dataFrame* frame)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
MBED_ASSERT(mem != NULL);
return mem->get_total_len(static_cast<emac_mem_buf_t *>(frame));
}
uint8_t handleWlanTargetGetDataFrameTID(cbWLANTARGET_dataFrame* frame)
{
(void)frame;
return (uint8_t)cbWLAN_AC_BE;
}
OdinWiFiEMAC::OdinWiFiEMAC()
{
emac_link_input_cb = NULL;
emac_link_state_cb = NULL;
cbWLANTARGET_registerCallbacks((cbWLANTARGET_Callback*)&_wlanTargetCallback);
}
cbWLAN_Handle OdinWiFiEMAC::get_wifi_emac_handle()
{
return this->handle;
}
void OdinWiFiEMAC::set_wifi_emac_handle(cbWLAN_Handle _handle)
{
this->handle = _handle;
}
void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf)
{
cbWLAN_sendPacket(ptr->handle, buf);
}
bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf)
{
EMACMemoryManager *mem = OdinWiFiEMAC::get_instance().memory_manager;
// Break call chain to avoid the driver affecting stack usage for the IP stack thread too much
emac_mem_buf_t *new_buf = mem->alloc_pool(mem->get_total_len(buf), 0);
if (new_buf != NULL) {
mem->copy(new_buf, buf);
int id = cbMAIN_getEventQueue()->call(send_wlan_packet, this, new_buf);
if (id != 0) {
cbMAIN_dispatchEventQueue();
} else {
mem->free(new_buf);
}
}
mem->free(buf);
return true;
}
bool OdinWiFiEMAC::power_up()
{
/* Initialize the hardware */
/* No-op at this stage */
return true;
}
uint32_t OdinWiFiEMAC::get_mtu_size() const
{
return OdinWiFiEMAC_MTU_SIZE;
}
void OdinWiFiEMAC::get_ifname(char *name, uint8_t size) const
{
memcpy(name, _ifname, (size < sizeof(_ifname)) ? size : sizeof(_ifname));
}
uint8_t OdinWiFiEMAC::get_hwaddr_size() const
{
return sizeof(cbWLAN_MACAddress);
}
bool OdinWiFiEMAC::get_hwaddr(uint8_t *addr) const
{
cbOTP_read(cbOTP_MAC_WLAN, sizeof(cbWLAN_MACAddress), addr);
return true;
}
void OdinWiFiEMAC::set_hwaddr(const uint8_t *addr)
{
/* No-op at this stage */
}
void OdinWiFiEMAC::set_link_input_cb(emac_link_input_cb_t input_cb)
{
emac_link_input_cb = input_cb;
cbMAIN_driverLock();
cbWLAN_registerPacketIndicationCallback(get_wifi_emac_handle(), handleWlanPacketIndication, NULL);
cbMAIN_driverUnlock();
}
void OdinWiFiEMAC::set_link_state_cb(emac_link_state_change_cb_t state_cb)
{
emac_link_state_cb = state_cb;
cbMAIN_driverLock();
cbWLAN_registerStatusCallback(handleWlanStatusIndication, NULL);
cbMAIN_driverUnlock();
}
void OdinWiFiEMAC::power_down()
{
/* No-op at this stage */
}
void OdinWiFiEMAC::set_memory_manager(EMACMemoryManager &mem_mngr)
{
memory_manager = &mem_mngr;
}
uint32_t OdinWiFiEMAC::get_align_preference() const
{
return 1;
}
void OdinWiFiEMAC::add_multicast_group(const uint8_t *address)
{
}
void OdinWiFiEMAC::remove_multicast_group(const uint8_t *address)
{
}
void OdinWiFiEMAC::set_all_multicast(bool all)
{
}
OdinWiFiEMAC &OdinWiFiEMAC::get_instance() {
static OdinWiFiEMAC emac;
return emac;
}
#endif // DEVICE_WIFI

View File

@ -1,149 +0,0 @@
/* Copyright (c) 2017 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 WIFI_EMAC_H_
#define WIFI_EMAC_H_
#include "EMAC.h"
#include "cb_wlan_target_data.h"
#include "cb_wlan.h"
class OdinWiFiEMAC : public EMAC {
public:
OdinWiFiEMAC();
static OdinWiFiEMAC &get_instance();
/**
* Return maximum transmission unit
*
* @return MTU in bytes
*/
virtual uint32_t get_mtu_size() const;
/**
* Return interface name
*
* @param name Pointer to where the name should be written
* @param size Maximum number of character to copy
*/
virtual void get_ifname(char *name, uint8_t size) const;
/**
* Returns size of the underlying interface HW address size.
*
* @return HW address size in bytes
*/
virtual uint8_t get_hwaddr_size() const;
/**
* Return interface-supplied HW address
*
* Copies HW address to provided memory, @param addr has to be of correct size see @a get_hwaddr_size
*
* HW address need not be provided if this interface does not have its own HW
* address configuration; stack will choose address from central system
* configuration if the function returns false and does not write to addr.
*
* @param addr HW address for underlying interface
* @return true if HW address is available
*/
virtual bool get_hwaddr(uint8_t *addr) const;
/**
* Set HW address for interface
*
* Provided address has to be of correct size, see @a get_hwaddr_size
*
* Called to set the MAC address to actually use - if @a get_hwaddr is provided
* the stack would normally use that, but it could be overridden, eg for test
* purposes.
*
* @param addr Address to be set
*/
virtual void set_hwaddr(const uint8_t *addr);
/**
* Sends the packet over the link
*
* That can not be called from an interrupt context.
*
* @param buf Packet to be send
* @return True if the packet was send successfully, False otherwise
*/
virtual bool link_out(emac_mem_buf_t *buf);
/**
* Initializes the HW
*
* @return True on success, False in case of an error.
*/
virtual bool power_up();
/**
* Deinitializes the HW
*
*/
virtual void power_down();
/**
* Sets a callback that needs to be called for packets received for that interface
*
* @param input_cb Function to be register as a callback
*/
virtual void set_link_input_cb(emac_link_input_cb_t input_cb);
/**
* Sets a callback that needs to be called on link status changes for given interface
*
* @param state_cb Function to be register as a callback
*/
virtual void set_link_state_cb(emac_link_state_change_cb_t state_cb);
/** Sets memory manager that is used to handle memory buffers
*
* @param mem_mngr Pointer to memory manager
*/
virtual void set_memory_manager(EMACMemoryManager &mem_mngr);
virtual uint32_t get_align_preference() const;
virtual void add_multicast_group(const uint8_t *address);
virtual void remove_multicast_group(const uint8_t *address);
virtual void set_all_multicast(bool all);
cbWLAN_Handle get_wifi_emac_handle();
void set_wifi_emac_handle(cbWLAN_Handle _handle);
private:
cbWLAN_Handle handle = cbWLAN_DEFAULT_HANDLE;
emac_link_input_cb_t emac_link_input_cb; /**< Callback for incoming data */
emac_link_state_change_cb_t emac_link_state_cb; /**< Link state change callback */
EMACMemoryManager *memory_manager;
friend cb_boolean handleWlanTargetCopyFromDataFrame(uint8_t* buffer, cbWLANTARGET_dataFrame* frame, uint32_t size, uint32_t offsetInFrame);
friend cb_boolean handleWlanTargetCopyToDataFrame(cbWLANTARGET_dataFrame* frame, uint8_t* buffer, uint32_t size, uint32_t offsetInFrame);
friend cbWLANTARGET_dataFrame* handleWlanTargetAllocDataFrame(uint32_t size);
friend void handleWlanTargetFreeDataFrame(cbWLANTARGET_dataFrame* frame);
friend cb_uint32 handleWlanTargetGetDataFrameSize(cbWLANTARGET_dataFrame* frame);
friend void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data);
friend void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo);
friend void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf);
};
#endif /* WIFI_EMAC_H_ */

View File

@ -1,61 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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.
*/
#include "stm32f4xx_hal.h"
void _eth_config_mac(ETH_HandleTypeDef *heth)
{
ETH_MACInitTypeDef macconf =
{
.Watchdog = ETH_WATCHDOG_ENABLE,
.Jabber = ETH_JABBER_ENABLE,
.InterFrameGap = ETH_INTERFRAMEGAP_96BIT,
.CarrierSense = ETH_CARRIERSENCE_ENABLE,
.ReceiveOwn = ETH_RECEIVEOWN_ENABLE,
.LoopbackMode = ETH_LOOPBACKMODE_DISABLE,
.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE,
.RetryTransmission = ETH_RETRYTRANSMISSION_DISABLE,
.AutomaticPadCRCStrip = ETH_AUTOMATICPADCRCSTRIP_DISABLE,
.BackOffLimit = ETH_BACKOFFLIMIT_10,
.DeferralCheck = ETH_DEFFERRALCHECK_DISABLE,
.ReceiveAll = ETH_RECEIVEAll_DISABLE,
.SourceAddrFilter = ETH_SOURCEADDRFILTER_DISABLE,
.PassControlFrames = ETH_PASSCONTROLFRAMES_BLOCKALL,
.BroadcastFramesReception = ETH_BROADCASTFRAMESRECEPTION_ENABLE,
.DestinationAddrFilter = ETH_DESTINATIONADDRFILTER_NORMAL,
.PromiscuousMode = ETH_PROMISCUOUS_MODE_DISABLE,
.MulticastFramesFilter = ETH_MULTICASTFRAMESFILTER_NONE, // Disable multicast filter
.UnicastFramesFilter = ETH_UNICASTFRAMESFILTER_PERFECT,
.HashTableHigh = 0x0U,
.HashTableLow = 0x0U,
.PauseTime = 0x0U,
.ZeroQuantaPause = ETH_ZEROQUANTAPAUSE_DISABLE,
.PauseLowThreshold = ETH_PAUSELOWTHRESHOLD_MINUS4,
.UnicastPauseFrameDetect = ETH_UNICASTPAUSEFRAMEDETECT_DISABLE,
.ReceiveFlowControl = ETH_RECEIVEFLOWCONTROL_DISABLE,
.TransmitFlowControl = ETH_TRANSMITFLOWCONTROL_DISABLE,
.VLANTagComparison = ETH_VLANTAGCOMPARISON_16BIT,
.VLANTagIdentifier = 0x0U,
};
if (heth->Init.ChecksumMode == ETH_CHECKSUM_BY_HARDWARE) {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_ENABLE;
} else {
macconf.ChecksumOffload = ETH_CHECKSUMOFFLAOD_DISABLE;
}
(void) HAL_ETH_ConfigMAC(heth, &macconf);
}

View File

@ -1,86 +0,0 @@
#include "stm32f4xx_hal.h"
/**
* Override HAL Eth Init function
*/
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
{
GPIO_InitTypeDef GPIO_InitStructure;
if (heth->Instance == ETH) {
/* Enable GPIOs clocks */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
/** ETH GPIO Configuration
RMII_REF_CLK ----------------------> PA1
RMII_MDIO -------------------------> PA2
RMII_MDC --------------------------> PC1
RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> PG2
RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13
*/
/* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_7;
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB13 */
GPIO_InitStructure.Pin = GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure PC1, PC4 and PC5 */
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Enable the Ethernet global Interrupt */
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn);
/* Enable ETHERNET clock */
__HAL_RCC_ETH_CLK_ENABLE();
}
}
/**
* Override HAL Eth DeInit function
*/
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
{
if (heth->Instance == ETH) {
/* Peripheral clock disable */
__HAL_RCC_ETH_CLK_DISABLE();
/** ETH GPIO Configuration
RMII_REF_CLK ----------------------> PA1
RMII_MDIO -------------------------> PA2
RMII_MDC --------------------------> PC1
RMII_MII_CRS_DV -------------------> PA7
RMII_MII_RXD0 ---------------------> PC4
RMII_MII_RXD1 ---------------------> PC5
RMII_MII_RXER ---------------------> PG2
RMII_MII_TX_EN --------------------> PB11
RMII_MII_TXD0 ---------------------> PB12
RMII_MII_TXD1 ---------------------> PB13
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
/* Disable the Ethernet global Interrupt */
NVIC_DisableIRQ(ETH_IRQn);
}
}

View File

@ -197,10 +197,6 @@
"crash-capture-enabled": true,
"fatal-error-auto-reboot-enabled": true
},
"UBLOX_C030_U201": {
"crash-capture-enabled": true,
"fatal-error-auto-reboot-enabled": true
},
"NUMAKER_PFM_M487": {
"crash-capture-enabled": true,
"fatal-error-auto-reboot-enabled": true

View File

@ -1,67 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 "ONBOARD_UBLOX_PPP.h"
#include "UBLOX_onboard_modem_api.h"
#include "drivers/BufferedSerial.h"
#include "CellularLog.h"
using namespace mbed;
ONBOARD_UBLOX_PPP::ONBOARD_UBLOX_PPP(FileHandle *fh) : UBLOX_PPP(fh)
{
}
nsapi_error_t ONBOARD_UBLOX_PPP::hard_power_on()
{
::onboard_modem_init();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::hard_power_off()
{
::onboard_modem_deinit();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::soft_power_on()
{
::onboard_modem_power_up();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::soft_power_off()
{
::onboard_modem_power_down();
return NSAPI_ERROR_OK;
}
CellularDevice *CellularDevice::get_target_default_instance()
{
static BufferedSerial serial(MDMTXD, MDMRXD, 115200);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif
static ONBOARD_UBLOX_PPP device(&serial);
return &device;
}
#endif // MBED_CONF_NSAPI_PRESENT

View File

@ -1,36 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 ONBOARD_UBLOX_PPP_
#define ONBOARD_UBLOX_PPP_
#include "UBLOX_PPP.h"
namespace mbed {
class ONBOARD_UBLOX_PPP : public UBLOX_PPP {
public:
ONBOARD_UBLOX_PPP(FileHandle *fh);
virtual nsapi_error_t hard_power_on();
virtual nsapi_error_t hard_power_off();
virtual nsapi_error_t soft_power_on();
virtual nsapi_error_t soft_power_off();
};
} // namespace mbed
#endif // ONBOARD_UBLOX_PPP_

View File

@ -1,198 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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 MBED_PINNAMES_H
#define MBED_PINNAMES_H
#include "cmsis.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
PIN_INPUT,
PIN_OUTPUT
} PinDirection;
#define PORT_SHIFT 5
typedef enum {
// LPC Pin Names
P0_0 = LPC_GPIO0_BASE,
P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
// Arduino Pin Names
// PIN header connector
// for standard-based form factor with expansion board
// -----------------------------------------------------------
// PMW = Pulswidth Modulator
// EINT = External Interrupt
// AOUT = Analog Output
// Analog Ports (A0-A5)
A0 = P0_23, // I2S_CLK
A1 = P0_24, // I2S_WS
A2 = P0_25, // I2S_SDA
A3 = P0_26, // AOUT
A4 = P1_30, //
A5 = P1_31, //
// Digital Port (D0-D7)
D0 = P4_29, // TXD
D1 = P4_28, // RXD
D2 = P2_13, // EINT
D3 = P2_0, // PWM
D4 = P2_12, // EINT
D5 = P2_1, // PWM
D6 = P2_2, // PWM
D7 = P2_11, // EINT
// Digital Port (D8-D13)
D8 = P2_4, // PWM
D9 = P2_3, // PWM
D10 = P1_21, // PWM SSEL
D11 = P1_24, // PWM MOSI
D12 = P1_23, // PWM MISO
D13 = P1_20, // PWM SCK
// GND
// AREF
SDA = P0_0,
D14 = SDA,
SCL = P0_1,
D15 = SCL,
// I2C (shared with LISA/SARA)
GPSSDA = P0_27,
GPSSCL = P0_28,
// UART
GPSTXD = P0_10,
GPSRXD = P0_11,
// Control
GPSRST = P1_18, // Reset (input to GPS, active low)
GPSPPS = P1_19, // 1PPS Timepulse (output from GPS)
GPSINT = P1_22, // Interrupt (input to GPS)
GPSEN = P1_29, // Supply Control (high = enabled)
// u-blox LISA/SARA cellular modem
// http://www.u-blox.com/wireless-modules.html
// -----------------------------------------------------------
// UART (LPC1768 = DTE, LISA/SARA = DCE)
MDMTXD = P0_15, // Transmit Data
MDMRXD = P0_16, // Receive Data
MDMCTS = P0_17, // Clear to Send
MDMDCD = P0_18, // Data Carrier Detect
MDMDSR = P0_19, // Data Set Ready
MDMDTR = P0_20, // Data Terminal Ready (set high or use handshake)
MDMRI = P0_21, // Ring Indicator
MDMRTS = P0_22, // Request to Send (set high or use handshake)
// USB (not available on C27-G35)
MDMUSBDP = P0_29, // USB D+
MDMUSBDN = P0_30, // USB D-
MDMUSBCON = P2_9, // USB Connect
MDMUSBDET = P0_7, // USB Detect (n/a on REV.A board)
// Control
MDMEN = P2_5, // Supply Control (high = enabled)
MDMPWRON = P2_6, //
MDMGPIO1 = P2_7, // GPIO1, Network status
MDMRST = P2_8, // Reset (active low, set as open drain!)
MDMLVLOE = P0_9, // Serial/GPIO Level Shifter Output Enable (n/a on REV.A board)
MDMILVLOE = P0_8, // I2C Level Shifter Output Enable (n/a on REV.A board)
// CAN (TJA1040)
// -----------------------------------------------------------
CANRD = P0_4,
CANTD = P0_5,
CANS = P0_6, // standby (low=normal, high=standby/rxonly)
// Ethernet (DP83848)
// -----------------------------------------------------------
ETHTXD0 = P1_0,
ETHTXD1 = P1_1,
ETHTXEN = P1_4,
ETHCRS = P1_8,
ETHRXD0 = P1_9,
ETHRXD1 = P1_10,
ETHRXEN = P1_14,
ETHREFCLK = P1_15,
ETHMDC = P1_16,
ETHMDIO = P1_17,
ETHOSCEN = P1_27,
ETHRST = P1_28,
ETHLINK = P1_25, // LED_LINK
ETHSPEED = P1_26, // LED_SPEED
// ISP port
// -----------------------------------------------------------
ISP = P2_10,
// Other mbed Pin Names
LED = P3_25,
LED1 = LED,
LED2 = LED,
LED3 = LED,
LED4 = LED,
LED_RED = LED,
// mbed / debug IF (LPC11)
// -----------------------------------------------------------
// Serial Port
USBTX = P0_2,
USBRX = P0_3,
USBTXD = USBTX, // identical USBTX
USBRXD = USBRX, // identical USBRX
// Not connected
NC = (int)0xFFFFFFFF
} PinName;
#define ACTIVE_HIGH_POLARITY 1
#define ACTIVE_LOW_POLARITY 0
#define MDM_PIN_POLARITY ACTIVE_LOW_POLARITY
typedef enum {
PullUp = 0,
PullDown = 3,
PullNone = 2,
Repeater = 1,
OpenDrain = 4,
PullDefault = PullDown
} PinMode;
// version of PINCON_TypeDef using register arrays
typedef struct {
__IO uint32_t PINSEL[11];
uint32_t RESERVED0[5];
__IO uint32_t PINMODE[10];
__IO uint32_t PINMODE_OD[5];
} PINCONARRAY_TypeDef;
#define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)
//Additional C027 stuff
#define GPSADR (66<<1) // GPS I2C Address
#define GPSBAUD 9600 // Default GPS Baud Rate
#define MDMBAUD 115200 // Default Modem Baud Rate
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,62 +0,0 @@
/* 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

View File

@ -1,54 +0,0 @@
/* 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_ */

View File

@ -1,39 +0,0 @@
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches.
// Check the 'features' section of the target description in 'targets.json' for more details.
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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 MBED_DEVICE_H
#define MBED_DEVICE_H
// should only enable one or the other, not both
#include "objects.h"
#endif

View File

@ -1,21 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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.
*/
#include "ublox_low_level_api.h"
// called before main
void mbed_sdk_init() {
ublox_mdm_init();
}

View File

@ -1,8 +0,0 @@
// List of reserved pins for C027 LPC1768
#ifndef RESERVED_PINS_H
#define RESERVED_PINS_H
#define TARGET_RESERVED_PINS {P3_26}
#endif

View File

@ -1,114 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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.
*/
#include <stdbool.h>
#include "hal/us_ticker_api.h"
#include "platform/mbed_wait_api.h"
#include "platform/mbed_thread.h"
#include "gpio_api.h"
#include "ublox_low_level_api.h"
static bool modemOn;
static bool gpsOn;
void ublox_mdm_init(void)
{
gpio_t gpio;
// start with modem disabled
gpio_init_out_ex(&gpio, MDMEN, 0);
gpio_init_out_ex(&gpio, MDMRST, 1);
gpio_init_out_ex(&gpio, MDMPWRON, 1);
gpio_init_out_ex(&gpio, MDMLVLOE, 1); // LVLEN: 1=disabled
gpio_init_out_ex(&gpio, MDMILVLOE, 0); // ILVLEN: 0=disabled
gpio_init_out_ex(&gpio, MDMUSBDET, 0);
gpio_init_out_ex(&gpio, MDMRTS, 0);
// start with gps disabled
gpio_init_out_ex(&gpio, GPSEN, 0);
gpio_init_out_ex(&gpio, GPSRST, 1);
// led should be off
gpio_init_out_ex(&gpio, LED, 0);
// Can't use thread_sleep_for() as RTOS isn't initialised yet
//thread_sleep_for(50); // when USB cable is inserted the interface chip issues
// Here's the code from the non-RTOS version
wait_us(50000);
}
// For forwards compatibility
void ublox_mdm_power_on(int usb)
{
ublox_mdm_powerOn(usb);
}
void ublox_mdm_powerOn(int usb)
{
gpio_t gpio;
// turn on the mode by enabling power with power on pin low and correct USB detect level
gpio_init_out_ex(&gpio, MDMUSBDET, usb ? 1 : 0); // USBDET: 0=disabled, 1=enabled
if (!modemOn) { // enable modem
modemOn = true;
gpio_init_out_ex(&gpio, MDMEN, 1); // LDOEN: 1=on
thread_sleep_for(1); // wait until supply switched off
// now we can safely enable the level shifters
gpio_init_out_ex(&gpio, MDMLVLOE, 0); // LVLEN: 0=enabled (uart/gpio)
if (gpsOn) {
gpio_init_out_ex(&gpio, MDMILVLOE, 1); // ILVLEN: 1=enabled (i2c)
}
}
}
// For forwards compatibility
void ublox_mdm_power_off()
{
ublox_mdm_powerOff();
}
void ublox_mdm_powerOff(void)
{
gpio_t gpio;
if (modemOn) {
modemOn = false;
// diable all level shifters
gpio_init_out_ex(&gpio, MDMILVLOE, 0); // ILVLEN: 0=disabled (i2c)
gpio_init_out_ex(&gpio, MDMLVLOE, 1); // LVLEN: 1=disabled (uart/gpio)
gpio_init_out_ex(&gpio,MDMUSBDET, 0); // USBDET: 0=disabled
// now we can savely switch off the ldo
gpio_init_out_ex(&gpio, MDMEN, 0); // LDOEN: 0=off
}
}
void ublox_gps_powerOn(void)
{
gpio_t gpio;
if (!gpsOn) {
gpsOn = true;
// switch on power supply
gpio_init_out_ex(&gpio, GPSEN, 1); // LDOEN: 1=on
thread_sleep_for(1); // wait until supply switched off
if (modemOn) {
gpio_init_out_ex(&gpio, MDMILVLOE, 1); // ILVLEN: 1=enabled (i2c)
}
}
}
void ublox_gps_powerOff(void)
{
gpio_t gpio;
if (gpsOn) {
gpsOn = false;
gpio_init_out_ex(&gpio, MDMILVLOE, 0); // ILVLEN: 0=disabled (i2c)
gpio_init_out_ex(&gpio, GPSEN, 0); // LDOEN: 0=off
}
}

View File

@ -1,39 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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_LOW_LEVEL_H
#define UBLOX_LOW_LEVEL_H
#ifdef __cplusplus
extern "C" {
#endif
void ublox_mdm_init(void);
void ublox_mdm_power_on(int usb);
void ublox_mdm_powerOn(int usb);
void ublox_mdm_power_off(void);
void ublox_mdm_powerOff(void);
void ublox_gps_powerOn(void);
void ublox_gps_powerOff(void);
#ifdef __cplusplus
}
#endif
#endif // UBLOX_LOW_LEVEL_H

View File

@ -1,54 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 "ONBOARD_UBLOX_AT.h"
#include "ONBOARD_UBLOX_PPP.h"
#include "ONBOARD_UBLOX_N2XX.h"
#include "drivers/BufferedSerial.h"
using namespace mbed;
CellularDevice *CellularDevice::get_target_default_instance()
{
#if defined(TARGET_UBLOX_C030_R41XM)
#if (NSAPI_PPP_AVAILABLE)
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_PPP device(&serial);
#else
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_AT device(&serial);
#endif
#elif defined(TARGET_UBLOX_C030_N211)
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_N2XX device(&serial);
#elif defined(TARGET_UBLOX_C030_U201)
#if (NSAPI_PPP_AVAILABLE)
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_PPP device(&serial);
#else
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_AT device(&serial);
#endif
#else //UBLOX_C027
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_PPP device(&serial);
#endif
return &device;
}
#endif // MBED_CONF_NSAPI_PRESENT

View File

@ -1,52 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 "ONBOARD_UBLOX_AT.h"
#include "UBLOX_onboard_modem_api.h"
using namespace mbed;
ONBOARD_UBLOX_AT::ONBOARD_UBLOX_AT(FileHandle *fh) : UBLOX_AT(fh)
{
}
nsapi_error_t ONBOARD_UBLOX_AT::hard_power_on()
{
::onboard_modem_init();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_AT::hard_power_off()
{
::onboard_modem_deinit();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_AT::soft_power_on()
{
::onboard_modem_power_up();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_AT::soft_power_off()
{
::onboard_modem_power_down();
return NSAPI_ERROR_OK;
}
#endif // MBED_CONF_NSAPI_PRESENT

View File

@ -1,36 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 ONBOARD_UBLOX_AT_
#define ONBOARD_UBLOX_AT_
#include "UBLOX_AT.h"
namespace mbed {
class ONBOARD_UBLOX_AT : public UBLOX_AT {
public:
ONBOARD_UBLOX_AT(FileHandle *fh);
virtual nsapi_error_t hard_power_on();
virtual nsapi_error_t hard_power_off();
virtual nsapi_error_t soft_power_on();
virtual nsapi_error_t soft_power_off();
};
} // namespace mbed
#endif // ONBOARD_UBLOX_AT_

View File

@ -1,52 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 "ONBOARD_UBLOX_N2XX.h"
#include "UBLOX_onboard_modem_api.h"
using namespace mbed;
ONBOARD_UBLOX_N2XX::ONBOARD_UBLOX_N2XX(FileHandle *fh) : UBLOX_N2XX(fh)
{
}
nsapi_error_t ONBOARD_UBLOX_N2XX::hard_power_on()
{
::onboard_modem_init();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_N2XX::hard_power_off()
{
::onboard_modem_deinit();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_N2XX::soft_power_on()
{
::onboard_modem_power_up();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_N2XX::soft_power_off()
{
::onboard_modem_power_down();
return NSAPI_ERROR_OK;
}
#endif // MBED_CONF_NSAPI_PRESENT

View File

@ -1,36 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 ONBOARD_UBLOX_N2XX_
#define ONBOARD_UBLOX_N2XX_
#include "UBLOX_N2XX.h"
namespace mbed {
class ONBOARD_UBLOX_N2XX : public UBLOX_N2XX {
public:
ONBOARD_UBLOX_N2XX(FileHandle *fh);
virtual nsapi_error_t hard_power_on();
virtual nsapi_error_t hard_power_off();
virtual nsapi_error_t soft_power_on();
virtual nsapi_error_t soft_power_off();
};
} // namespace mbed
#endif // ONBOARD_UBLOX_N2XX_

View File

@ -1,52 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 "ONBOARD_UBLOX_PPP.h"
#include "UBLOX_onboard_modem_api.h"
using namespace mbed;
ONBOARD_UBLOX_PPP::ONBOARD_UBLOX_PPP(FileHandle *fh) : UBLOX_PPP(fh)
{
}
nsapi_error_t ONBOARD_UBLOX_PPP::hard_power_on()
{
::onboard_modem_init();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::hard_power_off()
{
::onboard_modem_deinit();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::soft_power_on()
{
::onboard_modem_power_up();
return NSAPI_ERROR_OK;
}
nsapi_error_t ONBOARD_UBLOX_PPP::soft_power_off()
{
::onboard_modem_power_down();
return NSAPI_ERROR_OK;
}
#endif // MBED_CONF_NSAPI_PRESENT

View File

@ -1,36 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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 ONBOARD_UBLOX_PPP_
#define ONBOARD_UBLOX_PPP_
#include "UBLOX_PPP.h"
namespace mbed {
class ONBOARD_UBLOX_PPP : public UBLOX_PPP {
public:
ONBOARD_UBLOX_PPP(FileHandle *fh);
virtual nsapi_error_t hard_power_on();
virtual nsapi_error_t hard_power_off();
virtual nsapi_error_t soft_power_on();
virtual nsapi_error_t soft_power_off();
};
} // namespace mbed
#endif // ONBOARD_UBLOX_PPP_

View File

@ -1,101 +0,0 @@
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2015, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#ifndef MBED_PERIPHERALNAMES_H
#define MBED_PERIPHERALNAMES_H
#include "cmsis.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int) ADC2_BASE,
ADC_3 = (int) ADC3_BASE
} ADCName;
typedef enum {
UART_1 = (int)USART1_BASE,
UART_2 = (int)USART2_BASE,
UART_3 = (int)USART3_BASE,
UART_4 = (int)UART4_BASE,
UART_5 = (int)UART5_BASE,
UART_6 = (int)USART6_BASE,
UART_7 = (int)UART7_BASE,
UART_8 = (int)UART8_BASE
} UARTName;
#define DEVICE_SPI_COUNT 6
typedef enum {
SPI_1 = (int)SPI1_BASE,
SPI_2 = (int)SPI2_BASE,
SPI_3 = (int)SPI3_BASE,
SPI_4 = (int)SPI4_BASE,
SPI_5 = (int)SPI5_BASE,
SPI_6 = (int)SPI6_BASE
} SPIName;
typedef enum {
I2C_1 = (int)I2C1_BASE,
I2C_2 = (int)I2C2_BASE,
I2C_3 = (int)I2C3_BASE
} I2CName;
typedef enum {
PWM_1 = (int)TIM1_BASE,
PWM_2 = (int)TIM2_BASE,
PWM_3 = (int)TIM3_BASE,
PWM_4 = (int)TIM4_BASE,
PWM_5 = (int)TIM5_BASE,
PWM_8 = (int)TIM8_BASE,
PWM_9 = (int)TIM9_BASE,
PWM_10 = (int)TIM10_BASE,
PWM_11 = (int)TIM11_BASE,
PWM_12 = (int)TIM12_BASE,
PWM_13 = (int)TIM13_BASE,
PWM_14 = (int)TIM14_BASE
} PWMName;
typedef enum {
DAC_1 = (int)DAC_BASE
} DACName;
typedef enum {
CAN_1 = (int)CAN1_BASE,
CAN_2 = (int)CAN2_BASE
} CANName;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,147 +0,0 @@
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2014, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#include "PeripheralPins.h"
// =====
// Note: Commented lines are alternative possibilities which are not used per default.
// If you change them, you will have also to modify the corresponding xxx_api.c file
// for pwmout, analogin, analogout, ...
// =====
//*** ADC ***
const PinMap PinMap_ADC[] = {
{PA_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
{PA_4, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
{PA_6, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
{PB_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
#ifdef TARGET_UBLOX_C030_R412M
{PB_1, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
#endif
{PC_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
{PC_2, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
{PC_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
{NC, NC, 0}
};
const PinMap PinMap_ADC_Internal[] = {
{ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)},
{ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)},
{ADC_VBAT, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)},
{NC, NC, 0}
};
//*** I2C ***
const PinMap PinMap_I2C_SDA[] = {
{PB_7, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PC_9, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{NC, NC, 0}
};
const PinMap PinMap_I2C_SCL[] = {
{PB_6, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PA_8, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{NC, NC, 0}
};
const PinMap PinMap_DAC[] = {
{PA_5, DAC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 - ARDUINO D13
{NC, NC, 0}
};
//*** PWM ***
const PinMap PinMap_PWM[] = {
{PE_13, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
{PE_9, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1N
#ifndef TARGET_UBLOX_C030_R412M
{PB_1, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
#endif
{PD_12, PWM_4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
{PB_8, PWM_10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
{PB_15, PWM_12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2
{NC, NC, 0}
};
//*** SERIAL ***
const PinMap PinMap_UART_TX[] = {
{PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PD_5, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PD_8, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
{PC_6, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{NC, NC, 0}
};
const PinMap PinMap_UART_RX[] = {
{PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PD_6, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PD_9, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
{PC_7, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
{NC, NC, 0}
};
const PinMap PinMap_UART_RTS[] = {
{PA_12, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PD_4, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PB_14, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
{NC, NC, 0}
};
const PinMap PinMap_UART_CTS[] = {
{PA_11, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
{PD_3, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
{PD_11, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
{NC, NC, 0}
};
//*** SPI ***
const PinMap PinMap_SPI_MOSI[] = {
{PE_6, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
{NC, NC, 0}
};
const PinMap PinMap_SPI_MISO[] = {
{PE_5, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
{NC, NC, 0}
};
const PinMap PinMap_SPI_SCLK[] = {
{PE_2, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
{NC, NC, 0}
};
const PinMap PinMap_SPI_SSEL[] = {
{PE_11, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI4)},
{NC, NC, 0}
};

View File

@ -1,208 +0,0 @@
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2014, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H
#include "cmsis.h"
#include "PinNamesTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
PA_0 = 0x00, PA_1 = 0x01, PA_2 = 0x02, PA_3 = 0x03,
PA_4 = 0x04, PA_5 = 0x05, PA_6 = 0x06, PA_7 = 0x07,
PA_8 = 0x08, PA_9 = 0x09, PA_10 = 0x0A, PA_11 = 0x0B,
PA_12 = 0x0C, PA_13 = 0x0D, PA_14 = 0x0E, PA_15 = 0x0F,
PB_0 = 0x10, PB_1 = 0x11, PB_2 = 0x12, PB_3 = 0x13,
PB_4 = 0x14, PB_5 = 0x15, PB_6 = 0x16, PB_7 = 0x17,
PB_8 = 0x18, PB_9 = 0x19, PB_10 = 0x1A, PB_11 = 0x1B,
PB_12 = 0x1C, PB_13 = 0x1D, PB_14 = 0x1E, PB_15 = 0x1F,
PC_0 = 0x20, PC_1 = 0x21, PC_2 = 0x22, PC_3 = 0x23,
PC_4 = 0x24, PC_5 = 0x25, PC_6 = 0x26, PC_7 = 0x27,
PC_8 = 0x28, PC_9 = 0x29, PC_10 = 0x2A, PC_11 = 0x2B,
PC_12 = 0x2C, PC_13 = 0x2D, PC_14 = 0x2E, PC_15 = 0x2F,
PD_0 = 0x30, PD_1 = 0x31, PD_2 = 0x32, PD_3 = 0x33,
PD_4 = 0x34, PD_5 = 0x35, PD_6 = 0x36, PD_7 = 0x37,
PD_8 = 0x38, PD_9 = 0x39, PD_10 = 0x3A, PD_11 = 0x3B,
PD_12 = 0x3C, PD_13 = 0x3D, PD_14 = 0x3E, PD_15 = 0x3F,
PE_0 = 0x40, PE_1 = 0x41, PE_2 = 0x42, PE_3 = 0x43,
PE_4 = 0x44, PE_5 = 0x45, PE_6 = 0x46, PE_7 = 0x47,
PE_8 = 0x48, PE_9 = 0x49, PE_10 = 0x4A, PE_11 = 0x4B,
PE_12 = 0x4C, PE_13 = 0x4D, PE_14 = 0x4E, PE_15 = 0x4F,
PH_0 = 0x70, PH_1 = 0x71,
// Not connected
NC = -1,
// Power
PWR3V3 = PE_0, // 3.3V rail for the Arduino interface,
// user LEDs and GNSS power, should be
// set to open drain output
// GNSS
GNSSEN = PA_15, // VCC_IO to GNSS, should be set to push-pull, no pull-up, output
GNSSTXD = PC_6,
GNSSRXD = PC_7,
// Cellular modem (a DCE)
MDMPWRON = PE_14, // Power (active high)
MDMRST = PB_5, // Reset (active low)
#if defined(TARGET_UBLOX_C030_R41XM)
MDMTXD = PA_9, // Transmit Data
MDMRXD = PA_10, // Receive Data
MDMCTS = PA_11, // Clear to Send
MDMRTS = PA_12, // Request to Send
#else
MDMTXD = PD_5, // Transmit Data
MDMRXD = PD_6, // Receive Data
MDMCTS = PD_3, // Clear to Send
MDMRTS = PD_4, // Request to Send
#endif
MDMDCD = NC, // DCD line not connected
MDMDSR = NC, // DSR line not connected
MDMDTR = NC, // DTR line not connected
MDMRI = NC, // RI line not connected
MDMGPIO2 = PD_1, //
MDMGPIO3 = PB_4, //
MDMCURRENTSENSE = PC_2,
// SD card
SDPWRON = PE_10, // Set to high to power on the SD card
SDCSEL = PD_7, // SPI chip select for on-board SD card
// Board Pins
// A0-A5
A0 = PA_3,
A1 = PC_0,
A2 = PC_3,
A3 = PA_4,
A4 = PA_6,
A5 = PB_0,
// D0-D15
D0 = PD_9, // UART3-RX
D1 = PD_8, // UART3-TX
D2 = PD_11, // UART3-CTS
D3 = PB_14, // UART3-RTS
#if defined(TARGET_UBLOX_C030_N211) || defined(TARGET_UBLOX_C030_R410M) || defined(TARGET_UBLOX_C030_U201)
D4 = PB_1,
#else
D4 = PC_8,
#endif
D5 = PA_5,
D6 = PB_8, // UART3-CTS
D7 = PB_15, // UART3-RTS
D8 = PD_15, // UART1-TX
D9 = PD_12, // SDCard-CS
D10 = PE_11, // SSEL
D11 = PE_6, // MOSI
D12 = PE_5, // MISO
D13 = PE_2, // SCK
D14 = PB_7, // SDA
D15 = PB_6, // SCL
// ADC internal channels
ADC_TEMP = 0xF0,
ADC_VREF = 0xF1,
ADC_VBAT = 0xF2,
// Internal
LED1 = PE_3, // Red / Mode
LED2 = PE_4, // Green / Switch-1
LED3 = PE_1, // Blue
LED4 = PE_7, // A definition is required by the mbed platform RTC test code, this is the Ethernet connector yellow LED
LED_RED = LED1,
LED_GREEN = LED2,
LED_BLUE = LED3,
SW0 = PC_13, // Switch-0
BUTTON1 = SW0, // Standardized button names
// Arduino header I2C
I2C_SDA = D14,
I2C_SCL = D15,
// On-board I2C
I2C_SDA_B = PC_9,
I2C_SCL_B = PA_8,
// SPI
SPI_MOSI = D11,
SPI_MISO = D12,
SPI_CLK = D13,
SPI_NSS = D10,
// STDIO for console print
#ifdef MBED_CONF_TARGET_STDIO_UART_TX
STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
#else
#if defined(TARGET_UBLOX_C030_R41XM)
STDIO_UART_TX = PD_5,
#else
STDIO_UART_TX = PA_9,
#endif
#endif
#ifdef MBED_CONF_TARGET_STDIO_UART_RX
STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
#else
#if defined(TARGET_UBLOX_C030_R41XM)
STDIO_UART_RX = PD_6,
#else
STDIO_UART_RX = PA_10,
#endif
#endif
// ST-Link
USBRX = STDIO_UART_RX,
USBTX = STDIO_UART_TX,
SWDIO = PA_13,
SWCLK = PA_14,
NTRST = PB_4,
} PinName;
#define ACTIVE_HIGH_POLARITY 1
#define ACTIVE_LOW_POLARITY 0
#define MDM_PIN_POLARITY ACTIVE_LOW_POLARITY
// The default GNSS baud rate is set in targets.json
// The default modem baud rate is set in the mbed_lib.json file under features/cellular/TARGET_UBLOX_MODEM_GENERIC/ubox_modem_driver
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,82 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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"
// Note microseconds not milliseconds
static void press_power_button(int time_us)
{
gpio_t gpio;
#if defined(TARGET_UBLOX_C030_R41XM)
gpio_init_inout(&gpio, MDMPWRON, PIN_OUTPUT, OpenDrain, 0);
#else
gpio_init_out_ex(&gpio, MDMPWRON, 0);
#endif
wait_us(time_us);
gpio_write(&gpio, 1);
}
void onboard_modem_init()
{
gpio_t gpio;
#if defined(TARGET_UBLOX_C030_R41XM)
// Set the pin to high so on powerup we can set low
gpio_init_inout(&gpio, MDMPWRON, PIN_OUTPUT, OpenDrain, 1);
#endif
// Take us out of reset
gpio_init_out_ex(&gpio, MDMRST, 1);
}
void onboard_modem_deinit()
{
#ifndef TARGET_UBLOX_C030_R41XM
gpio_t gpio;
// Back into reset
gpio_init_out_ex(&gpio, MDMRST, 0);
#endif
}
void onboard_modem_power_up()
{
#if defined(TARGET_UBLOX_C030_R41XM)
/* keep the power line low for 1 seconds */
press_power_button(1000000);
#else
/* keep the power line low for 50 microseconds */
press_power_button(50);
#endif
/* give modem a little time to respond */
thread_sleep_for(100);
}
void onboard_modem_power_down()
{
/* keep the power line low for 1.5 seconds */
press_power_button(1500000);
}
#endif //MBED_CONF_NSAPI_PRESENT

View File

@ -1,53 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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_ */

View File

@ -1,73 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
*
* 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.
*/
#include "min_battery_voltage.h"
/** Defining HAL_MspInit strong function
* in user defined file as described in documentation
*/
void HAL_MspInit(void)
{
set_minimum_battery_voltage();
}
void set_minimum_battery_voltage()
{
i2c_t i2c_obj = {0};
int data_read;
i2c_init(&i2c_obj, I2C_SDA_B, I2C_SCL_B);
i2c_frequency(&i2c_obj, I2C_FREQUENCY);
if (read_from_i2c(BQ24295_I2C_ADDRESS, 0, &data_read, i2c_obj)) {
data_read = data_read & MIN_BATTERY_VOLTAGE_MASK;
write_to_i2c(BQ24295_I2C_ADDRESS, 0, data_read, i2c_obj);
//Battery Voltage is set to 3880mV
} else {
// Minimum battery voltage could not be set. This is not a critical error, no need to stop execution
// It simply means that longer cabling or USB ports with lower output voltages may cause problems.
}
}
char write_to_i2c(int slave_addr, int reg_addr, int data_write, i2c_t i2c_obj)
{
char ret_code = 0;
if (!i2c_start(&i2c_obj)) {
if ((i2c_byte_write(&i2c_obj, slave_addr << 1) == 1) &&
(i2c_byte_write(&i2c_obj, reg_addr) == 1) &&
(i2c_byte_write(&i2c_obj, data_write) == 1)) {
ret_code = 1;
}
i2c_stop(&i2c_obj);
}
return ret_code;
}
char read_from_i2c(int slave_addr, int reg_addr, int *data_read, i2c_t i2c_obj)
{
char ret_code = 0;
if (!i2c_start(&i2c_obj)) {
if ((i2c_byte_write(&i2c_obj, (slave_addr << 1)) == 1) &&
(i2c_byte_write(&i2c_obj, reg_addr) == 1) &&
(!i2c_start(&i2c_obj)) &&
(i2c_byte_write(&i2c_obj, ((slave_addr << 1) | 0x01)) == 1)) {
*data_read = i2c_byte_read(&i2c_obj, 1);
ret_code = 1;
}
i2c_stop(&i2c_obj);
}
return ret_code;
}

View File

@ -1,42 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
*
* 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 MIN_BATTERY_VOLTAGE_H
#define MIN_BATTERY_VOLTAGE_H
#include "hal/i2c_api.h"
#ifdef __cplusplus
extern"C" {
#endif
#define BQ24295_I2C_ADDRESS (0x6B)
#define I2C_FREQUENCY 100000
#define MIN_BATTERY_VOLTAGE_MASK (0x87)
/** Initializes an instance of class BatteryChargerI2c which is using the STM HAL I2C APIs
* This allows longer USB cables or USB ports with lower output voltages to power the board correctly.
*/
void set_minimum_battery_voltage(void);
char read_from_i2c(int slave_addr, int reg_addr, int *data_read, i2c_t i2c_obj);
char write_to_i2c(int slave_addr, int reg_addr, int data_write, i2c_t i2c_obj);
#ifdef __cplusplus
}
#endif
#endif // MIN_BATTERY_VOLTAGE_H

View File

@ -1,184 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
*
* 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.
*/
/**
* This file configures the system clock as follows:
*----------------------------------------------------------------------------------------------------------------------------------------
* System clock source | PLL_HSE_XTAL | PLL_HSE_XTAL | PLL_HSE_XTAL | PLL_HSE_XTAL
* | (external 8 MHz clock) | (external 8 MHz clock) | (external 12 MHz clock)| (external 12 MHz clock)
*----------------------------------------------------------------------------------------------------------------------------------------
* SYSCLK(MHz) | 168 | 84 | 168 | 84
*----------------------------------------------------------------------------------------------------------------------------------------
* AHBCLK (MHz) | 168 | 84 | 168 | 84
*----------------------------------------------------------------------------------------------------------------------------------------
* APB1CLK (MHz) | 42 | 42 | 42 | 42
*----------------------------------------------------------------------------------------------------------------------------------------
* APB2CLK (MHz) | 84 | 84 | 84 | 84
*----------------------------------------------------------------------------------------------------------------------------------------
* USB capable (48 MHz precise clock) | YES | YES | YES | YES
*----------------------------------------------------------------------------------------------------------------------------------------
**/
#include "ublox_low_level_api.h"
#include "stm32f4xx.h"
#include "nvic_addr.h"
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/* Select the SYSCLOCK to start with (0=OFF, 1=ON) */
#define USE_SYSCLOCK_168 (1) /* Use external 8MHz or 12 MHz xtal and sets SYSCLK to 168MHz */
#define USE_SYSCLOCK_84 (0) /* Use external 8MHz or 12 MHz xtal and sets SYSCLK to 84MHz */
void SetSysClock(void);
/**
* @brief Setup the microcontroller system
* Initialize the FPU setting, vector table location and External memory
* configuration.
* @param None
* @retval None
*/
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10 * 2) | (3UL << 11 * 2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/* Reset CFGR register */
RCC->CFGR = 0x00000000;
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010;
/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Disable all interrupts */
RCC->CIR = 0x00000000;
#if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
ublox_board_init();
}
/** System Clock Configuration
*/
#if USE_SYSCLOCK_168 != 0
/*
* Set SYSCLK=168MHZ
*/
void SetSysClock(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
#ifdef USE_DEBUG_8MHz_XTAL
RCC_OscInitStruct.PLL.PLLM = 8;
#else
RCC_OscInitStruct.PLL.PLLM = 12;
#endif
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1
| RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
// HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_3);
}
#elif USE_SYSCLOCK_84 != 0
/*
Set SYSCLK=84MHZ
*/
void SetSysClock(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
#ifdef USE_DEBUG_8MHz_XTAL
RCC_OscInitStruct.PLL.PLLM = 8;
#else
RCC_OscInitStruct.PLL.PLLM = 12;
#endif
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1
| RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
// HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_3);
}
#endif

View File

@ -1,60 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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.
*/
#include "ublox_low_level_api.h"
#include <stdbool.h>
#include "gpio_api.h"
void ublox_board_init(void)
{
gpio_t gpio;
// Enable power to 3V3
gpio_init_inout(&gpio, PWR3V3, PIN_OUTPUT, OpenDrain, 1);
#if defined(TARGET_UBLOX_C030_R41XM)
/* In case of SARA-R4, MDMRST needs to be asserted for 10 seconds before modem actually powers down.
* This means that modem is initially responsive to AT commands but powers down
* after 10 seconds unless MDMRST is de-asserted (onboard_modem_init()).
*
* This will cause confusion for application as CellularDevice::is_ready()
* will return TRUE initially and later modem will power off without any indication to application.
*/
gpio_init_out_ex(&gpio, MDMRST, 1);
gpio_init_inout(&gpio, MDMPWRON, PIN_OUTPUT, OpenDrain, 1);
#else
gpio_init_out_ex(&gpio, MDMRST, 0);
gpio_init_out_ex(&gpio, MDMPWRON, 0);
#endif
gpio_init_out_ex(&gpio, MDMRTS, 0);
gpio_init_in_ex(&gpio, MDMCURRENTSENSE, PullNone);
#if !defined (TARGET_UBLOX_C030_R41XM)
// start with GNSS disabled, this is ONLY TEMPORARY and that once the HW issue with the GNSSEN pin on the R41XM board is resolved then this line will become default for all platforms.
gpio_init_inout(&gpio, GNSSEN, PIN_OUTPUT, PushPullNoPull, 0);
#endif
// power on SD card
gpio_init_out_ex(&gpio, SDPWRON, 1);
// led should be off
gpio_init_out_ex(&gpio, LED1, 1);
gpio_init_out_ex(&gpio, LED2, 1);
gpio_init_out_ex(&gpio, LED3, 1);
gpio_init_out_ex(&gpio, LED4, 1);
}
// End Of File

View File

@ -1,14 +0,0 @@
#ifndef UBLOX_LOW_LEVEL_API_H
#define UBLOX_LOW_LEVEL_API_H
#ifdef __cplusplus
extern "C" {
#endif
void ublox_board_init(void);
#ifdef __cplusplus
}
#endif
#endif // UBLOX_LOW_LEVEL_H

View File

@ -1,21 +0,0 @@
/* mbed Microcontroller Library
* Copyright (c) 2016 u-blox
*
* 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 MBED_MBED_RTX_H
#define MBED_MBED_RTX_H
#endif // MBED_MBED_RTX_H

View File

@ -475,69 +475,6 @@
"9004"
]
},
"UBLOX_C027": {
"supported_form_factors": [
"ARDUINO"
],
"core": "Cortex-M3",
"supported_toolchains": [
"ARM",
"uARM",
"GCC_ARM",
"IAR"
],
"extra_labels": [
"NXP",
"LPC176X",
"NXP_EMAC"
],
"macros": [
"TARGET_LPC1768",
"UBX_MDM_SARA_G3XX",
"UBX_MDM_SARA_G350"
],
"inherits": [
"LPCTarget"
],
"device_has": [
"USTICKER",
"ANALOGIN",
"ANALOGOUT",
"CAN",
"DEBUG_AWARENESS",
"EMAC",
"ETHERNET",
"I2C",
"I2CSLAVE",
"INTERRUPTIN",
"PORTIN",
"PORTINOUT",
"PORTOUT",
"PWMOUT",
"SERIAL",
"SERIAL_FC",
"SLEEP",
"SPI",
"SPISLAVE",
"STDIO_MESSAGES",
"FLASH",
"MPU",
"WATCHDOG",
"RESET_REASON"
],
"release_versions": [
"2",
"5"
],
"device_name": "LPC1768",
"bootloader_supported": true,
"overrides": {
"network-default-interface-type": "CELLULAR"
},
"detect_code": [
"1235"
]
},
"KL25Z": {
"supported_form_factors": [
"ARDUINO"
@ -4978,113 +4915,6 @@
],
"device_name": "STM32F401VC"
},
"UBLOX_C030": {
"inherits": [
"FAMILY_STM32"
],
"supported_form_factors": [
"ARDUINO"
],
"core": "Cortex-M4F",
"supported_toolchains": [
"GCC_ARM",
"ARM",
"IAR"
],
"extra_labels_add": [
"STM32F4",
"STM32F437xG"
],
"macros_add": [
"STM32F437xx",
"MBEDTLS_CONFIG_HW_SUPPORT",
"HSE_VALUE=12000000",
"GNSSBAUD=9600"
],
"device_has_add": [
"ANALOGOUT",
"EMAC",
"TRNG",
"FLASH",
"MPU"
],
"public": false,
"device_name": "STM32F437VG",
"bootloader_supported": true,
"overrides": {
"network-default-interface-type": "ETHERNET"
}
},
"UBLOX_C030_U201": {
"inherits": [
"UBLOX_C030"
],
"components_add": [
"SD",
"FLASHIAP"
],
"release_versions": [
"5"
],
"macros_add": [
"UBX_MDM_SARA_U2XX",
"UBX_MDM_SARA_U201"
],
"detect_code": [
"C030"
]
},
"UBLOX_C030_N211": {
"inherits": [
"UBLOX_C030"
],
"release_versions": [
"5"
],
"macros_add": [
"UBX_MDM_SARA_N2XX",
"UBX_MDM_SARA_N211"
],
"detect_code": [
"C031"
]
},
"UBLOX_C030_R41XM": {
"inherits": [
"UBLOX_C030"
],
"release_versions": [
"5"
],
"public": false
},
"UBLOX_C030_R410M": {
"inherits": [
"UBLOX_C030_R41XM"
],
"release_versions": [
"5"
],
"macros_add": [
"UBX_MDM_SARA_R41XM",
"UBX_MDM_SARA_R410M"
]
},
"UBLOX_C030_R412M": {
"inherits": [
"UBLOX_C030_R41XM"
],
"release_versions": [
"5"
],
"macros_add": [
"UBX_MDM_SARA_R41XM",
"UBX_MDM_SARA_R412M"
],
"detect_code": [
"C036"
]
},
"MCU_NRF51": {
"inherits": [
"Target"

View File

@ -31,7 +31,6 @@ class CoIDE(Exporter):
'LPC1768',
'ARCH_PRO',
'ARCH_MAX',
'UBLOX_C027',
'NUCLEO_L053R8',
'NUCLEO_L152RE',
'NUCLEO_F030R8',

View File

@ -30,7 +30,6 @@ class LPCXpresso(Exporter):
'LPC1114',
'LPC11U35_401',
'LPC11U35_501',
'UBLOX_C027',
'ARCH_PRO',
'LPC11U68',
'LPCCAPPUCCINO',

View File

@ -428,7 +428,6 @@
"targets" : ["CY8CKIT_062_WIFI_BT_PSA",
"K66F",
"NUCLEO_F429ZI",
"UBLOX_ODIN_EVK_W2",
"LPC55S69_NS"
],
"toolchains" : [],

View File

@ -43,11 +43,6 @@
"lwip.ppp-enabled": true,
"lwip.ethernet-enabled": false,
"cellular.debug-at": false
},
"UBLOX_C030_R412M": {
"platform.stdio-convert-newlines": true,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200
}
}
}