File tree Expand file tree Collapse file tree 5 files changed +15
-15
lines changed
Expand file tree Collapse file tree 5 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ edition = "2021"
44license = " BlueOak-1.0.0"
55name = " neotron-bmc-commands"
66repository = " https://github.com/neotron-compute/neotron-bmc"
7- version = " 0.1 .0"
7+ version = " 0.2 .0"
88homepage = " https://github.com/neotron-compute"
99readme = " README.md"
1010
Original file line number Diff line number Diff line change @@ -217,17 +217,17 @@ should set the other three registers (if required) before setting this register.
217217There is no way to know when the tone is ended; the host should keep track of
218218the duration it set and wait the appropriate period of time.
219219
220- ### Address 0x71 - Speaker Tone Period (Low)
221-
222- Sets the lower 8 bits of the tone period. See * Speaker Tone Period (High)* for details.
223-
224- ### Address 0x72 - Speaker Tone Period (High)
220+ ### Address 0x71 - Speaker Tone Period (High)
225221
226222Sets the upper 8 bits of the tone period. This is the inverse of frequency, in
22722348 kHz units. A value of ` 48000 / 440 = 109 = 0x006D ` will give you a
228224Concert-pitch A (440 Hz). Write that value as ` 0x00 ` in the high register and
229225` 0x6D ` in the low register.
230226
227+ ### Address 0x72 - Speaker Tone Period (Low)
228+
229+ Sets the lower 8 bits of the tone period. See * Speaker Tone Period (High)* for details.
230+
231231### Address 0x73 - Speaker Tone Duty Cycle
232232
233233Sets the duty-cycle of the speaker tone. A value of 127 is 50:50 (a square wave).
Original file line number Diff line number Diff line change @@ -139,16 +139,16 @@ pub enum Command {
139139 /// * Length: 1
140140 /// * Mode: R/W
141141 SpeakerDuration = 0x70 ,
142- /// # Speaker Period (Low byte)
143- /// Low byte of 16-bit period (in 48kHz ticks)
142+ /// # Speaker Tone Period (High byte)
143+ /// High byte of 16-bit period (in 48kHz ticks)
144144 /// * Length: 1
145145 /// * Mode: R/W
146- SpeakerPeriodLow = 0x71 ,
147- /// # Speaker Period (High byte)
148- /// High byte of 16-bit period (in 48kHz ticks)
146+ SpeakerPeriodHigh = 0x71 ,
147+ /// # Speaker Tone Period (Low byte)
148+ /// Low byte of 16-bit period (in 48kHz ticks)
149149 /// * Length: 1
150150 /// * Mode: R/W
151- SpeakerPeriodHigh = 0x72 ,
151+ SpeakerPeriodLow = 0x72 ,
152152 /// # Speaker Duty Cycle
153153 /// Speaker Duty cycle, in 1/255
154154 /// * Length: 1
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ heapless= "0.7"
1717panic-probe = { version = " 0.3" , features = [" print-defmt" ] }
1818stm32f0xx-hal = { version = " 0.18" , features = [" stm32f030x6" , " rt" ] }
1919neotron-bmc-protocol = { version = " 0.1" , path = " ../neotron-bmc-protocol" , features = [" defmt" ] }
20- neotron-bmc-commands = { version = " 0.1 " , path = " ../neotron-bmc-commands" }
20+ neotron-bmc-commands = { version = " 0.2 " , path = " ../neotron-bmc-commands" }
2121systick-monotonic = " 1.0"
2222embedded-hal = " *"
2323
Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ impl RegisterState {
3737 }
3838
3939 pub fn set_period_high ( & mut self , period_high : u8 ) {
40- self . period = ( self . period & 0xff00 ) | period_high as u16 ;
40+ self . period = ( self . period & 0x00ff ) | ( ( period_high as u16 ) << 8 ) ;
4141 }
4242
4343 pub fn period_low ( & self ) -> u8 {
4444 ( self . period & 0xff ) as u8
4545 }
4646
4747 pub fn set_period_low ( & mut self , period_low : u8 ) {
48- self . period = ( self . period ( ) & 0xff ) | ( ( period_low as u16 ) << 8 ) ;
48+ self . period = ( self . period & 0xff00 ) | period_low as u16 ;
4949 }
5050
5151 pub fn duration ( & self ) -> u16 {
You can’t perform that action at this time.
0 commit comments