00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00043 #ifndef __ht1632_h
00044 #define __ht1632_h
00045
00046 #include "config.h"
00047
00048
00049 #include "pic_utils.h"
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #define HT1632_CMD_SYS_DISABLE 0b00000000
00088 #define HT1632_CMD_SYS_ENABLE 0b00000001
00089
00090 #define HT1632_CMD_NMOS_8_COMMON 0b00100000
00091 #define HT1632_CMD_NMOS_16_COMMON 0b00100100
00092 #define HT1632_CMD_PMOS_8_COMMON 0b00101000
00093 #define HT1632_CMD_PMOS_16_COMMON 0b00101100
00094
00095 #define HT1632_CMD_CLK_MASTER_MODE 0b00010100
00096 #define HT1632_CMD_CLK_SLAVE_MODE 0b00010000
00097
00098 #define HT1632_CMD_CLK_SOURCE_INT_RC 0b00011000
00099 #define HT1632_CMD_CLK_SOURCE_EXT 0b00011100
00100
00101 #define HT1632_CMD_LEDS_OFF 0b00000010
00102 #define HT1632_CMD_LEDS_ON 0b00000011
00103
00104 #define HT1632_CMD_BLINK_OFF 0b00001000
00105 #define HT1632_CMD_BLINK_ON 0b00001001
00106
00107
00108 void ht1632_setup_io();
00109 void ht1632_init(uns8 hw_config);
00110 void ht1632_write(uns8 mem_addr, uns8 data);
00111 void ht1632_send_command(uns8 command);
00112
00113 void ht1632_set_brightness(uns8 brightness);
00114
00115 void ht1632_set_pixel(uns8 x, uns8 y, uns8 colour);
00116 uns8 ht1632_get_pixel(uns8 x, uns8 y);
00117 void ht1632_horizontal_line(uns8 x, uns8 y, uns8 length, uns8 colour);
00118 void ht1632_vertical_line(uns8 x, uns8 y, uns8 length, uns8 colour);
00119 void ht1632_clear();
00120 void ht1632_fill(uns8 colour);
00121 void ht1632_fill2(uns8 colour);
00122
00123
00124
00125
00126 #ifndef ht1632_cs1_port
00127 #error "You haven't defined ht1632_cs1_port in your config.h!"
00128 #endif
00129
00130 #ifndef ht1632_cs1_pin
00131 #error "You haven't defined i2c_sda_port in your config.h!"
00132 #endif
00133
00134 #ifndef ht1632_data_port
00135 #error "You haven't defined i2c_scl_pin in your config.h!"
00136 #endif
00137
00138 #ifndef ht1632_data_pin
00139 #error "You haven't defined i2c_sda_pin in your config.h!"
00140 #endif
00141
00142 #ifndef ht1632_wr_port
00143 #error "You haven't defined i2c_scl_pin in your config.h!"
00144 #endif
00145
00146 #ifndef ht1632_wr_pin
00147 #error "You haven't defined i2c_sda_pin in your config.h!"
00148 #endif
00149
00150 #ifndef ht1632_rd_port
00151 #error "You haven't defined i2c_scl_pin in your config.h!"
00152 #endif
00153
00154 #ifndef ht1632_rd_pin
00155 #error "You haven't defined i2c_sda_pin in your config.h!"
00156 #endif
00157
00158
00159 #endif