aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/delay.c
blob: ef095fe5b30d116bf429f53eb58e1a3b991d5d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * delay.c - Delay in millisecond and microsecond functions
 *
 * Convert from SysCtlDelay in TivaWare library to milliseconds and microseconds delay.
 *
 *  Created on: Dec 13, 2018
 *      Author: avi
 */

#include <stdint.h>
#include <stdbool.h>
#include "driverlib/sysctl.h"
#include "Include.h"



void delayms(uint32_t ui32ms)
{
    //SysCtlClockGet();
    // 1 clock cycle = 1 / SysCtlClockGet() second
    // 1 SysCtlDelay = 3 clock cycle = 3 / SysCtlClockGet() second
    // 1 second = SysCtlClockGet() / 3
    // 0.001 second = 1 ms = SysCtlClockGet() / 3 / 1000
    //int i;

    //for(i=0;i<(ui32ms);i++)

    //if(ui32ms == 10)
   //     ui32ms = 20;

    SysCtlDelay( ui32ms * (SYS_CLK_FREQ / 3 / 1000));
}

void delayUs(uint32_t ui32Us)
{
    SysCtlDelay(ui32Us * (SYS_CLK_FREQ / 3 / 1000000));
}
an class="w"> _KeepAliveRequest { ProtobufCMessage base; }; #define KEEP_ALIVE_REQUEST__INIT \ { PROTOBUF_C_MESSAGE_INIT (&keep_alive_request__descriptor) \ } /* KeepAliveRequest methods */ void keep_alive_request__init (KeepAliveRequest *message); size_t keep_alive_request__get_packed_size (const KeepAliveRequest *message); size_t keep_alive_request__pack (const KeepAliveRequest *message, uint8_t *out); size_t keep_alive_request__pack_to_buffer (const KeepAliveRequest *message, ProtobufCBuffer *buffer); KeepAliveRequest * keep_alive_request__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void keep_alive_request__free_unpacked (KeepAliveRequest *message, ProtobufCAllocator *allocator); /* --- per-message closures --- */ typedef void (*KeepAliveRequest_Closure) (const KeepAliveRequest *message, void *closure_data); /* --- services --- */ /* --- descriptors --- */ extern const ProtobufCMessageDescriptor keep_alive_request__descriptor; PROTOBUF_C__END_DECLS #endif /* PROTOBUF_C_KeepAliveRequest_2eproto__INCLUDED */