Master Thesis
V1.0
Research and Design of Sensor Node for NMSD Treatment
util.c
Go to the documentation of this file.
1
/***************************************************************************/
9
/*
10
* util.c
11
*
12
* Created on: Mar 11, 2020
13
* Author: jonac
14
*/
15
16
#include <
util.h
>
17
#include "stdbool.h"
18
#include "stdint.h"
19
#include "em_gpio.h"
20
#include "
pinout.h
"
21
22
23
/**************************************************************************/
36
bool
Check_Equal
(uint8_t *arr1, uint8_t *arr2, uint8_t length)
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
}
47
48
/**************************************************************************/
57
void
blink
(uint8_t times)
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
}
delay
void delay(uint32_t msDelay)
Wait for a certain amount of milliseconds in EM2/3.
Definition:
delay.c:116
blink
void blink(uint8_t times)
Function to blink LED on sensor node.
Definition:
util.c:57
LED_PORT
#define LED_PORT
Definition:
pinout.h:20
Check_Equal
bool Check_Equal(uint8_t *arr1, uint8_t *arr2, uint8_t length)
Check if two arrays are equal.
Definition:
util.c:36
LED_PIN
#define LED_PIN
Definition:
pinout.h:21
pinout.h
File to keep track of most the pins used, pins for BLE are in own file BLE.h.
util.h
Handy functions.
inc
util.c
Generated by
1.8.16