forked from acco/chti23
		
	Pwm wip
This commit is contained in:
		
							parent
							
								
									1f9ac64237
								
							
						
					
					
						commit
						0fc477a68d
					
				
					 4 changed files with 61 additions and 19 deletions
				
			
		|  | @ -2,13 +2,13 @@ | ||||||
| 	THUMB    | 	THUMB    | ||||||
| 	 | 	 | ||||||
| 	export CallbackSon | 	export CallbackSon | ||||||
| 	 | 	include DriverJeuLaser.inc | ||||||
| 		 | 		 | ||||||
| 
 | 
 | ||||||
| ; ====================== zone de réservation de données,  ======================================
 | ; ====================== zone de réservation de données,  ======================================
 | ||||||
| ;Section RAM (read only) :
 | ;Section RAM (read only) :
 | ||||||
| 	area    mesdata,data,readonly | 	area    mesdata,data,readonly | ||||||
| 
 | 	IMPORT LongueurSon | ||||||
| 	IMPORT Son | 	IMPORT Son | ||||||
| 		 | 		 | ||||||
| ;Section RAM (read write):
 | ;Section RAM (read write):
 | ||||||
|  | @ -30,18 +30,48 @@ SortieSon dcw 0; | ||||||
| 
 | 
 | ||||||
| CallbackSon proc | CallbackSon proc | ||||||
| 	 | 	 | ||||||
| 	ldr r0,=index | 	push{lr} | ||||||
| 	ldr r1,[r0]; valeur index
 | 	 | ||||||
| 	add r1,#1;
 | 	ldr r0,=LongueurSon | ||||||
| 	str r1,[r0] ;mettre a jour index
 | 	ldr r1,=index ; @ index
 | ||||||
|  | 	ldr r2,[r1] | ||||||
|  | 	ldr r3,[r0] | ||||||
|  | 	cmp r2,r3 | ||||||
|  | 	beq ret | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	ldr r0, =Son ; recuperer @ son
 | 	ldr r0, =Son ; recuperer @ son
 | ||||||
| 	ldrh r1, [r0];valeur son
 | 	movs r2,r2,lsl #1 | ||||||
|  | 	add r0,r2 | ||||||
|  | 	ldrsh r2,[r0];valeur son
 | ||||||
|  | 
 | ||||||
|  | 	ldr r0, =SortieSon ;@ sortie son
 | ||||||
| 	 | 	 | ||||||
| 	ldr r2, =SortieSon ;@ sortie son
 | 	;mise a l'echelle;
 | ||||||
| 	str r1,[r2]; mettre a jour SortieSon
 | 	add r2,#32768 | ||||||
|  | 	mov r3,#719 | ||||||
|  | 	mul r2,r3 | ||||||
|  | 	mov r2,r2,asr #16 | ||||||
| 	 | 	 | ||||||
|  | 	; mettre a jour SortieSon
 | ||||||
|  | 	str r2,[r0] | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | 	push{r1} | ||||||
|  | 	mov r0,r2 | ||||||
|  | 	bl PWM_Set_Value_TIM3_Ch3 | ||||||
|  | 	pop{r1} | ||||||
|  | 	 | ||||||
|  | 	;incrementer index
 | ||||||
|  | 	ldr r0,[r1]; valeur index
 | ||||||
|  | 	add r0,#1;
 | ||||||
|  | 	str r0,[r1] ;mettre a jour index
 | ||||||
|  | 	 | ||||||
|  | 
 | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | ret | ||||||
|  | 	pop{pc} | ||||||
| 	bx lr | 	bx lr | ||||||
| 
 | 
 | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #include "DriverJeuLaser.h" | #include "DriverJeuLaser.h" | ||||||
| #include<math.h> |  | ||||||
| 
 | 
 | ||||||
| extern void CallbackSon(void); | extern void CallbackSon(void); | ||||||
| 
 | 
 | ||||||
|  | @ -20,8 +19,8 @@ Timer_1234_Init_ff(TIM4,tick); | ||||||
| 	 | 	 | ||||||
| Active_IT_Debordement_Timer( TIM4, 2, CallbackSon ); | Active_IT_Debordement_Timer( TIM4, 2, CallbackSon ); | ||||||
| 
 | 
 | ||||||
| 	 | PWM_Init_ff( TIM3, 3, 720); | ||||||
| 	 | GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL); | ||||||
| 
 | 
 | ||||||
| //============================================================================	
 | //============================================================================	
 | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
|  | @ -157,9 +157,9 @@ | ||||||
|         <Bp> |         <Bp> | ||||||
|           <Number>0</Number> |           <Number>0</Number> | ||||||
|           <Type>0</Type> |           <Type>0</Type> | ||||||
|           <LineNumber>33</LineNumber> |           <LineNumber>57</LineNumber> | ||||||
|           <EnabledFlag>1</EnabledFlag> |           <EnabledFlag>1</EnabledFlag> | ||||||
|           <Address>134220060</Address> |           <Address>134220678</Address> | ||||||
|           <ByteObject>0</ByteObject> |           <ByteObject>0</ByteObject> | ||||||
|           <HtxType>0</HtxType> |           <HtxType>0</HtxType> | ||||||
|           <ManyObjects>0</ManyObjects> |           <ManyObjects>0</ManyObjects> | ||||||
|  | @ -168,7 +168,7 @@ | ||||||
|           <BreakIfRCount>1</BreakIfRCount> |           <BreakIfRCount>1</BreakIfRCount> | ||||||
|           <Filename>.\Src\GestionSon.s</Filename> |           <Filename>.\Src\GestionSon.s</Filename> | ||||||
|           <ExecCommand></ExecCommand> |           <ExecCommand></ExecCommand> | ||||||
|           <Expression>\\StepSon\Src/GestionSon.s\33</Expression> |           <Expression>\\StepSon\Src/GestionSon.s\57</Expression> | ||||||
|         </Bp> |         </Bp> | ||||||
|       </Breakpoint> |       </Breakpoint> | ||||||
|       <WatchWindow1> |       <WatchWindow1> | ||||||
|  | @ -178,6 +178,14 @@ | ||||||
|           <ItemText>SortieSon</ItemText> |           <ItemText>SortieSon</ItemText> | ||||||
|         </Ww> |         </Ww> | ||||||
|       </WatchWindow1> |       </WatchWindow1> | ||||||
|  |       <MemoryWindow1> | ||||||
|  |         <Mm> | ||||||
|  |           <WinNumber>1</WinNumber> | ||||||
|  |           <SubType>265</SubType> | ||||||
|  |           <ItemText>R0</ItemText> | ||||||
|  |           <AccSizeX>0</AccSizeX> | ||||||
|  |         </Mm> | ||||||
|  |       </MemoryWindow1> | ||||||
|       <Tracepoint> |       <Tracepoint> | ||||||
|         <THDelay>0</THDelay> |         <THDelay>0</THDelay> | ||||||
|       </Tracepoint> |       </Tracepoint> | ||||||
|  | @ -223,8 +231,13 @@ | ||||||
|       <LogicAnalyzers> |       <LogicAnalyzers> | ||||||
|         <Wi> |         <Wi> | ||||||
|           <IntNumber>0</IntNumber> |           <IntNumber>0</IntNumber> | ||||||
|           <FirstString>((portb & 0x00000002) >> 1 & 0x2) >> 1</FirstString> |           <FirstString>`SortieSon</FirstString> | ||||||
|           <SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F100000000000000000000000000000000000000096020008</SecondString> |           <SecondString>FF0000000000000000000000000000000050824000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F0C00000000000000000000000000000000000000E8080008</SecondString> | ||||||
|  |         </Wi> | ||||||
|  |         <Wi> | ||||||
|  |           <IntNumber>1</IntNumber> | ||||||
|  |           <FirstString>((portb & 0x00000001) & 0x1) >> 0</FirstString> | ||||||
|  |           <SecondString>00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F72746220262030783030303030303031290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F0C00000000000000000000000000000000000000080B0008</SecondString> | ||||||
|         </Wi> |         </Wi> | ||||||
|       </LogicAnalyzers> |       </LogicAnalyzers> | ||||||
|       <DebugDescription> |       <DebugDescription> | ||||||
|  | @ -712,7 +725,7 @@ | ||||||
|       <GroupNumber>4</GroupNumber> |       <GroupNumber>4</GroupNumber> | ||||||
|       <FileNumber>5</FileNumber> |       <FileNumber>5</FileNumber> | ||||||
|       <FileType>2</FileType> |       <FileType>2</FileType> | ||||||
|       <tvExp>0</tvExp> |       <tvExp>1</tvExp> | ||||||
|       <tvExpOptDlg>0</tvExpOptDlg> |       <tvExpOptDlg>0</tvExpOptDlg> | ||||||
|       <bDave2>0</bDave2> |       <bDave2>0</bDave2> | ||||||
|       <PathWithFileName>.\Src\GestionSon.s</PathWithFileName> |       <PathWithFileName>.\Src\GestionSon.s</PathWithFileName> | ||||||
|  |  | ||||||
|  | @ -357,7 +357,7 @@ | ||||||
|               <MiscControls></MiscControls> |               <MiscControls></MiscControls> | ||||||
|               <Define></Define> |               <Define></Define> | ||||||
|               <Undefine></Undefine> |               <Undefine></Undefine> | ||||||
|               <IncludePath></IncludePath> |               <IncludePath>.\Driver</IncludePath> | ||||||
|             </VariousControls> |             </VariousControls> | ||||||
|           </Aads> |           </Aads> | ||||||
|           <LDads> |           <LDads> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue