Tedd OKANO / Mbed 2 deprecated MARY_CAMERA_Hello

Dependencies:   MARY_CAMERA NokiaLCD mbed

bmp_handler.cpp

Committer:
okano
Date:
2014-02-18
Revision:
10:3c8fc9569377
Child:
11:149993faf2be

File content as of revision 10:3c8fc9569377:

#include "mbed.h"                   //  for mbed
LocalFileSystem     local("local"); //  for mbed to access local file system

char bmp_header[]   = {
    0x42, 0x4d, 0x8a, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x7c, 0x00,
    0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00,
    0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x1f, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

FILE    *fp;

int open_BMP( char *file_name )
{
    char    s[ 80 ];

    sprintf( s, "/local/%s", file_name );

    if ( NULL == (fp    = fopen( s, "wb" )) )
        return 1;

    fwrite( bmp_header, sizeof( bmp_header ), 1, fp );

    return 0;
}

void write_BMP( short *p, int length )
{
    fwrite( p, sizeof( short ), length, fp );
}

void close_BMP( void )
{
    fclose( fp );
}