2012-01-01から1年間の記事一覧

jpeg2bmp.py

# coding:utf-8 # jpeg2bmp.py 2012.10.28 import logging import math import BaseJpegDecode import bmp24 zigzag = [ 0, 1, 8, 16, 9, 2, 3,10,17,24, 32,25,18,11, 4, 5,12,19,26,33,40, 48,41,34,27,20,13,6, 7,14,21,28,35,42,49,56, 57,50,43,36,29,2…

BaseJpegDecode.py

#!/usr/bin/env python # coding:utf-8 # BaseJpegDecode.py 2012.10.23 import abc import logging from collections import Counter class BitPattern: def __init__(self, data=0, size=0): self.data = data self.size = size def clear(self): self.dat…

bmp24.py

# coding:utf-8 # bmp24.py 2012.10.26 import logging def LE32write(buf, i, value): buf[i] = value & 0xff buf[i+1] = (value>>8) & 0xff buf[i+2] = (value>>16) & 0xff buf[i+3] = (value>>24) & 0xff class bmp24(): def __init__(self, width = 160,…

BaseJpegDecode.py

DQTの処理の追加をする。 #!/usr/bin/env python # coding:utf-8 # BaseJpegDecode.py 2012.10.23 import abc import logging from collections import Counter class BitPattern: def __init__(self, data=0, size=0): self.data = data self.size = size d…

BaseJpegDecode.py

MCUの垂直サンプリングファクタを修正する。 #!/usr/bin/env python # coding:utf-8 # BaseJpegDecode.py 2012.10.3 import abc import logging from collections import Counter class BitPattern: def __init__(self, data=0, size=0): self.data = data s…

kisyo.py

気象情報システムからデータを取得してcosmにPUTする。 #!/usr/bin/env python # coding:utf-8 # kisyo.py 2012.9.30 import logging import webapp2 from google.appengine.api import urlfetch from xml.dom import minidom from collections import Order…

BaseJpegDecode.py

JPEGのHuffman decodeのテスト。 #!/usr/bin/env python # coding:utf-8 # BaseJpegDecode.py 2012.9.27 import abc import logging from collections import Counter class BitPattern: def __init__(self, data=0, size=0): self.data = data self.size = …

jpeg_DHTstrip.py

GAE

JPEGからDHTを削除するプログラム。 #!/usr/bin/env python import webapp2 import logging def DHTstrip(data): s = "" pos = 0 while pos < len(data): c = data[pos] pos += 1 if c != '\xff': # mark s += c continue c = data[pos] pos += 1 if c in '\…

rtos-stack.cpp

#if 1 #include "mbed.h" #include "rtos.h" DigitalOut led1(LED1),led2(LED2); const uint32_t MAGIC_WORD = 0xE25A2EA5; uint8_t stack_area[2048] __attribute((section("AHBSRAM0"),aligned)); //uint8_t stack_area[2048]; int count = 0; void led2_t…

spp_rpc.cpp

#if 1 // spp_rpc.cpp // RPC over Bluetooth #include "mbed.h" #include <btstack/hci_cmds.h> #include <btstack/run_loop.h> #include <btstack/sdp_util.h> #include "hci.h" #include "l2cap.h" #include "btstack_memory.h" #include "remote_device_db.h" #include "rfcomm.h" #include "sdp.h" #include "config.</btstack/sdp_util.h></btstack/run_loop.h></btstack/hci_cmds.h>…

camviewer

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; using System.Diagnostics; using …

spp_camera.cpp

#if 1 // spp_camera.cpp #include "mbed.h" #include <btstack/hci_cmds.h> #include <btstack/run_loop.h> #include <btstack/sdp_util.h> #include "hci.h" #include "l2cap.h" #include "btstack_memory.h" #include "remote_device_db.h" #include "rfcomm.h" #include "sdp.h" #include "config.h" #include "debug.</btstack/sdp_util.h></btstack/run_loop.h></btstack/hci_cmds.h>…

spp_camera.cpp

#if 1 // spp_camera.cpp #include "mbed.h" #include <btstack/hci_cmds.h> #include <btstack/run_loop.h> #include <btstack/sdp_util.h> #include "hci.h" #include "l2cap.h" #include "btstack_memory.h" #include "remote_device_db.h" #include "rfcomm.h" #include "sdp.h" #include "config.h" #include "debug.</btstack/sdp_util.h></btstack/run_loop.h></btstack/hci_cmds.h>…

spp.py

# -*- coding: utf-8 -*- # spp.py 2012.6.28 import serial from optparse import OptionParser class spp: def __init__(self, port = "COM10"): self.ser = serial.Serial(port) def getImage(self): self.image_data = "" while True: line = self.ser.r…

MyQueue.cpp

// main.cpp #include "mbed.h" #include "MyQueue.h" int main() { MyQueue<int> queue1; MyQueue<char> queue2; return -1; } // MyQueue.h template<class T> class MyQueue { public: MyQueue(T x = 0); void push(T x); T pop(); }; // MyQueue.cpp #include "MyQueue.h" te</class></char></int>…

intervalcamera.cpp

#include "mbed.h" #include "uvc.h" #include "msc.h" Serial pc(USBTX, USBRX); #define INTERVAL 15 Timer t; int main() { pc.baud(921600); msc* usb = new msc("usb"); if (usb->setup() < 0) exit(1); uvc* lifecam = new uvc; lifecam->SetImageSize…

UsbDevice2.cpp

UsbErr UsbDevice::hub_init() { UsbErr rc; uint8_t buf[9]; rc = controlReceive( USB_DEVICE_TO_HOST | USB_REQUEST_TYPE_CLASS | USB_RECIPIENT_DEVICE, // 0xa0 GET_DESCRIPTOR, (USB_DESCRIPTOR_TYPE_HUB << 8), 0, buf, sizeof(buf)); DBG_ASSERT(rc …

intervalcamera.cpp

#include "mbed.h" #include "uvc.h" Serial pc(USBTX, USBRX); LocalFileSystem local("local"); #define INTERVAL 15 Timer t; int main() { pc.baud(921600); uvc* lifecam = new uvc; lifecam->SetImageSize(160, 120); lifecam->SetFrameInterval(20000…

main.cpp

#include "mbed.h" #include "uvc.h" Serial pc(USBTX, USBRX); LocalFileSystem local("local"); int main() { pc.baud(921600); uvc* lifecam = new uvc; lifecam->SetImageSize(160, 120); lifecam->SetFrameInterval(1000000); if (lifecam->setup() < 0…

main.cpp

#include "mbed.h" #include "BlueD.h" Serial pc(USBTX, USBRX); BlueD bd; int main() { pc.baud(460800); printf("Bluetooth device discover\n"); while(1) { set<string> addr = bd.discover_devices(); for (set<string>::iterator it = addr.begin() ; it != addr.end</string></string>…

main.cpp

#include "mbed.h" #include "BlueD.h" Serial pc(USBTX, USBRX); BlueD bd; int main() { pc.baud(460800); printf("Bluetooth device discover\n"); while(1) { set<string> addr = bd.discover_devices(); for (set<string>::iterator it = addr.begin() ; it != addr.end</string></string>…

gpsusb.cpp

#include "mbed.h" #include "usbgps.h" #define PL2303_SET_LINE_CODING 0x20 usbgps::usbgps() { m_init = false; m_connect = false; } int usbgps::readable() { if (!m_init) { _init(); } for(int i = 0; i < 2; i++) { if (!_receive.empty()) { retu…

evt_err_str.h

#ifndef EVT_ERR_STR_H #define EVT_ERR_STR_H #include "HTTPClient.h" #define CR(A) case A: return #A const char* HTTP_Str(HTTPResult r) { switch(r) { CR(HTTP_OK); ///

main.cpp

#include "mbed.h" #include "EthernetNetIf.h" #include "WIZ820ioNetIf.h" #include "HTTPClient.h" #include "HTTPServer.h" #include <assert.h> Serial pc(USBTX, USBRX); //#define MBED_ETH #ifdef MBED_ETH EthernetNetIf eth; #else WIZ820ioNetIf eth; #endi</assert.h>…

gae_PachubeClient_debug.py

GAE

#!/usr/bin/env python # -*- coding: utf-8 -*- # gae_PachubeClient_debug.py 2012.4.21 import logging import os import re import time import datetime import StringIO from google.appengine.ext import db from google.appengine.ext import webapp…

w5200NetIf/main.cpp

#include "WIZ820ioNetIf.h" #include "HTTPClient.h" #include "HTTPServer.h" WIZ820ioNetIf eth; HTTPServer svr; HTTPClient http; HTTPStream stream; void callback(HTTPResult r){printf("callback(%d)\n",r);} int main() { eth.setup(); svr.addHan…

W5200_ethernet.cpp

// W5200_ethernet.cpp 2012/4/7 #include "mbed.h" #include "w5100.h" #include "Utils.h" extern W5100Class W5100; // w5100.cpp class MyEthernet { int _socket; public: MyEthernet() { _socket = 0; W5100.writeSnMR( _socket, 0x40|SnMR::MACRAW); …

main.cpp

#include "mbed.h" Serial pc(USBTX, USBRX); Ethernet eth; extern "C" void mbed_mac_address(char * mac); int main() { pc.baud(460800); char buf[0x600]; mbed_mac_address(buf); printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", buf[0], buf[1], buf…

uroadhome.py

# uroadhome.py 2012.3.17 # -*- coding: utf-8 -*- import re import base64 import urllib2 import urlparse import time import datetime from optparse import OptionParser def get_status(url): o = urlparse.urlparse(url) if o.username and o.passw…

usbrh.cpp

// usbrh.cpp 2012/2/6 #include "mbed.h" #include "USBHost.h" #include "Utils.h" void usbrh_request(int device) { USBControlTransfer(device, HOST_TO_DEVICE|REQUEST_TYPE_CLASS|RECIPIENT_INTERFACE, 0x09, 0x0200, 0, 0, 7); } void usbrh_Callbac…