Subversion Repositories NaviCtrl

Rev

Rev 242 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef __MK3MAG_H
#define __MK3MAG_H

typedef struct
{
  u8 Major;
  u8 Minor;
  u8 Patch;
  u8 Compatible;
} __attribute__((packed)) MK3MAG_Version_t;

typedef struct
{
  s16 X;
  s16 Y;
  s16 Z;
} __attribute__((packed)) MK3MAG_MagVector_t;

typedef struct
{
  s16 Nick;
  s16 Roll;
} __attribute__((packed)) MK3MAG_WriteAttitude_t;

typedef struct
{
  u8 CalByte;
  u8 Dummy1;
  u8 Dummy2;
} __attribute__((packed)) MK3MAG_Cal_t;

typedef struct
{
  s16 Heading;
} __attribute__((packed)) MK3MAG_Heading_t;


#define MK3MAG_CMD_VERSION              0x01
#define MK3MAG_CMD_READ_MAGVECT         0x02
#define MK3MAG_CMD_READ_HEADING         0x03
#define MK3MAG_CMD_WRITE_CAL            0x04

extern volatile MK3MAG_Heading_t                MK3MAG_Heading;
extern volatile MK3MAG_MagVector_t              MK3MAG_MagVector;
extern volatile MK3MAG_Version_t                MK3MAG_Version;

void MK3MAG_Init(void);
void MK3MAG_SendCommand(u8 command);
void MK3MAG_GetVersion(void);
void MK3MAG_UpdateCompass(void);

#endif // MK3MAG_H