Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HEPTA_assembly template HEPTA_GS
Diff: HeptaSerial.h
- Revision:
- 8:6d9c33df4c09
- Parent:
- 7:a41100627f55
--- a/HeptaSerial.h Sat Aug 05 14:20:51 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-#include "mbed.h"
-#include "SerialBuffered.h"
-
-#ifndef HEPTA_SERIAL_H
-#define HEPTA_SERIAL_H
-
-class HeptaSerial
-{
-public:
-
- enum JpegResolution {
- JpegResolution80x64 = 0x01, // unofficial
- JpegResolution160x128 = 0x03, // unofficial
- JpegResolution320x240 = 0x05, // QVGA
- JpegResolution640x480 = 0x07 // VGA
- };
-
- enum ErrorNumber {
- NoError = 0x00,
- UnexpectedReply = 0x04,
- ParameterError = 0x0b,
- SendRegisterTimeout = 0x0c,
- CommandIdError = 0x0d,
- CommandHeaderError = 0xf0,
- SetTransferPackageSizeWrong = 0x11
- };
-
- enum Baud {
- Baud460800 = 0x02,
- Baud230400 = 0x03,
- Baud115200 = 0x04,
- Baud57600 = 0x05,
- Baud28800 = 0x06,
- Baud14400 = 0x07 // Default.
- };
-
- enum ResetType {
- Nomal = 0x00,
- High = 0xff
- };
-
- HeptaSerial(PinName tx, PinName rx, PinName CAM, PinName GPS);
-
- ~HeptaSerial();
-
- ErrorNumber sync();
- ErrorNumber init(Baud baud, JpegResolution jr);
- ErrorNumber getJpegSnapshotPicture();
- ErrorNumber getJpegSnapshotPicture_data();
- void setmbedBaud(Baud baud);
- void camera_setting(void);
- void Sync(void);
- void initialize(Baud baud,JpegResolution jr);
- void test_jpeg_snapshot_picture(int CAPTURE_FRAMES);
- void test_jpeg_snapshot_data(int CAPTURE_FRAMES);
- void jpeg_callback(char *buf, size_t siz);
- void gps_setting(void);
- char getc();
- int readable();
- void flushSerialBuffer(void);
- void gga_sensing(float *time, float *latitude, char *ns, float *longitude, char *ew, int *quality, int *stnum, float *hacu, float *altitude, char *aunit, int *gps_check);
- void lat_log_sensing_u16(char *lat, char *log, char * height, int *dsize1, int *dsize2);
-
-private:
- SerialBuffered serial;
- DigitalOut CAM_SW;
- DigitalOut GPS_SW;
- static const int COMMAND_LENGTH = 6;
- static const int SYNCMAX = 60;
- static const int packageSize = 256;
- //static const int CAPTURE_FRAMES = 3;
-
- char msg[256],msgd[256];
- int i,ite,rlock,stn;
- char c;
- char gps_data[7][1000];
- char ns,ew,statas;
- float time,hokui,tokei,vel;
- float g_hokui,g_tokei;
- float d_hokui,m_hokui,d_tokei,m_tokei;
- int h_time,m_time,s_time;
- float height_1;
- int m_height,cm_height;
-
- ErrorNumber sendInitial(Baud band, JpegResolution jr);
- ErrorNumber sendGetPicture(void);
- ErrorNumber sendSnapshot(void);
- ErrorNumber sendSetPackageSize(uint16_t packageSize);
- ErrorNumber sendReset(ResetType specialReset);
- ErrorNumber recvData(uint32_t *length);
- ErrorNumber sendSync();
- ErrorNumber recvSync();
- ErrorNumber sendAck(uint8_t commandId, uint16_t packageId);
- ErrorNumber recvAckOrNck();
-
- bool sendBytes(char *buf, size_t len, int timeout_us = 20000);
- bool recvBytes(char *buf, size_t len, int timeout_us = 20000);
- bool waitRecv();
- bool waitIdle();
-};
-#endif