[[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 に通信パラメータを設定して、チャンネルをオープンする関数 ANT_ResetSystem(); // ANT デバイスをリセットする ANT_AssignChannel( ANT_CH, ANT_Bidirectional_Slave, 0) ; // 受信用チャンネルとしてアサインする ANT_SetChannelId( ANT_CH, DEVICE_NUMBER, 1, 1 ); // デバイス番号等のIDをセットする ANT_SetChannelPeriod_Hz( ANT_CH, 4 ); // チャンネルピリオド 4Hzに設定 (デフォルトと同じなので省略可能) ANT_SetChannelRFFreq( ANT_CH, 4 ); // 送受信する周波数を 2404MHz に設定する ANT_OpenChannel( ANT_CH ); // チャンネルを開いて通信を開始する return; } void main () { int s; OpenANT(); while(1) { if ( s = BC_ANT_RecvPacket( buffer, MAX_BUFSIZE )) { // ANTチップからのデータ受信時の処理... // パケットを受信したときや ANTチップからのイベントの処理を記述します } } }