{"action":"created","issue":{"url":"https://api.github.com/repos/mbedmicro/mbed/issues/932","labels_url":"https://api.github.com/repos/mbedmicro/mbed/issues/932/labels{/name}","comments_url":"https://api.github.com/repos/mbedmicro/mbed/issues/932/comments","events_url":"https://api.github.com/repos/mbedmicro/mbed/issues/932/events","html_url":"https://github.com/mbedmicro/mbed/pull/932","id":58974137,"number":932,"title":"Replace Nordic's appTimer with a driver for RTC1","user":{"login":"rgrover","id":112704,"avatar_url":"https://avatars.githubusercontent.com/u/112704?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrover","html_url":"https://github.com/rgrover","followers_url":"https://api.github.com/users/rgrover/followers","following_url":"https://api.github.com/users/rgrover/following{/other_user}","gists_url":"https://api.github.com/users/rgrover/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrover/subscriptions","organizations_url":"https://api.github.com/users/rgrover/orgs","repos_url":"https://api.github.com/users/rgrover/repos","events_url":"https://api.github.com/users/rgrover/events{/privacy}","received_events_url":"https://api.github.com/users/rgrover/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"rgrover","id":112704,"avatar_url":"https://avatars.githubusercontent.com/u/112704?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrover","html_url":"https://github.com/rgrover","followers_url":"https://api.github.com/users/rgrover/followers","following_url":"https://api.github.com/users/rgrover/following{/other_user}","gists_url":"https://api.github.com/users/rgrover/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrover/subscriptions","organizations_url":"https://api.github.com/users/rgrover/orgs","repos_url":"https://api.github.com/users/rgrover/repos","events_url":"https://api.github.com/users/rgrover/events{/privacy}","received_events_url":"https://api.github.com/users/rgrover/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-02-25T21:38:03Z","updated_at":"2015-03-16T14:10:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mbedmicro/mbed/pulls/932","html_url":"https://github.com/mbedmicro/mbed/pull/932","diff_url":"https://github.com/mbedmicro/mbed/pull/932.diff","patch_url":"https://github.com/mbedmicro/mbed/pull/932.patch"},"body":"This requires careful review and testing. I've done a fair bit, but much more is needed.\r\nThis has been very tricky code owing mostly to:\r\n\r\n* trickiness involved in manipulating lists from re-entrant functions in interrupt context.\r\n* RTC counter being 24bit instead of 32bit.\r\n* us_ticker API receiving time in microseconds, whereas RTC counting in units of 1/32Khz.\r\n\r\nPlease review and test. I have a suspicion extensive testing may reveal more hardware related quirks which haven't been taken care of.\r\n"},"comment":{"url":"https://api.github.com/repos/mbedmicro/mbed/issues/comments/81688305","html_url":"https://github.com/mbedmicro/mbed/pull/932#issuecomment-81688305","issue_url":"https://api.github.com/repos/mbedmicro/mbed/issues/932","id":81688305,"user":{"login":"rgrover","id":112704,"avatar_url":"https://avatars.githubusercontent.com/u/112704?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrover","html_url":"https://github.com/rgrover","followers_url":"https://api.github.com/users/rgrover/followers","following_url":"https://api.github.com/users/rgrover/following{/other_user}","gists_url":"https://api.github.com/users/rgrover/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrover/subscriptions","organizations_url":"https://api.github.com/users/rgrover/orgs","repos_url":"https://api.github.com/users/rgrover/repos","events_url":"https://api.github.com/users/rgrover/events{/privacy}","received_events_url":"https://api.github.com/users/rgrover/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T14:10:30Z","updated_at":"2015-03-16T14:10:30Z","body":"I'm using the following main.cpp to test my ticker for long periods of time.\r\n\r\n```C++\r\n#include \"mbed.h\"\r\n#include \"iBeaconService.h\"\r\n\r\nBLEDevice ble;\r\n\r\nTicker ticker1;\r\nTicker ticker2;\r\n\r\nDigitalOut led1(LED1);\r\nDigitalOut led2(LED2);\r\n\r\nvoid periodicCallback1(void)\r\n{\r\n    led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */\r\n}\r\n\r\nvoid periodicCallback2(void)\r\n{\r\n    led2 = !led2; /* Do blinky on LED2 while we're waiting for BLE events */\r\n}\r\n\r\nconst uint8_t uuid[] = {0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4,\r\n                        0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61\r\n                       };\r\nuint16_t majorNumber = 1122;\r\nuint16_t minorNumber = 3344;\r\nuint16_t txPower = 0xC8;\r\n\r\nint main(void)\r\n{\r\n    ble.init();\r\n\r\n    ticker1.attach(periodicCallback1, 0.5);\r\n    ticker2.attach(periodicCallback2, 0.25);\r\n\r\n    iBeaconService ibeacon(ble, uuid, majorNumber, minorNumber, txPower);\r\n\r\n    ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); /* 1000ms. */\r\n    ble.startAdvertising();\r\n\r\n    while(1) {\r\n        ble.waitForEvent(); // allows or low power operation\r\n    }\r\n}\r\n```"}}