Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
nola-common.h File Reference

System and user common types and functions. More...

#include <typedef.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>

Classes

struct  GPIOInterruptInfo_t
 GPIO 인터럽트에 관한 상세정보 More...

Macros

#define timerisset(tvp)
#define timerclear(tvp)
#define timercmp(a, b, CMP)
#define timeradd(a, b, result)
#define timersub(a, b, result)
#define htons(a)
 2-byte unsigned 정수 a 를 host byte order에서 network byte order로 변환합니다.
#define htonl(a)
 4-byte unsigned 정수 a 를 host byte order에서 network byte order로 변환합니다.
#define min(x, y)
 두 수 중 최소를 구합니다.
#define max(x, y)
 두 수 중 최대를 구합니다.
#define abs(x)
 수의 절대값을 구합니다.
#define constrain(x, a, b)
 수를 특정 범위로 제한시킵니다.
#define lowByte(w)
 변수의 낮은 (가장 오른쪽) 바이트를 구합니다.
#define highByte(w)
 변수의 높은 (가장 왼쪽) 바이트를 구합니다.
#define bit(n)
 특정 비트를 구합니다.
#define bitRead(v, n)
 수의 한 비트를 읽습니다.
#define bitSet(v, n)
 수의 한 비트를 1로 설정합니다.
#define bitClear(v, n)
 수의 한 비트를 0으로 설정합니다.
#define bitWrite(v, n, b)
 수의 한 비트를 특정 값으로 설정합니다.
#define isAscii(c)

Typedefs

typedef bool boolean
typedef uint8_t byte

Enumerations

enum  {
  SUCCESS_BYPASS = 4 , SUCCESS_OPERATION_RESERVED = 3 , SUCCESS_NOTHING_HAPPENED = 1 , ERROR_SUCCESS = 0 ,
  ERROR_FAIL = -1 , ERROR_NOT_ENOUGH_MEMORY = -2 , ERROR_INVALID_ARGS = -3 , ERROR_MORE_ARGS_REQUIRED = -4 ,
  ERROR_NOT_SUPPORTED = -5 , ERROR_NOT_FOUND = -6 , ERROR_BUSY = -7 , ERROR_TIMEOUT = -8 ,
  ERROR_802154_FRAME_TOO_BIG = -31 , ERROR_802154_SECURING_FAIL = -32 , ERROR_802154_UNSECURING_FAIL = -33 , ERROR_802154_INVALID_SEC_FRAME = -34 ,
  ERROR_6LOWPAN_COMPRESSION_FAIL = -43 , ERROR_6LOWPAN_DECOMPRESSION_FAIL = -44 , ERROR_6LOWPAN_INVALID_CONTEXT = -45 , ERROR_IP6_INVALID_PACKET = -54 ,
  ERROR_IP6_NOT_READY = -57 , ERROR_IP6_LINK_FAIL = -58 , ERROR_ICMP6_INVALID_MESSAGE = -61
}
enum  ioDirection {
  INPUT , OUTPUT , INPUT_PULLUP , INPUT_PULLDOWN ,
  OUTPUT_OPENDRAIN , OUTPUT_OPENDRAIN_PULLUP , OUTPUT_OPENDRAIN_PULLDOWN , UNUSED
}
enum  io_const {
  LOW = 0 , HIGH = 1 , CHANGE = 10 , RISING = 11 ,
  FALLING = 12 , NONE = 255
}

Functions

uint16_t ntohs (uint16_t a)
 2-byte unsigned 정수 a 를 network byte order에서 host byte order로 변환합니다.
uint32_t ntohl (uint32_t a)
 4-byte unsigned 정수 a 를 network byte order에서 host byte order로 변환합니다.
uint32_t seconds ()
 보드 부팅 이후 현재까지의 경과 시간을 초 단위로 구합니다.
uint32_t millis ()
 보드 부팅 이후 현재까지의 경과 시간을 밀리초 단위로 구합니다.
uint32_t micros ()
 보드 부팅 이후부터 현재까지의 경과 시간을 마이크로초 단위로 구합니다.
void delay (uint16_t msec)
 msec 밀리초를 지연시킵니다.
void delayMicroseconds (uint16_t usec)
 usec 마이크로초를 지연시킵니다.
void reboot ()
 소프트웨어 리셋을 통하여 시스템을 재시작합니다.
long map (long x, long in_min, long in_max, long out_min, long out_max)
 수를 어떤 범위에서 다른 범위로 매핑시킵니다.
bool pinMode (int8_t pin, enum ioDirection direction)
 pin 을 direction 방향을 갖는 디지털 핀으로 동작하도록 설정합니다.
bool digitalWrite (int8_t pin, int value)
 pin 를 HIGH 또는 LOW 로 설정합니다.
bool digitalToggle (int8_t pin)
 pin 을 토글합니다.
int digitalRead (int8_t pin)
 pin 의 논리 레벨을 읽습니다.
bool postTask (void(*func)(void *), void *args)
 작업을 나중에 실행되도록 게시합니다.
void interrupts ()
 noInterrupts()로 비활성화된 인터럽트를 다시 활성화합니다.
uint32_t interrupts2 ()
void noInterrupts ()
 interrupts() 가 호출될 때까지 인터럽트를 비활성화합니다. 부득이 원자적(atomic) 실행을 요구하는 곳에서 가능한 짧게 사용합니다.
void noInterrupts2 (uint32_t)

Detailed Description

System and user common types and functions.

Author
Jongsoo Jeong (CoXlab)
Date
2018. 12. 26.

Macro Definition Documentation

◆ timeradd

#define timeradd ( a,
b,
result )
Value:
do { \
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
if ((result)->tv_usec >= 1000000) \
{ \
++(result)->tv_sec; \
(result)->tv_usec -= 1000000; \
} \
} while (0)
86#define timeradd(a, b, result) \
87 do { \
88 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
89 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
90 if ((result)->tv_usec >= 1000000) \
91 { \
92 ++(result)->tv_sec; \
93 (result)->tv_usec -= 1000000; \
94 } \
95 } while (0)

◆ timerclear

#define timerclear ( tvp)
Value:
((tvp)->tv_sec = (tvp)->tv_usec = 0)

◆ timercmp

#define timercmp ( a,
b,
CMP )
Value:
(((a)->tv_sec == (b)->tv_sec) ? \
((a)->tv_usec CMP (b)->tv_usec) : \
((a)->tv_sec CMP (b)->tv_sec))
79#define timercmp(a, b, CMP) \
80 (((a)->tv_sec == (b)->tv_sec) ? \
81 ((a)->tv_usec CMP (b)->tv_usec) : \
82 ((a)->tv_sec CMP (b)->tv_sec))

◆ timerisset

#define timerisset ( tvp)
Value:
((tvp)->tv_sec || (tvp)->tv_usec)

◆ timersub

#define timersub ( a,
b,
result )
Value:
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
99#define timersub(a, b, result) \
100 do { \
101 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
102 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
103 if ((result)->tv_usec < 0) { \
104 --(result)->tv_sec; \
105 (result)->tv_usec += 1000000; \
106 } \
107 } while (0)