ADF4350
ADF4350.h@0:a37afa334923, 2017-09-30 (annotated)
- Committer:
- nguyenmanhthao996tn
- Date:
- Sat Sep 30 09:12:58 2017 +0000
- Revision:
- 0:a37afa334923
Worked version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nguyenmanhthao996tn | 0:a37afa334923 | 1 | #ifndef __ADF4350__ |
nguyenmanhthao996tn | 0:a37afa334923 | 2 | #define __ADF4350__ |
nguyenmanhthao996tn | 0:a37afa334923 | 3 | |
nguyenmanhthao996tn | 0:a37afa334923 | 4 | /* Libraries */ |
nguyenmanhthao996tn | 0:a37afa334923 | 5 | #include "mbed.h" |
nguyenmanhthao996tn | 0:a37afa334923 | 6 | #include "software_SPI.h" |
nguyenmanhthao996tn | 0:a37afa334923 | 7 | #include <math.h> |
nguyenmanhthao996tn | 0:a37afa334923 | 8 | #include "PinConfiguration.h" |
nguyenmanhthao996tn | 0:a37afa334923 | 9 | #include "delay.h" |
nguyenmanhthao996tn | 0:a37afa334923 | 10 | |
nguyenmanhthao996tn | 0:a37afa334923 | 11 | /* Defines */ |
nguyenmanhthao996tn | 0:a37afa334923 | 12 | #define PFDRFout (double)25 |
nguyenmanhthao996tn | 0:a37afa334923 | 13 | #define OutputChannelSpacing (double)0.01 |
nguyenmanhthao996tn | 0:a37afa334923 | 14 | |
nguyenmanhthao996tn | 0:a37afa334923 | 15 | /* Variables */ |
nguyenmanhthao996tn | 0:a37afa334923 | 16 | static uint32_t registers[6] = {0x4580A8, 0x80080C9, 0x18004E42, 0x4B3, 0x8C803C, 0x580005}; // 437 MHz with ref to 25 MHz |
nguyenmanhthao996tn | 0:a37afa334923 | 17 | static int8_t OutputDivider; |
nguyenmanhthao996tn | 0:a37afa334923 | 18 | static unsigned int long INTA, MOD, FRAC; |
nguyenmanhthao996tn | 0:a37afa334923 | 19 | static float FRACF; |
nguyenmanhthao996tn | 0:a37afa334923 | 20 | static DigitalOut le(ADF435x_LE_PIN), ce(ADF435x_CE_PIN); |
nguyenmanhthao996tn | 0:a37afa334923 | 21 | static software_SPI adf(ADF435x_DAT_PIN, ADF435x_CLK_PIN); |
nguyenmanhthao996tn | 0:a37afa334923 | 22 | |
nguyenmanhthao996tn | 0:a37afa334923 | 23 | /* Methods */ |
nguyenmanhthao996tn | 0:a37afa334923 | 24 | void __ADF4350_WriteRegister32(const uint32_t value); |
nguyenmanhthao996tn | 0:a37afa334923 | 25 | void __ADF4350_SetADF(void); |
nguyenmanhthao996tn | 0:a37afa334923 | 26 | void __ADF4350_bitSet(uint32_t *destination, int position); |
nguyenmanhthao996tn | 0:a37afa334923 | 27 | void __ADF4350_bitClear(uint32_t *destination, int position); |
nguyenmanhthao996tn | 0:a37afa334923 | 28 | void __ADF4350_bitWrite(uint32_t *destination, int position, int value); |
nguyenmanhthao996tn | 0:a37afa334923 | 29 | void ADF4350_Init(void); |
nguyenmanhthao996tn | 0:a37afa334923 | 30 | void ADF4350_SetFrequency(double RFout); |
nguyenmanhthao996tn | 0:a37afa334923 | 31 | void ADF4350_reset(); |
nguyenmanhthao996tn | 0:a37afa334923 | 32 | |
nguyenmanhthao996tn | 0:a37afa334923 | 33 | #endif /* __ADF4350__ */ |