Takashi Matsuoka / MjSi47xx
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MjSi47xx.h Source File

MjSi47xx.h

00001 #ifndef MJ_SI47XX_H
00002 #define MJ_SI47XX_H
00003 
00004 #include "mbed.h"
00005 
00006 class MjSi47xx
00007 {
00008 public:
00009     enum FunctionType {
00010         FUNCTION_FM,
00011         FUNCTION_AM,
00012     };
00013     
00014     enum PropertyType {
00015         PROPERTY_RX_HARD_MUTE = 0x4001,
00016     };
00017 
00018 public:
00019     MjSi47xx(I2C* i2c, uint8_t address, DigitalOut* rst_n);
00020     void reset();
00021     bool powerUp(FunctionType func);
00022     bool setProperty(PropertyType property, uint16_t value);
00023     bool getIntStatus(bool* stcInt);
00024     bool fmTuneFrequency(float frequency);
00025     bool fmTuneStatus(float* frequency, uint8_t* rssi = NULL, uint8_t* snr = NULL, uint8_t* multipath = NULL);
00026     bool amTuneFrequency(float frequency);
00027     bool amTuneStatus(float* frequency, uint8_t* rssi = NULL, uint8_t* snr = NULL);
00028 
00029 private:
00030     I2C *i2c;
00031     uint8_t address;
00032     DigitalOut* rst_n;
00033 
00034     void writeCmd(uint8_t cmd, const uint8_t* argv = NULL, size_t argc = 0);
00035     void readRes(uint8_t* status, uint8_t *resv = NULL, size_t resc = 0);
00036 
00037 };
00038 
00039 #endif