max2837: extern additional functions, put test code in ifdef

This commit is contained in:
Will Code
2012-05-29 21:24:01 -04:00
parent ee26a4d4d9
commit cd7e054f7d
2 changed files with 14 additions and 4 deletions

View File

@ -1,9 +1,9 @@
/*
* 'gcc -DDEBUG -O2 -o test max2837.c' prints out what test program
* would do if it had a real spi library
* 'gcc -DTEST -DDEBUG -O2 -o test max2837.c' prints out what test
* program would do if it had a real spi library
*
* 'gcc -DBUS_PIRATE -O2 -o test max2837.c' prints out bus pirate commands to
* do the same thing.
* 'gcc -DTEST -DBUS_PIRATE -O2 -o test max2837.c' prints out bus
* pirate commands to do the same thing.
*/
#include <stdint.h>
#include "max2837.h"
@ -166,6 +166,7 @@ void max2837_set_frequency(uint32_t freq)
max2837_regs_commit();
}
#ifdef TEST
uint16_t test(void)
{
LOG("# test\n");
@ -184,3 +185,4 @@ int main(int ac, char **av)
max2837_set_frequency(2441000000);
max2837_stop();
}
#endif //TEST

View File

@ -32,4 +32,12 @@ extern void max2837_regs_read(void);
* provided routines for those operations. */
extern void max2837_regs_commit(void);
/* Turn on/off all chip functions. Does not control oscillator and CLKOUT */
extern void max2837_start(void);
extern void max2837_stop(void);
/* Set frequency in Hz. Frequency setting is a multi-step function
* where order of register writes matters. */
extern void max2837_set_frequency(uint32_t freq);
#endif // __MAX2837_H