Made some cleaning and tired to implement the delay class but it would not have been optimal. we need to look more precisely into it.

interrupts
key 4 years ago
parent e4524cfd6b
commit 20a517a18b

@ -10,7 +10,6 @@ void delayInitMs(uint32_t clk, uint32_t ticks)
void delayMs(uint16_t delay) void delayMs(uint16_t delay)
{ {
uint16_t i = 0;
while (delay) while (delay)
{ {
if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U)

@ -1 +0,0 @@
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/bsl/csl/stm32f042/Src/ @CMAKE_CURRENT_SOURCE_DIR@/bsl/csl/interfaces/

@ -22,10 +22,12 @@ int main(int argc, char *argv[])
NO_PARITY_CTRL, NO_PARITY_CTRL,
noFlowControl); noFlowControl);
// print_Usart(usart2, ASCII_clear); //clears screen and send the wellcome messgae
print_Usart(usart2, ASCII_clear);
print_Usart(usart2, const_cast<char *>("Wellcome to our KED project\n\r")); print_Usart(usart2, const_cast<char *>("Wellcome to our KED project\n\r"));
//blinks 10 times to indicate the sicsessfull init if the device
for(i = 0 ; i < 10 ; i++) for(i = 0 ; i < 10 ; i++)
{ {
delayMs(100); delayMs(100);
@ -35,12 +37,11 @@ int main(int argc, char *argv[])
pinWrite(pinB3,0); pinWrite(pinB3,0);
//usartSendChar(usart2, a);
while(1) while(1)
{ {
//USART will rteturn what wou type and trun led on if you press "1"
a = usartGetChar(usart2); a = usartGetChar(usart2);
usartSendChar(usart2, a); usartSendChar(usart2, a);
if(a == '1') if(a == '1')
{ {
pinWrite(pinB3,1); pinWrite(pinB3,1);
@ -50,7 +51,7 @@ int main(int argc, char *argv[])
pinWrite(pinB3,0); pinWrite(pinB3,0);
} }
/* //test if the gpio port works as an input
if(pinRead(pinA0)) if(pinRead(pinA0))
{ {
pinWrite(pinB3,1); pinWrite(pinB3,1);
@ -59,7 +60,6 @@ int main(int argc, char *argv[])
{ {
pinWrite(pinB3,0); pinWrite(pinB3,0);
} }
*/
delayMs(100); delayMs(100);
} }
return 1; return 1;

Loading…
Cancel
Save