{"action":"created","issue":{"url":"https://api.github.com/repos/japaric/svd2rust/issues/176","repository_url":"https://api.github.com/repos/japaric/svd2rust","labels_url":"https://api.github.com/repos/japaric/svd2rust/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/japaric/svd2rust/issues/176/comments","events_url":"https://api.github.com/repos/japaric/svd2rust/issues/176/events","html_url":"https://github.com/japaric/svd2rust/issues/176","id":298109465,"number":176,"title":"Generate API for \"write 1 to toggle\" registers","user":{"login":"GGreenwood","id":4715253,"avatar_url":"https://avatars1.githubusercontent.com/u/4715253?v=4","gravatar_id":"","url":"https://api.github.com/users/GGreenwood","html_url":"https://github.com/GGreenwood","followers_url":"https://api.github.com/users/GGreenwood/followers","following_url":"https://api.github.com/users/GGreenwood/following{/other_user}","gists_url":"https://api.github.com/users/GGreenwood/gists{/gist_id}","starred_url":"https://api.github.com/users/GGreenwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GGreenwood/subscriptions","organizations_url":"https://api.github.com/users/GGreenwood/orgs","repos_url":"https://api.github.com/users/GGreenwood/repos","events_url":"https://api.github.com/users/GGreenwood/events{/privacy}","received_events_url":"https://api.github.com/users/GGreenwood/received_events","type":"User","site_admin":false},"labels":[{"id":457767566,"url":"https://api.github.com/repos/japaric/svd2rust/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"Emilgardis","id":1502855,"avatar_url":"https://avatars2.githubusercontent.com/u/1502855?v=4","gravatar_id":"","url":"https://api.github.com/users/Emilgardis","html_url":"https://github.com/Emilgardis","followers_url":"https://api.github.com/users/Emilgardis/followers","following_url":"https://api.github.com/users/Emilgardis/following{/other_user}","gists_url":"https://api.github.com/users/Emilgardis/gists{/gist_id}","starred_url":"https://api.github.com/users/Emilgardis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Emilgardis/subscriptions","organizations_url":"https://api.github.com/users/Emilgardis/orgs","repos_url":"https://api.github.com/users/Emilgardis/repos","events_url":"https://api.github.com/users/Emilgardis/events{/privacy}","received_events_url":"https://api.github.com/users/Emilgardis/received_events","type":"User","site_admin":false},"assignees":[{"login":"Emilgardis","id":1502855,"avatar_url":"https://avatars2.githubusercontent.com/u/1502855?v=4","gravatar_id":"","url":"https://api.github.com/users/Emilgardis","html_url":"https://github.com/Emilgardis","followers_url":"https://api.github.com/users/Emilgardis/followers","following_url":"https://api.github.com/users/Emilgardis/following{/other_user}","gists_url":"https://api.github.com/users/Emilgardis/gists{/gist_id}","starred_url":"https://api.github.com/users/Emilgardis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Emilgardis/subscriptions","organizations_url":"https://api.github.com/users/Emilgardis/orgs","repos_url":"https://api.github.com/users/Emilgardis/repos","events_url":"https://api.github.com/users/Emilgardis/events{/privacy}","received_events_url":"https://api.github.com/users/Emilgardis/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/japaric/svd2rust/milestones/1","html_url":"https://github.com/japaric/svd2rust/milestone/1","labels_url":"https://api.github.com/repos/japaric/svd2rust/milestones/1/labels","id":2543718,"number":1,"title":"cmsis-svd","description":"*Full* compliance with the the [cmsis-svd](https://github.com/posborne/cmsis-svd) SVD file database. svd2rust should work *correctly* with all the files, that adhere to the SVD standard, in that database.","creator":{"login":"japaric","id":5018213,"avatar_url":"https://avatars3.githubusercontent.com/u/5018213?v=4","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":5,"state":"open","created_at":"2017-05-25T20:43:24Z","updated_at":"2018-03-09T02:10:01Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2018-02-18T19:11:39Z","updated_at":"2018-03-14T18:43:20Z","closed_at":null,"author_association":"NONE","body":"Hey all,\r\n\r\nOver in rust-embedded/rfcs#40, user @kinnison  brought up that some of the STM32's USB control registers have a \"write 0 to leave alone; write 1 to toggle\" interface, and that svd2rust isn't generating the proper API for these registers. Since he hasn't filed an issue here yet, this is my attempt to document the feature.\r\n\r\nIn particular, the STM32F0x2 has a register for each USB endpoint with six of these toggleable bits. These registers are described in [RM0091](http://www.st.com/content/ccc/resource/technical/document/reference_manual/c2/f8/8a/f2/18/e6/43/96/DM00031936.pdf/files/DM00031936.pdf/jcr:content/translations/en.DM00031936.pdf) under the name `USB_EPnR`:\r\n\r\n> When the application software writes ‘0, the value of DTOG_TX remains unchanged, while writing ‘1 makes the bit value toggle. This bit is read/write but it can only be toggled by writing 1.\r\n\r\n[Here](https://raw.githubusercontent.com/GGreenwood/stm32f042/master/src/svd.rs) is a link to the current output generated by svd2rust v0.12.0 from [STM32F0x2.svd ](http://www.st.com/resource/en/svd/stm32f0_svd.zip)\r\n\r\n**STM32f0x2.svd**\r\n```\r\n            <field>\r\n              <name>DTOG_TX</name>\r\n              <description>Data Toggle, for transmission\r\n              transfers</description>\r\n              <bitOffset>6</bitOffset>\r\n              <bitWidth>1</bitWidth>\r\n            </field>\r\n```\r\n\r\n**svd2rust API**\r\n```\r\n            #[doc = \"Bit 6 - Data Toggle, for transmission transfers\"]\r\n            #[inline]\r\n            pub fn dtog_tx(&self) -> DTOG_TXR {\r\n                let bits = {\r\n                    const MASK: bool = true;\r\n                    const OFFSET: u8 = 6;\r\n                    ((self.bits >> OFFSET) & MASK as u32) != 0\r\n                };\r\n                DTOG_TXR { bits }\r\n            }\r\n```\r\n\r\n```\r\n            #[doc = \"Bit 6 - Data Toggle, for transmission transfers\"]\r\n            #[inline]\r\n            pub fn dtog_tx(&mut self) -> _DTOG_TXW {\r\n                _DTOG_TXW { w: self }\r\n            }\r\n```\r\n\r\nLet me know if there's any other information I can dig up! I'm still learning embedded on Rust, and am really excited to see where things are headed."},"comment":{"url":"https://api.github.com/repos/japaric/svd2rust/issues/comments/373132751","html_url":"https://github.com/japaric/svd2rust/issues/176#issuecomment-373132751","issue_url":"https://api.github.com/repos/japaric/svd2rust/issues/176","id":373132751,"user":{"login":"ah-","id":1349849,"avatar_url":"https://avatars3.githubusercontent.com/u/1349849?v=4","gravatar_id":"","url":"https://api.github.com/users/ah-","html_url":"https://github.com/ah-","followers_url":"https://api.github.com/users/ah-/followers","following_url":"https://api.github.com/users/ah-/following{/other_user}","gists_url":"https://api.github.com/users/ah-/gists{/gist_id}","starred_url":"https://api.github.com/users/ah-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ah-/subscriptions","organizations_url":"https://api.github.com/users/ah-/orgs","repos_url":"https://api.github.com/users/ah-/repos","events_url":"https://api.github.com/users/ah-/events{/privacy}","received_events_url":"https://api.github.com/users/ah-/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T18:43:20Z","updated_at":"2018-03-14T18:43:20Z","author_association":"NONE","body":"Out of interest, did you get anywhere with this? Are you working on a USB driver?"}}
{"actor":{"display_login":"ah-"}}