spm2-433-28.h File Reference

#include <std.h>

Go to the source code of this file.

Defines

#define SPM_CONFIG_PIN   PIN_D1
 SmartITs standard pin for entering the spm config mode.
#define SPM_DEFAULT_PIN   PIN_C0
 SmartITs standard pin for default spm pin.
#define SPM_RESET_PIN   PIN_C1
 SmartITs standard pin for resetting the spm.
#define SPM_RX_PIN   PIN_B0
 SmartITs standard pin for reading from the spm.
#define SPM_SPEED   38400
 SmartITs standard speed setting for reading/writing from/to the spm.
#define SPM_TX_PIN   PIN_C5
 SmartITs standard pin for writing to the spm.
#define SPM_WAKEDTR_PIN   PIN_C2
 SmartITs standard pin for spm wake dtr pin.

Functions

void spm2_bootsign ()
void spm2_configMode ()
void spm2_default ()
void spm2_init ()
void spm2_remove_welcome ()
void spm2_remove_welcomemessage ()
void spm2_reset ()
void spm2_standbyMode ()
void spm_init ()


Define Documentation

#define SPM_CONFIG_PIN   PIN_D1
 

SmartITs standard pin for entering the spm config mode.

Definition at line 43 of file spm2-433-28.h.

Referenced by spm2_configMode(), spm2_init(), and spm2_standbyMode().

#define SPM_DEFAULT_PIN   PIN_C0
 

SmartITs standard pin for default spm pin.

Definition at line 53 of file spm2-433-28.h.

Referenced by spm2_default(), and spm2_init().

#define SPM_RESET_PIN   PIN_C1
 

SmartITs standard pin for resetting the spm.

Definition at line 48 of file spm2-433-28.h.

Referenced by spm2_reset().

#define SPM_RX_PIN   PIN_B0
 

SmartITs standard pin for reading from the spm.

Definition at line 64 of file spm2-433-28.h.

#define SPM_SPEED   38400
 

SmartITs standard speed setting for reading/writing from/to the spm.

Definition at line 38 of file spm2-433-28.h.

#define SPM_TX_PIN   PIN_C5
 

SmartITs standard pin for writing to the spm.

Definition at line 69 of file spm2-433-28.h.

#define SPM_WAKEDTR_PIN   PIN_C2
 

SmartITs standard pin for spm wake dtr pin.

Definition at line 58 of file spm2-433-28.h.

Referenced by spm2_init().


Function Documentation

void spm2_bootsign  ) 
 

Gives a sign-of-life, e.g. useful for testing a first spm program. Output is directet to STDOUT, SPMSTREAM and STDSTREAM. STDSTREAM is the serial line on e.g. the Smart It, the SPMSTREAM is the serial line coming from the spm2-433-28 and STDOUT is what it ever may be.

Definition at line 200 of file spm2-433-28.h.

Referenced by spm_init().

00201 { 
00202   int i;
00203         
00204   printf("\n\rbooting the spm2-433-28, make sure you can read from the \n\r");
00205   printf("serial line and the spm serial line the same output\n\r"); 
00206         
00207   fprintf(STDSTREAM, "\nbooting the spm (serial line output)."); 
00208   fprintf(SPMSTREAM, "\n\rbooting the spm (rf output).");   
00209   for(i=0;i<11;i++)
00210     { 
00211       fprintf(STDSTREAM, ".%i", (10-i)); 
00212       fprintf(SPMSTREAM, ".%i", (10-i)); 
00213     } 
00214   fprintf(STDSTREAM, "\n\r"); 
00215   fprintf(SPMSTREAM, "\n\r"); 
00216         
00217 } 

void spm2_configMode  ) 
 

Entering the config mode is done by driving the SPM_CONFIG_PIN to low.

Definition at line 153 of file spm2-433-28.h.

References SPM_CONFIG_PIN.

00154 {
00156   output_low(SPM_CONFIG_PIN);
00157   delay_us(2);
00158 }

void spm2_default  ) 
 

Entering the default mode is done by driving the SPM_DEFAULT_PIN to low

doing a reset

and rising it immediately high again.

Definition at line 141 of file spm2-433-28.h.

References spm2_reset(), and SPM_DEFAULT_PIN.

Referenced by spm_init().

00142 {
00144   output_low(SPM_DEFAULT_PIN);
00145   delay_us(2);
00147   spm2_reset();
00148   delay_us(2);
00150   output_high(SPM_DEFAULT_PIN);
00151 }

void spm2_init  ) 
 

Initializes the spm2-433-28 space port modem by making sure all pins that are necessary have defined stats.

1. drive SPM_WAKEDTR_PIN to low.

2. drive SPM_DEFAULT_PIN to low.

3. do a reset.

4. drive SPM_DEFAULT_PIN to high.

5. drive SPM_CONFIG_PIN to high.

6. do a reset.

Definition at line 172 of file spm2-433-28.h.

References spm2_reset(), SPM_CONFIG_PIN, SPM_DEFAULT_PIN, and SPM_WAKEDTR_PIN.

Referenced by spm_init().

00173 {
00175   // no sleep! no energy save! do work!
00176   output_low(SPM_WAKEDTR_PIN);
00177   //force 9600 baud
00179   output_low(SPM_DEFAULT_PIN);
00181   spm2_reset();
00183   output_high(SPM_DEFAULT_PIN);
00184   //normal operation
00186   output_high(SPM_CONFIG_PIN);
00187   //reset the SPM
00189   spm2_reset();
00190   //wait for the reset
00191   delay_ms(1);
00192 }

void spm2_remove_welcome  ) 
 

void spm2_remove_welcomemessage  ) 
 

After entering the spm2 chip setup, a welcome message is displayed. this function removes this message from the input stream.

Definition at line 117 of file spm2-433-28.h.

00118 {
00119         char a;
00120         while((a = fgetc(SPMSTREAM)) && (a != '>')) 
00121         {
00122                 fputc(a,STDSTREAM);
00123         }
00124 }

void spm2_reset  ) 
 

Resets the spm2 chip according to manual, chapter 2.2. This is done via setting the SPM_RESET_PIN to low, waiting for 1 (one) mikrosecond (in the code, were waiting 2 (two)) and then returning the SPM_RESET_PIN to high again.

Reset is done by driving the the SPM_RESET_PIN to low

and rising it immediately high again.

Definition at line 132 of file spm2-433-28.h.

References SPM_RESET_PIN.

Referenced by spm2_default(), spm2_init(), and spm2_standbyMode().

00133 {
00135   output_low(SPM_RESET_PIN);
00136   delay_us(2);
00138   output_high(SPM_RESET_PIN);
00139 }

void spm2_standbyMode  ) 
 

Entering the standyby mode is done by rising the SPM_CONFIG_PIN

Definition at line 160 of file spm2-433-28.h.

References spm2_reset(), and SPM_CONFIG_PIN.

Referenced by spm_init().

00161 {
00163   output_high(SPM_CONFIG_PIN);
00164   delay_us(2);
00165   spm2_reset();
00166 }

void spm_init  ) 
 

Does the complete initialization needed before transmission!

Definition at line 100 of file spm2-433-28.h.

References spm2_bootsign(), spm2_default(), spm2_init(), and spm2_standbyMode().

Referenced by main().

00101 {
00102   spm2_init();
00103   delay_ms(100);
00104   
00105   spm2_bootsign();
00106   delay_ms(100);
00107 
00108   spm2_default();
00109   
00110   spm2_standbyMode();
00111 }


Generated on Tue Nov 30 09:16:49 2004 for Smart-Its Headers by  doxygen 1.3.9.1