16 lines
440 B
C
16 lines
440 B
C
#include "stm32f10x.h"
|
|
|
|
void LightSensor_Init(void) {
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
|
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
|
|
|
|
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
|
}
|
|
|
|
uint8_t LightSensor_Read(void) {
|
|
return GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_13);
|
|
} |