Clock generator @ 145 MHz and 7 mhz

Dependencies:   Si5351A

Fork of Check_Si5351A_Clock_generator by Kenji Arai

si5351a_check.h

Committer:
kenjiArai
Date:
2017-01-05
Revision:
2:73d79424daa5
Parent:
1:2b29f68043f7
Child:
3:92f31b23fb0b

File content as of revision 2:73d79424daa5:

/*
 * mbed Application program / Si5351A sample program
 *  tested on:
 *      ST Nucleo-F411RE & F401RE
 *      LPC1114FN28
 *
 *  Copyright (c) 2016,'17 Kenji Arai / JH1PJL
 *  http://www.page.sannet.ne.jp/kenjia/index.html
 *  http://mbed.org/users/kenjiArai/
 *      Created:  December 28th, 2016
 *      Revised:  January   5th, 2017
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

//  Definition ------------------------------------------------------------------------------------
#define BAUD(x)                 pc.baud(x)
#define GETC(x)                 pc.getc(x)
#define PUTC(x)                 pc.putc(x)
#define PRINTF(...)             pc.printf(__VA_ARGS__)
#define READABLE(x)             pc.readable(x)

#define BAUD_RATE 9600

#if 0
#define INCREMENT               // command 1,2,3 -> INCREMENT or TABLE_LOOK
#endif
#if !defined(INCREMENT)
#define TABLE_LOOK
#endif

//  Object ---------------------------------------------------------------------

//  RAM ------------------------------------------------------------------------
char linebuf[64];
int buf_size = sizeof(linebuf);

//  ROM / Constant data --------------------------------------------------------
char *const opening_msg =
                "Si5351 test program, created on UTC: "__DATE__"("__TIME__")";
char *const msg0 =  "output: Please enter freq. ex 1230000";

static const uint32_t freq_tbl[] =
{
                 4000,      5000,     8000, // 4KHz-8KHz
     10000,     20000,     50000,    80000, // 10KHz-80KHz
    100000,    200000,    500000,   800000, // 100KHz-800KHz
   1000000,   2000000,   5000000,  8000000, // 1MHz-8MHz
  10000000,  20000000,  50000000, 80000000, // 10MHz-80MHz
 100000000, 150000000, 200000000,           // 100MHz-200MHz
 0  // Terminate data!!
};

//  Function prototypes --------------------------------------------------------
void msg_hlp(void);
void test(uint8_t channel);
void test_si5351(void);
void special_command(void);
void put_rn( void );
void put_r( void );
void put_lin( void );
void put_spc( uint8_t n);
int  xatoi(char **str, int32_t *res);
void get_line(char *buff, int len);
void get_line_no_param(char *buff);