Skip to content

Commit

Permalink
add sleep functions. add types smx_i32, smx_ui32
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkcass committed Oct 17, 2018
1 parent dcf0bc9 commit d36b08d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions libhardware/src/somax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>

#include "somax.h"

Expand Down Expand Up @@ -154,4 +155,9 @@ void *somax_malloc(int size_bytes)
void somax_free(void *malloced)
{
free(malloced);
}

void somax_sleep(smx_ui32 micro_secs)
{
usleep(micro_secs);
}
16 changes: 11 additions & 5 deletions libhardware/src/somax.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
// #define SOMAX_RESOURCES "NONE"
// #endif

//microseconds per millisecond
#define U_MILLISECOND 1000

//----------
//standard types
typedef unsigned char smx_byte;
typedef unsigned int smx_i32;
typedef unsigned int smx_ui32;

#define SOMAX_PRINTOPTION_CONFIG 0x01

#define MAX_STR_DEVICEID_LEN 32

typedef unsigned char smx_byte;

void somax_data_init(const char name[], const char sclass[], const char version[], const char resources[]);

void somax_print_config(int print_options);
Expand Down Expand Up @@ -69,4 +70,9 @@ float somax_convert_farenheit_to_celsius(float temp_farenheit);
void* somax_malloc(int size_bytes);
void somax_free(void * malloced);

//microseconds per millisecond
#define U_MILLISECOND 1000
#define U_SECOND 1000000
void somax_sleep(smx_ui32 micro_secs);

#endif

0 comments on commit d36b08d

Please sign in to comment.