ar1000.h File Reference

Routines to access the AR1000 FM radio chip. More...

#include "pic_utils.h"
#include "i2c.h"
Include dependency graph for ar1000.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AR1000_CHIP_ID   28
#define AR1000_DEV_ADDR   0b00100000
#define AR1000_DEV_ID   27
#define AR1000_R0   0
#define AR1000_R1   1
#define AR1000_R10   10
#define AR1000_R11   11
#define AR1000_R13   13
#define AR1000_R14   14
#define AR1000_R15   15
#define AR1000_R2   2
#define AR1000_R3   3
#define AR1000_RBS   20
#define AR1000_RDS_1   21
#define AR1000_RDS_2   22
#define AR1000_RDS_3   23
#define AR1000_RDS_4   24
#define AR1000_RDS_5   25
#define AR1000_RDS_6   26
#define AR1000_RSSI   18
#define ar1000_setup()   ar1000_setup_io()
 Setup AR1000 ports and pins.
#define AR1000_STATUS   19
#define DEV_ID_MFID_0   0
#define DEV_ID_MFID_1   1
#define DEV_ID_MFID_10   10
#define DEV_ID_MFID_11   11
#define DEV_ID_MFID_2   2
#define DEV_ID_MFID_3   3
#define DEV_ID_MFID_4   4
#define DEV_ID_MFID_5   5
#define DEV_ID_MFID_6   6
#define DEV_ID_MFID_7   7
#define DEV_ID_MFID_8   8
#define DEV_ID_MFID_9   9
#define DEV_ID_VERSION_0   12
#define DEV_ID_VERSION_1   13
#define DEV_ID_VERSION_2   14
#define DEV_ID_VERSION_3   15
#define R0_ENABLE   0
#define R0_INT_OSC_EN   15
#define R10_SEEK_WRAP_ENABLE   3
#define R11_AFC_HIGH_SIDE_b1   2
#define R11_AFC_HIGH_SIDE_b2   0
#define R11_AFC_INJECTION_CONTROL   15
#define R11_HILO_SIDE   15
#define R13_GPIO1_0   0
#define R13_GPIO1_1   1
#define R13_GPIO2_0   2
#define R13_GPIO2_1   3
#define R13_GPIO3_0   4
#define R13_GPIO3_1   5
#define R14_VOL2_0   12
#define R14_VOL2_1   13
#define R14_VOL2_2   14
#define R14_VOL2_3   15
#define R15_RDS_CTRL   0
#define R15_RDS_MECC_0   3
#define R15_RDS_MECC_1   4
#define R15_RDS_STA_EN   5
#define R1_DEEMP_SETTING   4
#define R1_FORCE_MONO   3
#define R1_HARD_MUTE_ENABLE   1
#define R1_RDS_ENABLE   13
#define R1_RDS_INT_ENABLE   6
#define R1_SOFT_MUTE_ENABLE   2
#define R1_STC_INT_ENABLE   5
#define R2_CHAN_0   0
#define R2_CHAN_1   1
#define R2_CHAN_2   2
#define R2_CHAN_3   3
#define R2_CHAN_4   4
#define R2_CHAN_5   5
#define R2_CHAN_6   6
#define R2_CHAN_7   7
#define R2_CHAN_8   8
#define R2_TUNE_ENABLE   9
#define R3_BAND_0   11
#define R3_BAND_1   12
#define R3_SEEK_CHANNEL_SPACING   13
#define R3_SEEK_ENABLE   14
#define R3_SEEK_UP   15
#define R3_SEEKTH_0   0
#define R3_SEEKTH_1   1
#define R3_SEEKTH_2   2
#define R3_SEEKTH_3   3
#define R3_SEEKTH_4   4
#define R3_SEEKTH_5   5
#define R3_SEEKTH_6   6
#define R3_VOL_0   7
#define R3_VOL_1   8
#define R3_VOL_2   9
#define R3_VOL_3   10
#define STATUS_BIT_2   2
#define STATUS_CHAN_0   7
#define STATUS_CHAN_1   8
#define STATUS_CHAN_2   9
#define STATUS_CHAN_3   10
#define STATUS_CHAN_4   11
#define STATUS_CHAN_5   12
#define STATUS_CHAN_6   13
#define STATUS_CHAN_7   14
#define STATUS_CHAN_8   15
#define STATUS_RDS_DATA_READY   6
#define STATUS_SEEK_FAIL   4
#define STATUS_SEEK_TUNE_COMPLETE   5
#define STATUS_STEREO   3

Functions

uns8 ar1000_get_register (uns8 reg)
void ar1000_init ()
uns16 ar1000_read_register (uns8 reg)
void ar1000_read_registers ()
void ar1000_seek (uns16 frequency, bit seek_up)
void ar1000_seek2 ()
void ar1000_seek_more ()
void ar1000_set_register (uns8 reg, uns8 data)
void ar1000_set_seek_threshold (uns8 new_seek_threshold)
void ar1000_set_volume (uns8 volume)
void ar1000_setup_io ()
 Setup AR1000 ports and pins.
void ar1000_test ()
void ar1000_tune (uns16 frequency)
void ar1000_write_register (uns8 reg, uns16 data)
void ar1000_write_registers ()

Detailed Description

ITS networking routines - common to mode 1 and 2.

Definition in file ar1000.h.


Define Documentation

#define AR1000_CHIP_ID   28

Chip id - 0x1000 for RDS version, 0x1010 for non-rds version

Definition at line 325 of file ar1000.h.

#define AR1000_DEV_ADDR   0b00100000
#define AR1000_DEV_ID   27

Definition at line 286 of file ar1000.h.

#define AR1000_R0   0

Definition at line 52 of file ar1000.h.

#define AR1000_R1   1

Definition at line 64 of file ar1000.h.

#define AR1000_R10   10

Definition at line 138 of file ar1000.h.

#define AR1000_R11   11

Definition at line 145 of file ar1000.h.

#define AR1000_R13   13

GPIO controls in this register

Definition at line 160 of file ar1000.h.

#define AR1000_R14   14

Definition at line 177 of file ar1000.h.

#define AR1000_R15   15

Definition at line 190 of file ar1000.h.

#define AR1000_R2   2

Definition at line 85 of file ar1000.h.

#define AR1000_R3   3

Definition at line 106 of file ar1000.h.

#define AR1000_RBS   20

Definition at line 258 of file ar1000.h.

#define AR1000_RDS_1   21

Definition at line 262 of file ar1000.h.

#define AR1000_RDS_2   22

Definition at line 266 of file ar1000.h.

#define AR1000_RDS_3   23

Definition at line 270 of file ar1000.h.

#define AR1000_RDS_4   24

Definition at line 274 of file ar1000.h.

#define AR1000_RDS_5   25

Definition at line 278 of file ar1000.h.

#define AR1000_RDS_6   26

Definition at line 282 of file ar1000.h.

#define AR1000_RSSI   18

Definition at line 211 of file ar1000.h.

 
#define ar1000_setup (  )     ar1000_setup_io()

define so as not to break existing code with new naming standard

Definition at line 334 of file ar1000.h.

#define AR1000_STATUS   19

Definition at line 220 of file ar1000.h.

Referenced by ar1000_seek_more().

#define DEV_ID_MFID_0   0

MFID (12 bits 5B1) bit 0

Definition at line 320 of file ar1000.h.

#define DEV_ID_MFID_1   1

MFID (12 bits 5B1) bit 1

Definition at line 318 of file ar1000.h.

#define DEV_ID_MFID_10   10

MFID (12 bits 5B1) bit 10

Definition at line 300 of file ar1000.h.

#define DEV_ID_MFID_11   11

MFID (12 bits 5B1) bit 11

Definition at line 298 of file ar1000.h.

#define DEV_ID_MFID_2   2

MFID (12 bits 5B1) bit 2

Definition at line 316 of file ar1000.h.

#define DEV_ID_MFID_3   3

MFID (12 bits 5B1) bit 3

Definition at line 314 of file ar1000.h.

#define DEV_ID_MFID_4   4

MFID (12 bits 5B1) bit 4

Definition at line 312 of file ar1000.h.

#define DEV_ID_MFID_5   5

MFID (12 bits 5B1) bit 5

Definition at line 310 of file ar1000.h.

#define DEV_ID_MFID_6   6

MFID (12 bits 5B1) bit 6

Definition at line 308 of file ar1000.h.

#define DEV_ID_MFID_7   7

MFID (12 bits 5B1) bit 7

Definition at line 306 of file ar1000.h.

#define DEV_ID_MFID_8   8

MFID (12 bits 5B1) bit 8

Definition at line 304 of file ar1000.h.

#define DEV_ID_MFID_9   9

MFID (12 bits 5B1) bit 9

Definition at line 302 of file ar1000.h.

#define DEV_ID_VERSION_0   12

Version of FM radio bit 0

Definition at line 295 of file ar1000.h.

#define DEV_ID_VERSION_1   13

Version of FM radio bit 1

Definition at line 293 of file ar1000.h.

#define DEV_ID_VERSION_2   14

Version of FM radio bit 2

Definition at line 291 of file ar1000.h.

#define DEV_ID_VERSION_3   15

Version of FM radio bit 3

Definition at line 289 of file ar1000.h.

#define R0_ENABLE   0

Definition at line 59 of file ar1000.h.

#define R0_INT_OSC_EN   15

Definition at line 55 of file ar1000.h.

#define R10_SEEK_WRAP_ENABLE   3

Seek wrap enable

Definition at line 141 of file ar1000.h.

#define R11_AFC_HIGH_SIDE_b1   2

High side control bits

Definition at line 151 of file ar1000.h.

#define R11_AFC_HIGH_SIDE_b2   0

Definition at line 152 of file ar1000.h.

#define R11_AFC_INJECTION_CONTROL   15

AFC injection control

Definition at line 148 of file ar1000.h.

#define R11_HILO_SIDE   15

Definition at line 149 of file ar1000.h.

#define R13_GPIO1_0   0

Definition at line 172 of file ar1000.h.

#define R13_GPIO1_1   1

GPIO1- 00-Disable 01-Reserved 10-Output logic 0 11-Output logic 1

Definition at line 171 of file ar1000.h.

#define R13_GPIO2_0   2

Definition at line 168 of file ar1000.h.

#define R13_GPIO2_1   3

GPIO2- 00-Disable 01-STC or RDS interrupt 10-Output logic 0 11-Output logic 1

Definition at line 167 of file ar1000.h.

#define R13_GPIO3_0   4

Definition at line 164 of file ar1000.h.

#define R13_GPIO3_1   5

GPIO3- 00-Disable 01-Stereo indication 10-Output logic 0 11-Output logic 1

Definition at line 163 of file ar1000.h.

#define R14_VOL2_0   12

Second volume settings (bit 0)

Definition at line 186 of file ar1000.h.

#define R14_VOL2_1   13

Second volume settings (bit 1)

Definition at line 184 of file ar1000.h.

#define R14_VOL2_2   14

Second volume settings (bit 2)

Definition at line 182 of file ar1000.h.

#define R14_VOL2_3   15

Second volume settings (bit 3)

Definition at line 180 of file ar1000.h.

#define R15_RDS_CTRL   0

RDS Control mode 0=block mode (RDSR asserted after 4 blocks received, data in blocks may not be correct. RBS1-4 will present the status of each block) 1=group mode (RDSR is asserted after 4 blocks received without any error)

Definition at line 202 of file ar1000.h.

#define R15_RDS_MECC_0   3

Definition at line 197 of file ar1000.h.

#define R15_RDS_MECC_1   4

RDS Error correction 0x=disable erorr correction 10=2 bit error correction 11=5 bit error correction

Definition at line 196 of file ar1000.h.

#define R15_RDS_STA_EN   5

RDS statistic data enable signal

Definition at line 193 of file ar1000.h.

#define R1_DEEMP_SETTING   4

De-emphasis 1=75us 0=50us

Definition at line 73 of file ar1000.h.

#define R1_FORCE_MONO   3

Force mono

Definition at line 75 of file ar1000.h.

#define R1_HARD_MUTE_ENABLE   1

Hard mute enable

Definition at line 79 of file ar1000.h.

Referenced by ar1000_seek(), ar1000_test(), and ar1000_tune().

#define R1_RDS_ENABLE   13

Enable RDS signal

Definition at line 67 of file ar1000.h.

#define R1_RDS_INT_ENABLE   6

Enable RDS interrupt

Definition at line 69 of file ar1000.h.

#define R1_SOFT_MUTE_ENABLE   2

Soft mute enable

Definition at line 77 of file ar1000.h.

#define R1_STC_INT_ENABLE   5

Seek Tune Complete (STC) interrupt enable

Definition at line 71 of file ar1000.h.

#define R2_CHAN_0   0

Definition at line 100 of file ar1000.h.

#define R2_CHAN_1   1

Definition at line 99 of file ar1000.h.

#define R2_CHAN_2   2

Definition at line 98 of file ar1000.h.

#define R2_CHAN_3   3

Definition at line 97 of file ar1000.h.

#define R2_CHAN_4   4

Definition at line 96 of file ar1000.h.

#define R2_CHAN_5   5

Definition at line 95 of file ar1000.h.

#define R2_CHAN_6   6

Definition at line 94 of file ar1000.h.

#define R2_CHAN_7   7

Definition at line 93 of file ar1000.h.

#define R2_CHAN_8   8

Definition at line 92 of file ar1000.h.

#define R2_TUNE_ENABLE   9

Tune channel enable

Definition at line 88 of file ar1000.h.

Referenced by ar1000_seek(), ar1000_seek_more(), and ar1000_tune().

#define R3_BAND_0   11

Band control 0=Japan narrow band 76Mhz - 90Mhz 1=Japan wide band 76Mhz - 108Mhz

Definition at line 117 of file ar1000.h.

#define R3_BAND_1   12

Band control 0=US/EUROPE 1=Japan

Definition at line 115 of file ar1000.h.

Referenced by ar1000_seek(), and ar1000_tune().

#define R3_SEEK_CHANNEL_SPACING   13

Seek channel spacing 1=100k 0=200k

Definition at line 113 of file ar1000.h.

Referenced by ar1000_seek(), and ar1000_tune().

#define R3_SEEK_ENABLE   14

Seek enable

Definition at line 111 of file ar1000.h.

Referenced by ar1000_seek(), and ar1000_tune().

#define R3_SEEK_UP   15

Seek direction 1=up 0=down

Definition at line 109 of file ar1000.h.

Referenced by ar1000_seek().

#define R3_SEEKTH_0   0

Definition at line 132 of file ar1000.h.

#define R3_SEEKTH_1   1

Definition at line 131 of file ar1000.h.

#define R3_SEEKTH_2   2

Definition at line 130 of file ar1000.h.

#define R3_SEEKTH_3   3

Definition at line 129 of file ar1000.h.

#define R3_SEEKTH_4   4

Definition at line 128 of file ar1000.h.

#define R3_SEEKTH_5   5

Definition at line 127 of file ar1000.h.

#define R3_SEEKTH_6   6

Definition at line 126 of file ar1000.h.

#define R3_VOL_0   7

Definition at line 123 of file ar1000.h.

#define R3_VOL_1   8

Definition at line 122 of file ar1000.h.

#define R3_VOL_2   9

Definition at line 121 of file ar1000.h.

#define R3_VOL_3   10

Definition at line 120 of file ar1000.h.

#define STATUS_BIT_2   2

Used but unknown function

Definition at line 254 of file ar1000.h.

#define STATUS_CHAN_0   7

Current tuned channel bit 0

Definition at line 239 of file ar1000.h.

#define STATUS_CHAN_1   8

Current tuned channel bit 1

Definition at line 237 of file ar1000.h.

#define STATUS_CHAN_2   9

Current tuned channel bit 2

Definition at line 235 of file ar1000.h.

#define STATUS_CHAN_3   10

Current tuned channel bit 3

Definition at line 233 of file ar1000.h.

#define STATUS_CHAN_4   11

Current tuned channel bit 4

Definition at line 231 of file ar1000.h.

#define STATUS_CHAN_5   12

Current tuned channel bit 5

Definition at line 229 of file ar1000.h.

#define STATUS_CHAN_6   13

Current tuned channel bit 6

Definition at line 227 of file ar1000.h.

#define STATUS_CHAN_7   14

Current tuned channel bit 7

Definition at line 225 of file ar1000.h.

#define STATUS_CHAN_8   15

Current tuned channel bit 8

Definition at line 223 of file ar1000.h.

#define STATUS_RDS_DATA_READY   6

RDS data recevied

Definition at line 242 of file ar1000.h.

#define STATUS_SEEK_FAIL   4

Seek has failed

Definition at line 248 of file ar1000.h.

#define STATUS_SEEK_TUNE_COMPLETE   5

Seek or Tune has completed

Definition at line 245 of file ar1000.h.

#define STATUS_STEREO   3

Stereo flag 1=stereo 0=mono

Definition at line 251 of file ar1000.h.


Function Documentation

uns8 ar1000_get_register ( uns8  reg  ) 

Definition at line 55 of file ar1000.c.

References regs.

void ar1000_init (  ) 

Definition at line 224 of file ar1000.c.

References AR1000_DEV_ADDR, ar1000_seek_threshold, i2c_write_eeprom_16bit(), regs, and uns8.

Referenced by ar1000_seek2(), ar1000_seek_more(), ar1000_set_volume(), and ar1000_tune().

Here is the call graph for this function:

Here is the caller graph for this function:

uns16 ar1000_read_register ( uns8  reg  ) 

Definition at line 70 of file ar1000.c.

References AR1000_DEV_ADDR, and i2c_read_eeprom_16bit().

Here is the call graph for this function:

void ar1000_read_registers (  ) 

Definition at line 66 of file ar1000.c.

void ar1000_seek ( uns16  frequency,
bit  seek_up 
)
void ar1000_seek2 (  ) 

Definition at line 234 of file ar1000.c.

References ar1000_init(), and regs.

Here is the call graph for this function:

void ar1000_seek_more (  ) 

Definition at line 273 of file ar1000.c.

References AR1000_DEV_ADDR, ar1000_init(), AR1000_STATUS, channel, i2c_read_eeprom_16bit(), R2_TUNE_ENABLE, regs, serial_print_int(), serial_print_nl(), serial_print_str(), and uns16.

Here is the call graph for this function:

void ar1000_set_register ( uns8  reg,
uns8  data 
)

Definition at line 50 of file ar1000.c.

References regs.

void ar1000_set_seek_threshold ( uns8  new_seek_threshold  ) 

Definition at line 219 of file ar1000.c.

References ar1000_seek_threshold.

void ar1000_set_volume ( uns8  volume  ) 

Definition at line 321 of file ar1000.c.

References ar1000_init(), regs, uns16, uns8, and vol_lookup.

Here is the call graph for this function:

void ar1000_setup_io (  ) 

Definition at line 46 of file ar1000.c.

References i2c_setup.

void ar1000_test (  ) 

Definition at line 255 of file ar1000.c.

References AR1000_DEV_ADDR, i2c_read_eeprom_16bit(), i2c_write_eeprom_16bit(), R1_HARD_MUTE_ENABLE, and uns16.

Here is the call graph for this function:

void ar1000_tune ( uns16  frequency  ) 
void ar1000_write_register ( uns8  reg,
uns16  data 
)

Definition at line 77 of file ar1000.c.

References AR1000_DEV_ADDR, and i2c_write_eeprom_16bit().

Here is the call graph for this function:

void ar1000_write_registers (  ) 

Definition at line 60 of file ar1000.c.

References uns8.


Generated on Wed Dec 8 13:46:58 2010 for Pic Pack by  doxygen 1.6.1