모바일 오유 바로가기
http://m.todayhumor.co.kr
분류 게시판
베스트
  • 베스트오브베스트
  • 베스트
  • 오늘의베스트
  • 유머
  • 유머자료
  • 유머글
  • 이야기
  • 자유
  • 고민
  • 연애
  • 결혼생활
  • 좋은글
  • 자랑
  • 공포
  • 멘붕
  • 사이다
  • 군대
  • 밀리터리
  • 미스터리
  • 술한잔
  • 오늘있잖아요
  • 투표인증
  • 새해
  • 이슈
  • 시사
  • 시사아카이브
  • 사회면
  • 사건사고
  • 생활
  • 패션
  • 패션착샷
  • 아동패션착샷
  • 뷰티
  • 인테리어
  • DIY
  • 요리
  • 커피&차
  • 육아
  • 법률
  • 동물
  • 지식
  • 취업정보
  • 식물
  • 다이어트
  • 의료
  • 영어
  • 맛집
  • 추천사이트
  • 해외직구
  • 취미
  • 사진
  • 사진강좌
  • 카메라
  • 만화
  • 애니메이션
  • 포니
  • 자전거
  • 자동차
  • 여행
  • 바이크
  • 민물낚시
  • 바다낚시
  • 장난감
  • 그림판
  • 학술
  • 경제
  • 역사
  • 예술
  • 과학
  • 철학
  • 심리학
  • 방송연예
  • 연예
  • 음악
  • 음악찾기
  • 악기
  • 음향기기
  • 영화
  • 다큐멘터리
  • 국내드라마
  • 해외드라마
  • 예능
  • 팟케스트
  • 방송프로그램
  • 무한도전
  • 더지니어스
  • 개그콘서트
  • 런닝맨
  • 나가수
  • 디지털
  • 컴퓨터
  • 프로그래머
  • IT
  • 안티바이러스
  • 애플
  • 안드로이드
  • 스마트폰
  • 윈도우폰
  • 심비안
  • 스포츠
  • 스포츠
  • 축구
  • 야구
  • 농구
  • 바둑
  • 야구팀
  • 삼성
  • 두산
  • NC
  • 넥센
  • 한화
  • SK
  • 기아
  • 롯데
  • LG
  • KT
  • 메이저리그
  • 일본프로야구리그
  • 게임1
  • 플래시게임
  • 게임토론방
  • 엑스박스
  • 플레이스테이션
  • 닌텐도
  • 모바일게임
  • 게임2
  • 던전앤파이터
  • 마비노기
  • 마비노기영웅전
  • 하스스톤
  • 히어로즈오브더스톰
  • gta5
  • 디아블로
  • 디아블로2
  • 피파온라인2
  • 피파온라인3
  • 워크래프트
  • 월드오브워크래프트
  • 밀리언아서
  • 월드오브탱크
  • 블레이드앤소울
  • 검은사막
  • 스타크래프트
  • 스타크래프트2
  • 베틀필드3
  • 마인크래프트
  • 데이즈
  • 문명
  • 서든어택
  • 테라
  • 아이온
  • 심시티5
  • 프리스타일풋볼
  • 스페셜포스
  • 사이퍼즈
  • 도타2
  • 메이플스토리1
  • 메이플스토리2
  • 오버워치
  • 오버워치그룹모집
  • 포켓몬고
  • 파이널판타지14
  • 배틀그라운드
  • 기타
  • 종교
  • 단어장
  • 자료창고
  • 운영
  • 공지사항
  • 오유운영
  • 게시판신청
  • 보류
  • 임시게시판
  • 메르스
  • 세월호
  • 원전사고
  • 2016리오올림픽
  • 2018평창올림픽
  • 코로나19
  • 2020도쿄올림픽
  • 게시판찾기
  • 오유인페이지
    개인차단 상태
    간지늅늅이님의
    개인페이지입니다
    가입 : 11-10-07
    방문 : 3565회
    닉네임변경 이력
    회원차단
    회원차단해제
    게시물ID : computer_49099
    작성자 : 간지늅늅이
    추천 : 0
    조회수 : 226
    IP : 210.119.***.181
    댓글 : 0개
    등록시간 : 2012/06/05 15:36:54
    http://todayhumor.com/?computer_49099 모바일
    temp doc
    oscilloscopeC.nc

    /*
     * Copyright (c) 2006 Intel Corporation
     * All rights reserved.
     *
     * This file is distributed under the terms in the attached INTEL-LICENSE     
     * file. If you do not find these files, copies can be found by writing to
     * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
     * 94704.  Attention:  Intel License Inquiry.
     */

    /**
     * Oscilloscope demo application. See README.txt file in this directory.
     *
     * @author David Gay
     */
    #include "Timer.h"
    #include "Oscilloscope.h"

    module OscilloscopeC
    {
      uses {
        interface Boot;
        interface SplitControl as RadioControl;
        interface AMSend;
        interface Receive;
        interface Timer<TMilli>;
        interface Read<uint16_t>;
        interface Leds;
      }
    }
    implementation
    {
      message_t sendbuf;
      bool sendbusy;

      /* Current local state - interval, version and accumulated readings */
      oscilloscope_t local;

      uint8_t reading; /* 0 to NREADINGS */

      /* When we head an Oscilloscope message, we check it's sample count. If
         it's ahead of ours, we "jump" forwards (set our count to the received
         count). However, we must then suppress our next count increment. This
         is a very simple form of "time" synchronization (for an abstract
         notion of time). */
      bool suppress_count_change;

      // Use LEDs to report various status issues.
      void report_problem() { call Leds.led0Toggle(); }
      void report_sent() { call Leds.led1Toggle(); }
      void report_received() { call Leds.led2Toggle(); }

      event void Boot.booted() {
        local.interval = DEFAULT_INTERVAL;
        local.id = TOS_NODE_ID;
        if (call RadioControl.start() != SUCCESS)
          report_problem();
      }

      void startTimer() {
        call Timer.startPeriodic(local.interval);
        reading = 0;
      }

      event void RadioControl.startDone(error_t error) {
        startTimer();
      }

      event void RadioControl.stopDone(error_t error) {
      }

      event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) {
        oscilloscope_t *omsg = payload;

        report_received();

        /* If we receive a newer version, update our interval. 
           If we hear from a future count, jump ahead but suppress our own change
        */
        if (omsg->version > local.version)
          {
    local.version = omsg->version;
    local.interval = omsg->interval;
    startTimer();
          }
        if (omsg->count > local.count)
          {
    local.count = omsg->count;
    suppress_count_change = TRUE;
          }

        return msg;
      }

      /* At each sample period:
         - if local sample buffer is full, send accumulated samples
         - read next sample
      */
      event void Timer.fired() {
        if (reading == NREADINGS)
          {
    if (!sendbusy && sizeof local <= call AMSend.maxPayloadLength())
      {
        memcpy(call AMSend.getPayload(&sendbuf), &local, sizeof local);
        if (call AMSend.send(AM_BROADCAST_ADDR, &sendbuf, sizeof local) == SUCCESS)
          sendbusy = TRUE;
      }
    if (!sendbusy)
      report_problem();

    reading = 0;
    /* Part 2 of cheap "time sync": increment our count if we didn't
       jump ahead. */
    if (!suppress_count_change)
      local.count++;
    suppress_count_change = FALSE;
          }
        if (call Read.read() != SUCCESS)
          report_problem();
      }

      event void AMSend.sendDone(message_t* msg, error_t error) {
        if (error == SUCCESS)
          report_sent();
        else
          report_problem();

        sendbusy = FALSE;
      }

      event void Read.readDone(error_t result, uint16_t data) {
        if (result != SUCCESS)
          {
    data = 0xffff;
    report_problem();
          }
        local.readings[reading++] = data;
      }
    }
    ----------------------------------------
    LightToRadio_osc.nc

    module LightToRadioC{
    uses interface Boot;
    uses interface Leds;
    uses interface Timer<TMilli> as Timer0;
    uses interface SplitControl;
    uses interface Packet;
    uses interface AMSend;
            uses interface Read<uint16_t>;
    uses interface AMReceive;
    }

    implementation{
    uint16_t counter=0;
    message_t pkt;
    bool busy = FALSE;

    event void Boot.booted(){
    call SplitControl.start();
    }
    event void SplitControl.startDone(error_t err){
      if(err == SUCCESS)
     call Timer0.startPeriodic(TIMER_PERIOD);
      else 
     call SplitControl.start();
    }

    event void SplitControl.stopDone(error_t err){}
      event void Timer0.fired(){
      call Read.read();
    }

    event void Read.readDone(error_t result, uint16_t data){
    counter++;
    if(!busy){
    RadioMsg* rdata = call Packet.getPayload(&pkt, NULL);
    rdata->nodeid = TOS_NODE_ID;
    rdata->count = counter;
    rdata->light = data;
    rdata->readings[NREADINGS-1]=data;

    if(call AMSend.send(AM_BROADCAST_ADDR,&pkt, 
    sizeof(RadioMsg)) ==SUCCESS)
    busy = TRUE;

    }
    }
    event void AMSend.sendDone(message_t* msg, error_t err)
    {
    if(&pkt == msg){
    busy = FALSE;
    call Leds.led0Toggle();
    }
    }
    }

    이 게시물을 추천한 분들의 목록입니다.
    푸르딩딩:추천수 3이상 댓글은 배경색이 바뀝니다.
    (단,비공감수가 추천수의 1/3 초과시 해당없음)

    죄송합니다. 댓글 작성은 회원만 가능합니다.

    번호 제 목 이름 날짜 조회 추천
    141
    여러분 지금 렉 없으세요? [3] 간지늅늅이 12/06/15 23:34 152 0
    140
    법사 겁나재밌네!!! [1] 간지늅늅이 12/06/15 07:15 325 0
    139
    21법사와 같이하실분 간지늅늅이 12/06/15 06:40 57 0
    138
    저는 디아가 왜케 재밌져 ㅠㅠ [3] 간지늅늅이 12/06/13 23:49 244 1
    137
    오늘도 오유는 평화롭네요. [3] 간지늅늅이 12/06/13 11:03 102 1
    136
    가는말이 고와야 오는말이 곱다. 간지늅늅이 12/06/13 10:44 64 0
    135
    논산 조교출신의 군대입소 조언 몇가지들. [19] 간지늅늅이 12/06/11 03:53 492 10
    134
    저는 나눔은 좋게생각하고 하는것도 재밌던데.. [7] 간지늅늅이 12/06/11 01:19 300 0
    133
    필로리의 디아소 천원샵 남은 매물들입니다!!! [2] 간지늅늅이 12/06/10 00:59 239 0
    132
    필로리의 디아소 천원샵 오픈합니다!!!!! [3] 간지늅늅이 12/06/10 00:28 325 0
    131
    35분뒤 생일인데, 서버다운이네 아 젠장 [6] 간지늅늅이 12/06/09 23:26 229 5
    130
    필로리의 천원샵을 열 예정이였는데, 서버가 내렸네 [6] 간지늅늅이 12/06/09 23:20 345 1
    129
    빨리 출시되기를 바라고 사고싶은 게임들 ㅠ_ㅠ [2] 간지늅늅이 12/06/08 11:34 60 0
    128
    temp doc(1) 간지늅늅이 12/06/05 15:38 8 0
    temp doc 간지늅늅이 12/06/05 15:36 12 0
    126
    계속 안생긴다는분들은 어느정도까지 노력해보셨나요 ''?? [3] 간지늅늅이 12/06/01 14:01 88 0
    125
    진짜 극심한 도움!!!!!!!!!!!!!ㅠㅠㅠㅠㅠ그래픽카드관련. [2] 간지늅늅이 12/05/21 20:33 53 1
    124
    25살.....차량추천 괜찮을까요 ;;;;^^:; [3] 간지늅늅이 12/05/20 23:25 175 0
    123
    스토리덕후는 디아엔딩을보며 눈물을 흘립미다 흑흑 [1] 간지늅늅이 12/05/19 19:41 60 0
    122
    화살통 하나 먹었는데 괜찮나요? [1] 간지늅늅이 12/05/19 04:06 676 0
    121
    블빠지만 환불운동하는분들 응원하는중.. 간지늅늅이 12/05/18 12:03 235 1
    120
    사람들이 스토리깨고 재미없어진다하지만 전 그래서 더 만족 간지늅늅이 12/05/17 02:24 366 0
    119
    한정판 도착 !!!!!끼약!! [8] 간지늅늅이 12/05/16 13:05 1029 3
    118
    소장판 너무 실망하지마세요. [1] 간지늅늅이 12/05/15 12:17 508 1
    117
    감사합니다. 하느님 간지늅늅이 12/05/15 09:57 691 0
    116
    되팔이들&기존보유자들은 11번가 안오면 좋겠다 진짜 ㅠㅠ 간지늅늅이 12/05/15 08:41 220 0
    115
    디아3 한정판 구매를 위한 나의 노력 간지늅늅이 12/05/15 08:12 896 2
    114
    여러분은 11번가를 위해 무엇을 준비중인가요 +_+ [4] 간지늅늅이 12/05/14 19:06 323 0
    113
    부모님께 드릴 선물을 드디어 샀네요.... [2] 간지늅늅이 12/05/13 02:09 81 2
    112
    25살 남자 시계 뭐가 좋을까요? [6] 간지늅늅이 12/05/10 01:42 114 0
    [◀이전10개] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [다음10개▶]
    단축키 운영진에게 바란다(삭제요청/제안) 운영게 게시판신청 자료창고 보류 개인정보취급방침 청소년보호정책 모바일홈