sipo.c

Go to the documentation of this file.
00001 
00045 #include "sipo.h"
00046 #include "hw/hw_sipo.h"
00047 
00048 #include <drv/ser.h>
00049 
00050 Serial *sipo_port;
00051 
00053 void sipo_init(void)
00054 {
00055     CLOCK_LOW;
00056     SET_SOUT_LOW;
00057     LOAD_LOW;
00058     SET_SCK_OUT;
00059     SET_SOUT_OUT;
00060     LOAD_INIT;
00061     sipo_putchar(0x0);
00062     OE_OUT;
00063     OE_LOW;
00064 }
00065 
00067 void sipo_putchar(uint8_t c)
00068 {
00069     for(int i = 0; i <= 7; i++)
00070     {
00071         if((c & BV(i)) == 0)
00072         {
00073             SET_SOUT_LOW;
00074         }
00075         else
00076         {
00077             SET_SOUT_HIGH;
00078         }
00079 
00080         CLOCK_PULSE;
00081     }
00082 
00083     LOAD_HIGH;
00084     LOAD_LOW;
00085 }
00086