basic led gpio driver
[cortex-from-scratch] / drivers / tm1637.c
1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
2  * 
3  * $LOG$
4  * 2019/7/25 - ROBIN KRENS      
5  * Initial version 
6  * 
7  * $DESCRIPTION$
8  * Basic driver for the TM1637. The TM1637 is 7 segment
9  * ledclock peripheral. Communication is over I2C.
10  *
11  * */
12
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <stdint.h>
16
17 #include <sys/mmap.h>
18 #include <sys/robsys.h>
19
20 #include <lib/regfunc.h>
21 #include <lib/string.h>
22
23 #include <drivers/tm1637.h>
24
25
26 void tm1637_init() {
27
28  /* Program the peripheral input clock in I2C_CR2 Register in order to generate correct timings
29  Configure the clock control registers
30  Configure the rise time register
31  Program the I2C_CR1 register to enable the peripheral
32  Set the START bit in the I2C_CR1 register to generate a Start condition 
33
34  ENABLE GPIOB6 and B7*/
35
36  //regw_u8(RCC_APB1ENR, 0x1, 21, SETBIT);
37  //regw_u32(RCC_APB2ENR, 0x1, 3, SETBIT);
38  // //regw_u8(AFIO_EVCR, 0x89, 0, SETBIT);// set event control register, output on ?
39  
40  // regw_u32(GPIOB_CRL, 0xEE444444, 0, OWRITE);
41  
42
43 }
44