Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file satmb.h \brief Satellite Motherboard Driver Functions. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'satmb.h' |
||
5 | // Title : Satellite Motherboard Driver Functions |
||
6 | // Author : Pascal Stang - Copyright (C) 2004 |
||
7 | // Created : 2004.10.13 |
||
8 | // Revised : 2005.10.24 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | // This code is distributed under the GNU Public License |
||
14 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
15 | // |
||
16 | //***************************************************************************** |
||
17 | |||
18 | #ifndef SATMB_H |
||
19 | #define SATMB_H |
||
20 | |||
21 | #include "dallas.h" |
||
22 | #include "dallasids.h" |
||
23 | |||
24 | |||
25 | // defines and typedefs |
||
26 | |||
27 | // SAT-MB serial port control |
||
28 | // CTS is an output signal |
||
29 | #define SATMB_SER_CTS_PORT PORTB |
||
30 | #define SATMB_SER_CTS_DDR DDRB |
||
31 | #define SATMB_SER_CTS_PORTIN PINB |
||
32 | #define SATMB_SER_CTS_PIN PB5 |
||
33 | // RTS is an input signal |
||
34 | #define SATMB_SER_RTS_PORT PORTB |
||
35 | #define SATMB_SER_RTS_DDR DDRB |
||
36 | #define SATMB_SER_RTS_PORTIN PINB |
||
37 | #define SATMB_SER_RTS_PIN PB6 |
||
38 | // Serial Port Power Control (set low to turn off) |
||
39 | #define SATMB_SER_PWR_PORT PORTD |
||
40 | #define SATMB_SER_PWR_DDR DDRD |
||
41 | #define SATMB_SER_PWR_PORTIN PIND |
||
42 | #define SATMB_SER_PWR_PIN PD5 |
||
43 | |||
44 | // SAT-MB Linx Radio Transceiver |
||
45 | // Non-UART RX line (receive) |
||
46 | #define SATMB_LINX_IO_RX_PORT PORTD |
||
47 | #define SATMB_LINX_IO_RX_DDR DDRD |
||
48 | #define SATMB_LINX_IO_RX_PORTIN PIND |
||
49 | #define SATMB_LINX_IO_RX_PIN PD4 |
||
50 | // Non-UART TX line (transmit) |
||
51 | #define SATMB_LINX_IO_TX_PORT PORTB |
||
52 | #define SATMB_LINX_IO_TX_DDR DDRB |
||
53 | #define SATMB_LINX_IO_TX_PORTIN PINB |
||
54 | #define SATMB_LINX_IO_TX_PIN PB7 |
||
55 | // Linx Radio Power Control (set low to turn off) |
||
56 | #define SATMB_LINX_PWR_PORT PORTD |
||
57 | #define SATMB_LINX_PWR_DDR DDRD |
||
58 | #define SATMB_LINX_PWR_PORTIN PIND |
||
59 | #define SATMB_LINX_PWR_PIN PD5 |
||
60 | // Radio Receive Signal Strength Indicator (RSSI) |
||
61 | // this is an analog output |
||
62 | #define SATMB_LINX_RSSI_PORT PORTF |
||
63 | #define SATMB_LINX_RSSI_DDR DDRF |
||
64 | #define SATMB_LINX_RSSI_PORTIN PINF |
||
65 | #define SATMB_LINX_RSSI_PIN PF7 |
||
66 | |||
67 | // SAT-MB Direct Dallas Bus Driver |
||
68 | // Dallas Line Pin |
||
69 | #define SATMB_DALLAS_LINE_PORT PORTE |
||
70 | #define SATMB_DALLAS_LINE_DDR DDRE |
||
71 | #define SATMB_DALLAS_LINE_PORTIN PINE |
||
72 | #define SATMB_DALLAS_LINE_PIN PE7 |
||
73 | // Dallas OC-Tx Pin |
||
74 | #define SATMB_DALLAS_TX_PORT PORTE |
||
75 | #define SATMB_DALLAS_TX_DDR DDRE |
||
76 | #define SATMB_DALLAS_TX_PORTIN PINE |
||
77 | #define SATMB_DALLAS_TX_PIN PE3 |
||
78 | // Dallas Strong-Pullup Pin |
||
79 | #define SATMB_DALLAS_SPU_PORT PORTE |
||
80 | #define SATMB_DALLAS_SPU_DDR DDRE |
||
81 | #define SATMB_DALLAS_SPU_PORTIN PINE |
||
82 | #define SATMB_DALLAS_SPU_PIN PE4 |
||
83 | |||
84 | // functions |
||
85 | |||
86 | //! Initializes SAT-MB hardware |
||
87 | void satmbInit(void); |
||
88 | |||
89 | //! Controls power to the SAT-MB serial port |
||
90 | // TRUE = on |
||
91 | // FALSE = off |
||
92 | void satmbSetSerialPortPower(u08 on); |
||
93 | |||
94 | //! Initializes the SAT-MB serial port RTS/CTS lines |
||
95 | void satmbSerialRtsCtsInit(void); |
||
96 | |||
97 | //! Returns the current state of the SAT-MB serial port RTS line |
||
98 | u08 satmbSerialRtsCheck(void); |
||
99 | |||
100 | //! Sets the current state of the SAT-MB serial port CTS line |
||
101 | void satmbSerialCtsSet(u08 state); |
||
102 | |||
103 | // Power control commands (dallas bus) |
||
104 | void satmbSetPowerState(dallas_rom_id_T* targetRomId, u08 state); |
||
105 | |||
106 | //! Get the current draw from the indicated subsystem's V1 power control (V1 is usually 5V supply) |
||
107 | u16 satmbV1GetCurrent(DallasSubsysId* targetSubsysId); |
||
108 | |||
109 | //! Get the current draw from the indicated subsystem's V2 power control (V2 is usually 12V supply) |
||
110 | u16 satmbV2GetCurrent(DallasSubsysId* targetSubsysId); |
||
111 | |||
112 | //! Get the over-current state from the indicated subsystem's V1 power control |
||
113 | /// Returns TRUE if over-current, FALSE otherwise |
||
114 | u08 satmbV1GetOverCurrent(DallasSubsysId* targetSubsysId); |
||
115 | |||
116 | //! Get the over-current state from the indicated subsystem's V2 power control |
||
117 | /// Returns TRUE if over-current, FALSE otherwise |
||
118 | u08 satmbV2GetOverCurrent(DallasSubsysId* targetSubsysId); |
||
119 | |||
120 | //! Set the power control state for the indicated subsystem's V1 |
||
121 | /// state = 1, turns the subsystem's V1 on |
||
122 | /// state = 0, turns the subsystem's V1 off |
||
123 | void satmbV1SetPowerState(DallasSubsysId* targetSubsysId, u08 state); |
||
124 | |||
125 | //! Set the power control state for the indicated subsystem's V2 |
||
126 | /// state = 1, turns the subsystem's V2 on |
||
127 | /// state = 0, turns the subsystem's V2 off |
||
128 | void satmbV2SetPowerState(DallasSubsysId* targetSubsysId, u08 state); |
||
129 | |||
130 | #endif |
Powered by WebSVN v2.8.3