Re: stm32lib - where do I get it from
Posted: Thu Feb 13, 2014 9:23 am
I don't know, just try. If it compiles most likely it will work.
Giovanni
Giovanni
ChibiOS Web Boards
https://forum.chibios.org/
Code: Select all
int main(void) {
halInit();
chSysInit();
palSetPadMode(GPIOA, 1|2|3|8|9|10|15, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOB, 3|4|5|8|9|10|11|12|13|14|15, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOC, 0|1|2|3|6|7|8|9|10|11, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOB, 6, PAL_MODE_OUTPUT_PUSHPULL);
RCC_Config(); /* not sure where to configure clock for the LCD, so I do it here... */
LCD_GLASS_Init(); /* from the library stm32l_discovery_lcd.c */
while(TRUE) {
palSetPad(GPIOB, GPIOB_LED4); /*LED blinks*/
chThdSleepMilliseconds(500);
palClearPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(500);
LCD_GLASS_DisplayString("123456");
}
}
void RCC_Config(void)
{
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_LCD, ENABLE);
/* Allow access to the RTC */
PWR_RTCAccessCmd(ENABLE);
/* Reset Backup Domain */
RCC_RTCResetCmd(ENABLE);
RCC_RTCResetCmd(DISABLE);
/*!< LSE Enable */
RCC_LSEConfig(RCC_LSE_ON);
/*!< Wait till LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{}
/*!< LCD Clock Source Selection */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
}