[[ANT]]

* Library for LPC1114 [#a440fa7b]

>
This is a sample code of the library for LPC1114, a 32bit microcontroller (IC) produced by NXP Semiconductors. (The product page at NXP Semiconductors is available [[here>http://www.nxp.com/products/microcontrollers/cortex_m0/lpc1100_x_l/#overview]].)~

>
This library is still alpha version, and there is possibly a lot bug in the code. (Please handle it carefully)~

>
ant.c calls functions listed at uart.c. The functions are used for exchnaging commands and results with the ANT chip. In this sample, therefore, uart.c as well as uart.h are required.~

>>
 For uart.c and uart.h, their licenses are checking right now.~

- header file
- C source file

** Example [#n9172ee0]
>
 #include <ant.h>
 #include <uart.h>

 #define   DEVICE_NUMBER   31
 #define   MAX_BUFSIZE     32

 #define   ANT_CH          0

 unsigned  char buffer[MAX_BUFSIZE];

 void OpenANT() {
 //  0ch &#12395;&#36890;&#20449;&#12497;&#12521;&#12513;&#12540;&#12479;&#12434;&#35373;&#23450;&#12375;&#12390;&#12289;&#12481;&#12515;&#12531;&#12493;&#12523;&#12434;&#12458;&#12540;&#12503;&#12531;&#12377;&#12427;&#38306;&#25968; 

	ANT_ResetSystem();                                         // ANT &#12487;&#12496;&#12452;&#12473;&#12434;&#12522;&#12475;&#12483;&#12488;&#12377;&#12427;

	ANT_AssignChannel( ANT_CH, ANT_Bidirectional_Slave, 0) ;   // &#21463;&#20449;&#29992;&#12481;&#12515;&#12531;&#12493;&#12523;&#12392;&#12375;&#12390;&#12450;&#12469;&#12452;&#12531;&#12377;&#12427;
	ANT_SetChannelId( ANT_CH,  DEVICE_NUMBER, 1, 1 );          // &#12487;&#12496;&#12452;&#12473;&#30058;&#21495;&#31561;&#12398;ID&#12434;&#12475;&#12483;&#12488;&#12377;&#12427;

	ANT_SetChannelPeriod_Hz( ANT_CH, 4 );                      // &#12481;&#12515;&#12531;&#12493;&#12523;&#12500;&#12522;&#12458;&#12489; 4Hz&#12395;&#35373;&#23450; (&#12487;&#12501;&#12457;&#12523;&#12488;&#12392;&#21516;&#12376;&#12394;&#12398;&#12391;&#30465;&#30053;&#21487;&#33021;)
	ANT_SetChannelRFFreq( ANT_CH, 4 );                         // &#36865;&#21463;&#20449;&#12377;&#12427;&#21608;&#27874;&#25968;&#12434; 2404MHz &#12395;&#35373;&#23450;&#12377;&#12427;

	ANT_OpenChannel( ANT_CH );                                 // &#12481;&#12515;&#12531;&#12493;&#12523;&#12434;&#38283;&#12356;&#12390;&#36890;&#20449;&#12434;&#38283;&#22987;&#12377;&#12427;

       return;
 }
 
 void main () {

    int s;
    OpenANT();

    while(1) {
        if ( s = BC_ANT_RecvPacket( buffer, MAX_BUFSIZE )) {
            // ANT&#12481;&#12483;&#12503;&#12363;&#12425;&#12398;&#12487;&#12540;&#12479;&#21463;&#20449;&#26178;&#12398;&#20966;&#29702;...
            // &#12497;&#12465;&#12483;&#12488;&#12434;&#21463;&#20449;&#12375;&#12383;&#12392;&#12365;&#12420; ANT&#12481;&#12483;&#12503;&#12363;&#12425;&#12398;&#12452;&#12505;&#12531;&#12488;&#12398;&#20966;&#29702;&#12434;&#35352;&#36848;&#12375;&#12414;&#12377;
        }
    }

 }



Front page   New List of pages Search Recent changes   RSS of recent changes