Hover! test program.

Dependencies:   MjHover mbed

main.cpp

Committer:
matsujirushi
Date:
2015-04-02
Revision:
0:6f474427ba37
Child:
1:514827ffb84a

File content as of revision 0:6f474427ba37:

#include "mbed.h"
#include "MjHover.h"

using namespace matsujirushi;

Serial pc(USBTX, USBRX);

I2C i2c(p28, p27);
DigitalInOut hover_ts(p21);
DigitalInOut hover_reset_n(p22);

MjHover hover(&i2c, 0x84, &hover_ts, &hover_reset_n);

int main()
{
    pc.baud(115200);
    i2c.frequency(100000);
    
    pc.printf("Start\r\n");
    
    hover.begin();
    
    for(;;)
    {
        if (hover.getStatus() == false)
        {
            uint8_t event = hover.getEvent();
            hover.setRelease();
            
            const char* output_string = hover.getEventString(event);
            if (event != 0)
            {
                pc.printf("%02x:[%s]\r\n", event, hover.getEventString(event));
            }
        }
    }
}