Master Thesis  V1.0
Research and Design of Sensor Node for NMSD Treatment
util.c File Reference

Handy functions. More...

#include <util.h>
#include "stdbool.h"
#include "stdint.h"
#include "em_gpio.h"
#include "pinout.h"
Include dependency graph for util.c:

Go to the source code of this file.

Functions

bool Check_Equal (uint8_t *arr1, uint8_t *arr2, uint8_t length)
 Check if two arrays are equal. More...
 
void blink (uint8_t times)
 Function to blink LED on sensor node. More...
 

Detailed Description

Handy functions.

Version
1.0
Author
Jona Cappelle

Definition in file util.c.

Function Documentation

◆ blink()

void blink ( uint8_t  times)

Function to blink LED on sensor node.

Parameters
[in]timesamount of times to blink the LED

Definition at line 57 of file util.c.

58 {
59 #if DIY == 1
60  GPIO_PinModeSet(LED_PORT, LED_PIN, gpioModePushPull, 0);
61  for(int i = 0; i < times; i++){
62  GPIO_PinOutSet(LED_PORT, LED_PIN);
63  delay(10);
64  GPIO_PinOutClear(LED_PORT, LED_PIN);
65  delay(100);
66  GPIO_PinOutSet(LED_PORT, LED_PIN);
67  delay(10);
68  GPIO_PinOutClear(LED_PORT, LED_PIN);
69  delay(1000);
70  }
71  GPIO_PinModeSet(LED_PORT, LED_PIN, gpioModeDisabled, 0);
72 #endif
73 }

References delay(), LED_PIN, and LED_PORT.

◆ Check_Equal()

bool Check_Equal ( uint8_t *  arr1,
uint8_t *  arr2,
uint8_t  length 
)

Check if two arrays are equal.

Parameters
[in]arr1first array
[in]arr2second array
[in]lengthlength array

Definition at line 36 of file util.c.

37 {
38  for (uint8_t i = 0; i < length; i++)
39  {
40  if (arr1[i] != arr2[i])
41  {
42  return false;
43  }
44  }
45  return true;
46 }
delay
void delay(uint32_t msDelay)
Wait for a certain amount of milliseconds in EM2/3.
Definition: delay.c:116
LED_PORT
#define LED_PORT
Definition: pinout.h:20
LED_PIN
#define LED_PIN
Definition: pinout.h:21