[mynewt-newtmgr] branch master updated (4445160 -> d902664)
This is an automated email from the ASF dual-hosted git repository. marko pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git. from 4445160 Merge pull request #47 from ccollins476ad/conn-find-retry add cbed14b mtech_lora; monitor "packet_sent" to see what downstream frame size is. Currently only maps US frequencies. add 176306f mtech_lora; report mtu to application based on what the MTU size is. But allow at least 128 bytes. add f9ecdef mtech_lora; reduce mtu channel depth to 1. add b79cbfc mtech_lora; print debug msg re mtu size only when it is adjusted. new d902664 Merge pull request #48 from mkiiskila/lora The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: nmxact/mtech_lora/listen.go | 9 +++ nmxact/mtech_lora/mtech_lora_sesn.go | 37 ++- nmxact/mtech_lora/mtech_lora_xport.go | 48 +-- 3 files changed, 86 insertions(+), 8 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org"'].
[GitHub] mkiiskila closed pull request #48: mtu improvements when tx'ing
mkiiskila closed pull request #48: mtu improvements when tx'ing URL: https://github.com/apache/mynewt-newtmgr/pull/48 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/nmxact/mtech_lora/listen.go b/nmxact/mtech_lora/listen.go index 0bc6976..64dc945 100644 --- a/nmxact/mtech_lora/listen.go +++ b/nmxact/mtech_lora/listen.go @@ -48,6 +48,7 @@ func TypeKey(msgType string) ListenerKey { type Listener struct { MsgChan chan []byte + MtuChan chan int ErrChan chan error TmoChan chan time.Time Acked bool @@ -62,6 +63,7 @@ type Listener struct { func NewListener() *Listener { return { MsgChan: make(chan []byte, 16), + MtuChan: make(chan int, 1), ErrChan: make(chan error, 1), TmoChan: make(chan time.Time, 1), @@ -97,6 +99,13 @@ func (ll *Listener) Close() { } } + close(ll.MtuChan) + for { + if _, ok := <-ll.MtuChan; !ok { + break + } + } + close(ll.ErrChan) for { if _, ok := <-ll.ErrChan; !ok { diff --git a/nmxact/mtech_lora/mtech_lora_sesn.go b/nmxact/mtech_lora/mtech_lora_sesn.go index a4f94b5..9bde337 100644 --- a/nmxact/mtech_lora/mtech_lora_sesn.go +++ b/nmxact/mtech_lora/mtech_lora_sesn.go @@ -27,6 +27,7 @@ import ( "strings" "sync" + log "github.com/Sirupsen/logrus" "github.com/joaojeronimo/go-crc16" "github.com/runtimeco/go-coap" "github.com/ugorji/go/codec" @@ -43,6 +44,7 @@ type LoraSesn struct { cfg sesn.SesnCfg txvr *mgmt.Transceiver isOpen bool + mtu int xport*LoraXport listener *Listener wg sync.WaitGroup @@ -70,6 +72,7 @@ func NewLoraSesn(cfg sesn.SesnCfg, lx *LoraXport) (*LoraSesn, error) { s := { cfg: cfg, xport: lx, + mtu: 0, } return s, nil @@ -110,6 +113,14 @@ func (s *LoraSesn) Open() error { if ok { s.txvr.DispatchCoap(msg) } + case mtu, ok := <-s.listener.MtuChan: + if ok { + if s.mtu != mtu { + log.Debugf("Setting mtu for %s %d", + s.cfg.Lora.Addr, mtu) + } + s.mtu = mtu + } case <-s.stopChan: return } @@ -137,23 +148,37 @@ func (s *LoraSesn) Close() error { return nil } +func (s *LoraSesn) Mtu() int { + if s.cfg.Lora.SegSz != 0 { + return s.cfg.Lora.SegSz + } + if s.mtu != 0 { + return s.mtu + } + return s.xport.minMtu() +} + func (s *LoraSesn) IsOpen() bool { return s.isOpen } func (s *LoraSesn) MtuIn() int { - return MAX_PACKET_SIZE - omp.OMP_MSG_OVERHEAD - nmp.NMP_HDR_SIZE + return MAX_PACKET_SIZE_IN - omp.OMP_MSG_OVERHEAD - nmp.NMP_HDR_SIZE } func (s *LoraSesn) MtuOut() int { - return MAX_PACKET_SIZE - omp.OMP_MSG_OVERHEAD - nmp.NMP_HDR_SIZE + // We want image upload to use chunk size which fits inside a single + // lora segment, when possible. If the datarate is low enough, then we have + // to fragment, but try to avoid it if possible. + mtu := MAX_PACKET_SIZE_OUT + if s.mtu > mtu { + mtu = s.mtu + } + return mtu - omp.OMP_MSG_OVERHEAD - nmp.NMP_HDR_SIZE } func (s *LoraSesn) sendFragments(b []byte) error { - segSz := s.xport.minMtu() - if segSz < s.cfg.Lora.SegSz { - segSz = s.cfg.Lora.SegSz - } + segSz := s.Mtu() crc := crc16.Crc16(b) idx := 0 for off := 0; off < len(b); { diff --git a/nmxact/mtech_lora/mtech_lora_xport.go b/nmxact/mtech_lora/mtech_lora_xport.go index 082faf8..4abfd29 100644 --- a/nmxact/mtech_lora/mtech_lora_xport.go +++ b/nmxact/mtech_lora/mtech_lora_xport.go @@ -64,7 +64,24 @@ type LoraData struct { Port int`codec:"port"` } -const MAX_PACKET_SIZE = 2048 +type LoraPacketSent struct { + DataRate string `codec:"datr"` +} + +/* + * This maps datarate string into a max mtu we can use + */ +var LoraDataRateMapUS = map[string]int{ + "SF12BW500": 33, + "SF11BW500": 109, + "SF10BW500": 222, + "SF9BW500": 222, + "SF8BW500": 222, + "SF7BW500": 222,
[mynewt-newtmgr] 01/01: Merge pull request #48 from mkiiskila/lora
This is an automated email from the ASF dual-hosted git repository. marko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git commit d902664199055cf1356249e56f13936e3155a768 Merge: 4445160 b79cbfc Author: mkiiskilaAuthorDate: Mon Oct 30 14:56:11 2017 -0700 Merge pull request #48 from mkiiskila/lora mtu improvements when tx'ing nmxact/mtech_lora/listen.go | 9 +++ nmxact/mtech_lora/mtech_lora_sesn.go | 37 ++- nmxact/mtech_lora/mtech_lora_xport.go | 48 +-- 3 files changed, 86 insertions(+), 8 deletions(-) -- To stop receiving notification emails like this one, please contact "commits@mynewt.apache.org" .
[mynewt-newtmgr] 01/01: Merge pull request #47 from ccollins476ad/conn-find-retry
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git commit 44451600ffe6d639aa83c1d71e723306e69a6004 Merge: 8039e8c 1fce20a Author: ccollins476adAuthorDate: Mon Oct 30 14:25:30 2017 -0700 Merge pull request #47 from ccollins476ad/conn-find-retry nmxact - Retry connect on "conn_find" failure. nmxact/nmble/naked_sesn.go | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact "commits@mynewt.apache.org" .
[mynewt-newtmgr] branch master updated (8039e8c -> 4445160)
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git. from 8039e8c Merge pull request #46 from mkiiskila/lora add 1fce20a nmxact - Retry connect on "conn_find" failure. new 4445160 Merge pull request #47 from ccollins476ad/conn-find-retry The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: nmxact/nmble/naked_sesn.go | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org"'].
[GitHub] ccollins476ad closed pull request #47: nmxact - Retry connect on "conn_find" failure.
ccollins476ad closed pull request #47: nmxact - Retry connect on "conn_find" failure. URL: https://github.com/apache/mynewt-newtmgr/pull/47 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/nmxact/nmble/naked_sesn.go b/nmxact/nmble/naked_sesn.go index f588fd9..6d55672 100644 --- a/nmxact/nmble/naked_sesn.go +++ b/nmxact/nmble/naked_sesn.go @@ -458,10 +458,18 @@ func (s *NakedSesn) openOnce() (bool, error) { s.cfg.PeerSpec.Ble, s.cfg.Ble.Central.ConnTimeout); err != nil { - return false, err + // An ENOTCONN error code implies the "conn_find" request failed + // because the connection dropped immediately after being established. + // If this happened, retry the connect procedure. + bhdErr := nmxutil.ToBleHost(err) + retry := bhdErr != nil && bhdErr.Status == ERR_CODE_ENOTCONN + return retry, err } if err := s.conn.ExchangeMtu(); err != nil { + // An ENOTCONN error code implies the connection dropped before the + // first ACL data transmission. If this happened, retry the connect + // procedure. bhdErr := nmxutil.ToBleHost(err) retry := bhdErr != nil && bhdErr.Status == ERR_CODE_ENOTCONN return retry, err This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] ccollins476ad closed pull request #591: apps/blehr: Added heart-rate sensor app
ccollins476ad closed pull request #591: apps/blehr: Added heart-rate sensor app URL: https://github.com/apache/mynewt-core/pull/591 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/apps/blehr/README.md b/apps/blehr/README.md new file mode 100644 index 0..d06d95ded --- /dev/null +++ b/apps/blehr/README.md @@ -0,0 +1,9 @@ +# BLE Heart Rate peripheral app. + +The source files are located in the src/ directory. + +pkg.yml contains the base definition of the app. + +syscfg.yml contains setting definitions and overrides. + + diff --git a/apps/blehr/pkg.yml b/apps/blehr/pkg.yml new file mode 100644 index 0..6c67270e8 --- /dev/null +++ b/apps/blehr/pkg.yml @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +pkg.name: apps/blehr +pkg.type: app +pkg.description: BLE peripheral heartrate sensor. +pkg.author: "Szymon Czapracki" +pkg.email: "szymon.czapra...@codecoup.pl" +pkg.homepage: "http://mynewt.apache.org/; +pkg.keywords: + +pkg.deps: +- boot/bootutil +- kernel/os +- net/nimble/controller +- net/nimble/host +- net/nimble/host/services/gap +- net/nimble/host/services/gatt +- net/nimble/host/store/config +- net/nimble/transport/ram +- sys/console/full +- sys/log/full +- sys/stats/full +- sys/sysinit +- sys/id diff --git a/apps/blehr/src/blehr_sens.h b/apps/blehr/src/blehr_sens.h new file mode 100644 index 0..2eec9ddf4 --- /dev/null +++ b/apps/blehr/src/blehr_sens.h @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 H_BLEHR_SENSOR_ +#define H_BLEHR_SENSOR_ + +#include "log/log.h" +#include "nimble/ble.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct log blehr_log; + +/* blehr uses the first "peruser" log module */ +#define BLEHR_LOG_MODULE (LOG_MODULE_PERUSER + 0) + +/* Convenience macro for logging to the blerh module */ +#define BLEHR_LOG(lvl, ...) \ +LOG_ ## lvl(_log, BLEHR_LOG_MODULE, __VA_ARGS__) + +/* Heart-rate configuration */ +#define GATT_HRS_UUID 0x180D +#define GATT_HRS_MEASUREMENT_UUID 0x2A37 +#define GATT_HRS_BODY_SENSOR_LOC_UUID 0x2A38 +#define GATT_DEVICE_INFO_UUID 0x180A +#define GATT_MANUFACTURER_NAME_UUID 0x2A29 +#define GATT_MODEL_NUMBER_UUID 0x2A24 + +extern uint16_t hrs_hrm_handle; + +int gatt_svr_init(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/apps/blehr/src/gatt_svr.c b/apps/blehr/src/gatt_svr.c new file mode 100644 index 0..eac843e8a --- /dev/null +++ b/apps/blehr/src/gatt_svr.c @@ -0,0 +1,177 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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
[mynewt-core] 02/03: BLE Host - Corrections for heartrate PR (591).
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit aadf9baf059844d1e6b9803f2e08398faa4f2d4e Author: Christopher CollinsAuthorDate: Mon Oct 30 13:37:56 2017 -0700 BLE Host - Corrections for heartrate PR (591). * Make ble_hs_id_use_addr() private to net/nimble/host * Remove call to ble_hs_id_use_addr() in blehr app * Remove duplicate ble_hs_id_infer_auto() prototype --- apps/blehr/src/main.c| 10 +++--- net/nimble/host/include/host/ble_hs_id.h | 3 --- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/apps/blehr/src/main.c b/apps/blehr/src/main.c index 150e134..276d3e5 100644 --- a/apps/blehr/src/main.c +++ b/apps/blehr/src/main.c @@ -40,7 +40,7 @@ static const char *device_name = "blehr_sensor"; static int blehr_gap_event(struct ble_gap_event *event, void *arg); -static uint8_t addr_type; +static uint8_t blehr_addr_type; /* Sending notify data timer */ static struct os_callout blehr_tx_timer; @@ -98,7 +98,7 @@ blehr_advertise(void) memset(_params, 0, sizeof(adv_params)); adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; -rc = ble_gap_adv_start(addr_type, NULL, BLE_HS_FOREVER, +rc = ble_gap_adv_start(blehr_addr_type, NULL, BLE_HS_FOREVER, _params, blehr_gap_event, NULL); if (rc != 0) { BLEHR_LOG(ERROR, "error enabling advertisement; rc=%d\n", rc); @@ -210,13 +210,9 @@ static void blehr_on_sync(void) { int rc; -uint8_t addr_type; /* Use privacy */ -rc = ble_hs_id_infer_auto(1, _type); -assert(rc == 0); - -rc = ble_hs_id_use_addr(addr_type); +rc = ble_hs_id_infer_auto(0, _addr_type); assert(rc == 0); /* Begin advertising */ diff --git a/net/nimble/host/include/host/ble_hs_id.h b/net/nimble/host/include/host/ble_hs_id.h index 737bc39..cb2593a 100644 --- a/net/nimble/host/include/host/ble_hs_id.h +++ b/net/nimble/host/include/host/ble_hs_id.h @@ -33,9 +33,6 @@ int ble_hs_id_copy_addr(uint8_t id_addr_type, uint8_t *out_id_addr, int *out_is_nrpa); int ble_hs_id_infer_auto(int privacy, uint8_t *out_addr_type); -int ble_hs_id_infer_auto(int privacy, uint8_t *out_addr_type); -int ble_hs_id_use_addr(uint8_t addr_type); - #ifdef __cplusplus } #endif -- To stop receiving notification emails like this one, please contact "commits@mynewt.apache.org" .
[mynewt-core] branch master updated (1ce1891 -> ad715a9)
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from 1ce1891 Merge pull request #638 from wes3/lora_mbuf new aacacde apps/blehr: Added heart-rate sensor app new aadf9ba BLE Host - Corrections for heartrate PR (591). new ad715a9 BLE Host - Lock mutex in ble_hs_id_infer_auto() The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: apps/blehr/README.md | 9 + apps/{bleprph_oic => blehr}/pkg.yml| 16 +- .../src/tbb.h => blehr/src/blehr_sens.h} | 31 ++- apps/blehr/src/gatt_svr.c | 177 ++ apps/blehr/src/main.c | 263 + apps/{blesplit => blehr}/syscfg.yml| 21 +- net/nimble/host/src/ble_hs_id.c| 12 +- net/nimble/host/test/src/ble_hs_id_test.c | 2 - 8 files changed, 493 insertions(+), 38 deletions(-) create mode 100644 apps/blehr/README.md copy apps/{bleprph_oic => blehr}/pkg.yml (83%) copy apps/{testbench/src/tbb.h => blehr/src/blehr_sens.h} (54%) create mode 100644 apps/blehr/src/gatt_svr.c create mode 100644 apps/blehr/src/main.c copy apps/{blesplit => blehr}/syscfg.yml (78%) -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org"'].
[mynewt-core] 01/03: apps/blehr: Added heart-rate sensor app
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit aacacde347fdc239629e0edc1716decf3336138f Author: szymon-czaprackiAuthorDate: Fri Sep 29 14:09:40 2017 +0200 apps/blehr: Added heart-rate sensor app --- apps/blehr/README.md | 9 + apps/blehr/pkg.yml | 40 +++ .../ble_hs_id.h => apps/blehr/src/blehr_sens.h | 31 ++- apps/blehr/src/gatt_svr.c | 177 ++ apps/blehr/src/main.c | 267 + apps/blehr/syscfg.yml | 35 +++ net/nimble/host/include/host/ble_hs_id.h | 3 + 7 files changed, 554 insertions(+), 8 deletions(-) diff --git a/apps/blehr/README.md b/apps/blehr/README.md new file mode 100644 index 000..d06d95d --- /dev/null +++ b/apps/blehr/README.md @@ -0,0 +1,9 @@ +# BLE Heart Rate peripheral app. + +The source files are located in the src/ directory. + +pkg.yml contains the base definition of the app. + +syscfg.yml contains setting definitions and overrides. + + diff --git a/apps/blehr/pkg.yml b/apps/blehr/pkg.yml new file mode 100644 index 000..6c67270 --- /dev/null +++ b/apps/blehr/pkg.yml @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +pkg.name: apps/blehr +pkg.type: app +pkg.description: BLE peripheral heartrate sensor. +pkg.author: "Szymon Czapracki" +pkg.email: "szymon.czapra...@codecoup.pl" +pkg.homepage: "http://mynewt.apache.org/; +pkg.keywords: + +pkg.deps: +- boot/bootutil +- kernel/os +- net/nimble/controller +- net/nimble/host +- net/nimble/host/services/gap +- net/nimble/host/services/gatt +- net/nimble/host/store/config +- net/nimble/transport/ram +- sys/console/full +- sys/log/full +- sys/stats/full +- sys/sysinit +- sys/id diff --git a/net/nimble/host/include/host/ble_hs_id.h b/apps/blehr/src/blehr_sens.h similarity index 54% copy from net/nimble/host/include/host/ble_hs_id.h copy to apps/blehr/src/blehr_sens.h index cb2593a..2eec9dd 100644 --- a/net/nimble/host/include/host/ble_hs_id.h +++ b/apps/blehr/src/blehr_sens.h @@ -17,21 +17,36 @@ * under the License. */ -#ifndef H_BLE_HS_ID_ -#define H_BLE_HS_ID_ +#ifndef H_BLEHR_SENSOR_ +#define H_BLEHR_SENSOR_ -#include +#include "log/log.h" #include "nimble/ble.h" #ifdef __cplusplus extern "C" { #endif -int ble_hs_id_gen_rnd(int nrpa, ble_addr_t *out_addr); -int ble_hs_id_set_rnd(const uint8_t *rnd_addr); -int ble_hs_id_copy_addr(uint8_t id_addr_type, uint8_t *out_id_addr, -int *out_is_nrpa); -int ble_hs_id_infer_auto(int privacy, uint8_t *out_addr_type); +extern struct log blehr_log; + +/* blehr uses the first "peruser" log module */ +#define BLEHR_LOG_MODULE (LOG_MODULE_PERUSER + 0) + +/* Convenience macro for logging to the blerh module */ +#define BLEHR_LOG(lvl, ...) \ +LOG_ ## lvl(_log, BLEHR_LOG_MODULE, __VA_ARGS__) + +/* Heart-rate configuration */ +#define GATT_HRS_UUID 0x180D +#define GATT_HRS_MEASUREMENT_UUID 0x2A37 +#define GATT_HRS_BODY_SENSOR_LOC_UUID 0x2A38 +#define GATT_DEVICE_INFO_UUID 0x180A +#define GATT_MANUFACTURER_NAME_UUID 0x2A29 +#define GATT_MODEL_NUMBER_UUID 0x2A24 + +extern uint16_t hrs_hrm_handle; + +int gatt_svr_init(void); #ifdef __cplusplus } diff --git a/apps/blehr/src/gatt_svr.c b/apps/blehr/src/gatt_svr.c new file mode 100644 index 000..eac843e --- /dev/null +++ b/apps/blehr/src/gatt_svr.c @@ -0,0 +1,177 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 +
[GitHub] wes3 closed pull request #638: net/lora: Fix assumption of flat buffers
wes3 closed pull request #638: net/lora: Fix assumption of flat buffers URL: https://github.com/apache/mynewt-core/pull/638 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/net/lora/node/include/node/mac/LoRaMac.h b/net/lora/node/include/node/mac/LoRaMac.h index 7d0dde76d..880e5b771 100644 --- a/net/lora/node/include/node/mac/LoRaMac.h +++ b/net/lora/node/include/node/mac/LoRaMac.h @@ -718,14 +718,6 @@ typedef struct sMcpsReqUnconfirmed */ uint8_t fPort; /*! - * Pointer to the buffer of the frame payload - */ -void *fBuffer; -/*! - * Size of the frame payload - */ -uint16_t fBufferSize; -/*! * Uplink datarate, if ADR is off */ int8_t Datarate; @@ -744,14 +736,6 @@ typedef struct sMcpsReqConfirmed */ uint8_t fPort; /*! - * Pointer to the buffer of the frame payload - */ -void *fBuffer; -/*! - * Size of the frame payload - */ -uint16_t fBufferSize; -/*! * Uplink datarate, if ADR is off */ int8_t Datarate; @@ -784,14 +768,6 @@ typedef struct sMcpsReqConfirmed typedef struct sMcpsReqProprietary { /*! - * Pointer to the buffer of the frame payload - */ -void *fBuffer; -/*! - * Size of the frame payload - */ -uint16_t fBufferSize; -/*! * Uplink datarate, if ADR is off */ int8_t Datarate; diff --git a/net/lora/node/src/lora_app.c b/net/lora/node/src/lora_app.c index 18d8f167c..4a3959319 100644 --- a/net/lora/node/src/lora_app.c +++ b/net/lora/node/src/lora_app.c @@ -277,13 +277,11 @@ lora_app_port_send(uint8_t port, Mcps_t pkt_type, struct os_mbuf *om) struct lora_pkt_info *lpkt; /* If no buffer to send, fine. */ -if (om == NULL) { -return LORA_APP_STATUS_OK; +if ((om == NULL) || (OS_MBUF_PKTLEN(om) == 0)) { +return LORA_APP_STATUS_INVALID_PARAM; } assert(OS_MBUF_USRHDR_LEN(om) >= sizeof(struct lora_pkt_info)); -/* XXX: TODO: support multicast */ - /* Check valid packet type. Only confirmed and unconfirmed for now. */ if ((pkt_type != MCPS_UNCONFIRMED) && (pkt_type != MCPS_CONFIRMED)) { return LORA_APP_STATUS_INVALID_PARAM; diff --git a/net/lora/node/src/lora_node.c b/net/lora/node/src/lora_node.c index f55fecf79..55358daf2 100644 --- a/net/lora/node/src/lora_node.c +++ b/net/lora/node/src/lora_node.c @@ -427,22 +427,14 @@ lora_mac_proc_tx_q_event(struct os_event *ev) case MCPS_UNCONFIRMED: if (lpkt) { req.Req.Unconfirmed.fPort = lpkt->port; -req.Req.Unconfirmed.fBuffer = om->om_data; -req.Req.Unconfirmed.fBufferSize = OS_MBUF_PKTLEN(om); } evstatus = LORAMAC_EVENT_INFO_STATUS_OK; break; case MCPS_CONFIRMED: req.Req.Confirmed.fPort = lpkt->port; -req.Req.Confirmed.fBuffer = om->om_data; -req.Req.Confirmed.fBufferSize = OS_MBUF_PKTLEN(om); req.Req.Confirmed.NbTrials = lpkt->txdinfo.retries; evstatus = LORAMAC_EVENT_INFO_STATUS_OK; break; -case MCPS_MULTICAST: -/* XXX: implement */ -evstatus = LORAMAC_EVENT_INFO_STATUS_ERROR; -break; case MCPS_PROPRIETARY: /* XXX: not allowed */ evstatus = LORAMAC_EVENT_INFO_STATUS_ERROR; diff --git a/net/lora/node/src/mac/LoRaMac.c b/net/lora/node/src/mac/LoRaMac.c index ddfacc1ec..108afff4a 100644 --- a/net/lora/node/src/mac/LoRaMac.c +++ b/net/lora/node/src/mac/LoRaMac.c @@ -155,7 +155,6 @@ static uint8_t LoRaMacTxPayloadLen; /*! * Buffer containing the upper layer data. */ -static uint8_t LoRaMacPayload[LORAMAC_PHY_MAXPAYLOAD]; static uint8_t LoRaMacRxPayload[LORAMAC_PHY_MAXPAYLOAD]; /*! @@ -927,18 +926,18 @@ static bool DisableChannelInMask( uint8_t id, uint16_t* mask ); /*! * \brief Decodes MAC commands in the fOpts field and in the payload */ -static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t commandsSize, uint8_t snr ); +static void ProcessMacCommands(uint8_t *payload, uint8_t macIndex, uint8_t commandsSize, uint8_t snr); /*! * \brief LoRaMAC layer generic send frame * * \param [IN] macHdr MAC header field * \param [IN] fPort MAC payload port - * \param [IN] fBuffer MAC data buffer to be sent - * \param [IN] fBufferSize MAC data buffer size + * \param [IN] m mbuf containing MAC payload * \retval status Status of the operation. */ -LoRaMacStatus_t Send( LoRaMacHeader_t *macHdr, uint8_t fPort, void *fBuffer, uint16_t fBufferSize ); + +LoRaMacStatus_t Send(LoRaMacHeader_t *macHdr, uint8_t fPort, struct os_mbuf *m); /*!
[mynewt-core] 01/01: Merge pull request #638 from wes3/lora_mbuf
This is an automated email from the ASF dual-hosted git repository. wes3 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 1ce1891be8f9c37fb1292fc3884dbce51467 Merge: b678645 45315b9 Author: wes3AuthorDate: Mon Oct 30 13:28:12 2017 -0700 Merge pull request #638 from wes3/lora_mbuf net/lora: Fix assumption of flat buffers net/lora/node/include/node/mac/LoRaMac.h | 24 - net/lora/node/src/lora_app.c | 6 +- net/lora/node/src/lora_node.c| 8 -- net/lora/node/src/mac/LoRaMac.c | 163 +++ 4 files changed, 83 insertions(+), 118 deletions(-) -- To stop receiving notification emails like this one, please contact "commits@mynewt.apache.org" .
[mynewt-core] branch master updated (b678645 -> 1ce1891)
This is an automated email from the ASF dual-hosted git repository. wes3 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from b678645 Merge pull request #630 from vsyn/lp5523 add 45315b9 net/lora: Fix assumption of flat buffers new 1ce1891 Merge pull request #638 from wes3/lora_mbuf The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: net/lora/node/include/node/mac/LoRaMac.h | 24 - net/lora/node/src/lora_app.c | 6 +- net/lora/node/src/lora_node.c| 8 -- net/lora/node/src/mac/LoRaMac.c | 163 +++ 4 files changed, 83 insertions(+), 118 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org"'].
[GitHub] mkiiskila opened a new pull request #48: mtu improvements when tx'ing
mkiiskila opened a new pull request #48: mtu improvements when tx'ing URL: https://github.com/apache/mynewt-newtmgr/pull/48 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] branch master updated (be934fc -> b678645)
This is an automated email from the ASF dual-hosted git repository. julian pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from be934fc Merge pull request #637 from wes3/lora_dr add 5ff4a16 LP5523: LED Driver new b678645 Merge pull request #630 from vsyn/lp5523 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: hw/drivers/lp5523/include/lp5523/lp5523.h| 1256 ++ hw/drivers/{sensors/bno055 => lp5523}/pkg.yml| 24 +- hw/drivers/lp5523/src/lp5523.c | 878 +++ hw/drivers/lp5523/src/lp5523_shell.c | 1018 ++ hw/drivers/{sensors/bno055 => lp5523}/syscfg.yml | 18 +- 5 files changed, 3173 insertions(+), 21 deletions(-) create mode 100644 hw/drivers/lp5523/include/lp5523/lp5523.h copy hw/drivers/{sensors/bno055 => lp5523}/pkg.yml (80%) create mode 100644 hw/drivers/lp5523/src/lp5523.c create mode 100644 hw/drivers/lp5523/src/lp5523_shell.c copy hw/drivers/{sensors/bno055 => lp5523}/syscfg.yml (73%) -- To stop receiving notification emails like this one, please contact ['"commits@mynewt.apache.org"'].
[mynewt-core] 01/01: Merge pull request #630 from vsyn/lp5523
This is an automated email from the ASF dual-hosted git repository. julian pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit b678645487e7bb752b6d10c338797a226031d84a Merge: be934fc 5ff4a16 Author: IMGJulianAuthorDate: Mon Oct 30 12:08:53 2017 + Merge pull request #630 from vsyn/lp5523 LP5523: LED Driver hw/drivers/lp5523/include/lp5523/lp5523.h | 1256 + hw/drivers/lp5523/pkg.yml | 39 + hw/drivers/lp5523/src/lp5523.c| 878 hw/drivers/lp5523/src/lp5523_shell.c | 1018 +++ hw/drivers/lp5523/syscfg.yml | 32 + 5 files changed, 3223 insertions(+) -- To stop receiving notification emails like this one, please contact "commits@mynewt.apache.org" .
[GitHub] IMGJulian closed pull request #630: LP5523: LED Driver
IMGJulian closed pull request #630: LP5523: LED Driver URL: https://github.com/apache/mynewt-core/pull/630 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/hw/drivers/lp5523/include/lp5523/lp5523.h b/hw/drivers/lp5523/include/lp5523/lp5523.h new file mode 100644 index 0..0b8a758a9 --- /dev/null +++ b/hw/drivers/lp5523/include/lp5523/lp5523.h @@ -0,0 +1,1256 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 __LP5523_H__ +#define __LP5523_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define LP5523_I2C_BASE_ADDR (0x32) + +/* Engine control mask */ +#define LP5523_ENGINE3_MASK (0x03) +#define LP5523_ENGINE2_MASK (0x0c) +#define LP5523_ENGINE1_MASK (0x30) + +/* Engine IDs */ +#define LP5523_ENGINE3 (3) +#define LP5523_ENGINE2 (2) +#define LP5523_ENGINE1 (1) + +/* LED IDs */ +#define LP5523_LED9 (9) +#define LP5523_LED8 (8) +#define LP5523_LED7 (7) +#define LP5523_LED6 (6) +#define LP5523_LED5 (5) +#define LP5523_LED4 (4) +#define LP5523_LED3 (3) +#define LP5523_LED2 (2) +#define LP5523_LED1 (1) + +struct lp5523_cfg { +/* The 2 LSBs of this represent ASEL1 and ASEL0 */ +uint8_t asel; +uint8_t clk_det_en; +uint8_t int_clk_en; +uint8_t cp_mode; +uint8_t int_conf; +}; + +struct lp5523 { +struct os_dev dev; +struct sensor sensor; +struct lp5523_cfg cfg; +}; + +/* register addresses */ + +enum lp5523_bitfield_registers { +LP5523_OUTPUT_RATIOMETRIC = 0x02, +LP5523_OUTPUT_CONTROL = 0x04, +LP5523_ENG_MAPPING = 0x70 +}; + +enum lp5523_output_registers { +LP5523_CONTROL = 0x06, +LP5523_PWM = 0x16, +LP5523_CURRENT_CONTROL = 0x26 +}; + +enum lp5523_engine_registers { +LP5523_ENGINE_PC = 0x37, +LP5523_ENGINE_VARIABLE_A = 0x45, +LP5523_MASTER_FADER = 0x48, +LP5523_ENG_PROG_START_ADDR = 0x4c +}; + +enum lp5523_engine_control_registers { +LP5523_ENGINE_CNTRL1 = 0x00, +LP5523_ENGINE_CNTRL2 = 0x01 +}; + +enum lp5523_registers { +LP5523_ENABLE = 0x00, +LP5523_MISC = 0x36, +LP5523_STATUS = 0x3a, +LP5523_INTERRUPT = 0x3a, +LP5523_INT = 0x3b, +LP5523_VARIABLE = 0x3c, +LP5523_RESET = 0x3d, +LP5523_TEMP_ADC_CONTROL = 0x3e, +LP5523_TEMPERATURE_READ = 0x3f, +LP5523_TEMPERATURE_WRITE = 0x40, +LP5523_LED_TEST_CONTROL = 0x41, +LP5523_LED_TEST_ADC = 0x42, +LP5523_PROG_MEM_PAGE_SEL = 0x4f, +LP5523_PROGRAM_MEMORY = 0x50, +LP5523_GAIN_CHANGE_CTRL = 0x76 +}; + +/* registers */ +struct lp5523_register_value { +uint8_t reg; +uint8_t pos; +uint8_t mask; +}; + +#define LP5523_REGISTER_VALUE(r, n, p, m) \ +static const struct lp5523_register_value n = { .reg = r, .pos = p, .mask = m } + +/* control1 */ +LP5523_REGISTER_VALUE(LP5523_ENABLE, LP5523_CHIP_EN, 6, 0x40); + +#define LP5523_ENGINES_HOLD (0x00) +#define LP5523_ENGINES_STEP (0x15) +#define LP5523_ENGINES_FREE_RUN (0x2a) +#define LP5523_ENGINES_EXECUTE_ONCE (0x3f) + +/* control2 */ +#define LP5523_ENGINES_DISABLED (0x00) +#define LP5523_ENGINES_LOAD_PROGRAM (0x15) +#define LP5523_ENGINES_RUN_PROGRAM (0x2a) +#define LP5523_ENGINES_HALT (0x3f) + +/* output control */ +LP5523_REGISTER_VALUE(LP5523_CONTROL, LP5523_OUTPUT_MAPPING, 6, 0xc0); +LP5523_REGISTER_VALUE(LP5523_CONTROL, LP5523_OUTPUT_LOG_EN, 5, 0x20); +LP5523_REGISTER_VALUE(LP5523_CONTROL, LP5523_OUTPUT_TEMP_COMP, 0, 0x1f); + +/* misc */ +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_VARIABLE_D_SEL, 7, 0x80); +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_EN_AUTO_INCR, 6, 0x40); +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_POWERSAVE_EN, 5, 0x20); +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_CP_MODE, 3, 0x18); + +#define LP5523_CP_OFF (0x00) +#define LP5523_CP_FORCED_BYPASS (0x01) +#define LP5523_CP_FORCED_BOOST (0x02) +#define LP5523_CP_AUTOMATIC (0x03) + +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_PWM_PS_EN, 2, 0x04); +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_CLK_DET_EN, 1, 0x02); +LP5523_REGISTER_VALUE(LP5523_MISC, LP5523_INT_CLK_EN, 0, 0x01); + +/* status