本文整理汇总了C++中setup_spi函数的典型用法代码示例。如果您正苦于以下问题:C++ setup_spi函数的具体用法?C++ setup_spi怎么用?C++ setup_spi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_spi函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
//we use PIN_C2 as an event to determine if we should start the USB CDC
//bootloader. if it is not low (button is not pressed) then goto the
//application, else if is low (button is pressed) then do the bootloader.
output_bit(PIN_C2, 1);
if(!input(PIN_C2))
{
setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_XMIT_L_TO_H | SPI_CLK_DIV_16);
//Max7219 Initialized
initLedDriver();
g_InBootloader = TRUE;
usb_cdc_init();
usb_init();
while(!usb_enumerated());
load_program();
}
g_InBootloader = FALSE;
#ASM
goto APPLICATION_START
#ENDASM
}
开发者ID:tkrworks,项目名称:PICnome-Firmware,代码行数:26,代码来源:bootloader.c
示例2: board_init
int board_init(void)
{
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
#ifdef CONFIG_MXC_SPI
setup_spi();
#endif
imx_iomux_v3_setup_multiple_pads(
usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
imx_iomux_v3_setup_multiple_pads(i2c0_mux_pads,
ARRAY_SIZE(i2c0_mux_pads));
imx_iomux_v3_setup_multiple_pads(
gpio_pads, ARRAY_SIZE(gpio_pads));
gpio_direction_output(IMX_GPIO_NR(1, 7),0); /* GPIO7 */
gpio_direction_output(IMX_GPIO_NR(1, 8),0); /* GPIO8 */
gpio_direction_input(IMX_GPIO_NR(7, 13)); /* GPIO18 */
gpio_direction_input(IMX_GPIO_NR(4, 5)); /* GPIO19 */
gpio_direction_output(IMX_GPIO_NR(3, 29), 1); /* EIM_D29: ONOFF */
gpio_direction_output(IMX_GPIO_NR(3,20),0);
gpio_direction_output(IMX_GPIO_NR(2,23),1); /* enable RTC */
setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info0);
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
return 0;
}
开发者ID:rcoscali,项目名称:bootable-bootloader-uboot-imx,代码行数:28,代码来源:sp.c
示例3: init_pic
void init_pic()
{
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_32);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters( RTCC_INTERNAL, RTCC_DIV_1 | RTCC_8_BIT);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
EXT_INT_EDGE(L_TO_H);
OUTPUT_B(0);
OUTPUT_C(0);
SET_TRIS_B(0b01000111); //pins B0, B1, B2 and B6 are set to give inputs. B0 is the external interuupt pin
//B0, B1 & B2 are used for people counting. B6 for zero crossing detection in fan controlling
SET_TRIS_C(0b00000000);
SET_TRIS_D(0b00000000); //D port except D0 pin, is used for lcd panel
set_adc_channel(0); //the next read_adc call will read channel 0
}
开发者ID:Manuri,项目名称:People-counting-and-fan-speed-controlling-system,代码行数:27,代码来源:testing3+adc_c.c
示例4: main
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
TX = 0;
RX = 1;
TRIS_B = 0x00;
while(1)
{
//putc(getc());
LED = 1;
delay_ms(300);
LED = 0;
delay_ms(300);
if(verificaFlag())
{
if(recebeByte())
enviaByte('T');
}
}
}
开发者ID:JaconsMorais,项目名称:repcomputaria,代码行数:33,代码来源:rs+232_2.c
示例5: main
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32|RTCC_8_bit); //RTCC_DIV_32 -> 122 Hz ou 30 Hz por nivel
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_TIMER1);
enable_interrupts(INT_EXT);
enable_interrupts(INT_EXT1);
enable_interrupts(GLOBAL);
set_tris_a (0b11110000);
set_tris_c (0b00000000);
set_tris_d (0b00000000);
while(1){
delay_ms(10);
}
}
开发者ID:gjasper,项目名称:PIC-based-4x4x4-LED-Cube-controller,代码行数:30,代码来源:CUBO_LEDS_4X4.c
示例6: RTC_read_alarm
void RTC_read_alarm(){
int8 RTC_buffer;
RTC_buffer = 0;
setup_spi(SPI_MASTER|SPI_MODE_0_0|SPI_CLK_DIV_16);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x0A);
RTC_Al_Mon_Reg = spi_read(RTC_buffer);
RTC_Al_DOM_Reg = spi_read(RTC_buffer);
RTC_Al_Hr_Reg = spi_read(RTC_buffer);
RTC_Al_Min_Reg = spi_read(RTC_buffer);
RTC_Al_Sec_Reg = spi_read(RTC_buffer);
RTC_Flags_Reg = spi_read(RTC_buffer);
output_bit(RTC_CS, DISABLE);
RTC_Al_Mon_Reg = RTC_Al_Mon_Reg & 0b00011111;
RTC_Al_Mon_Reg = Bcd2Dec(RTC_Al_Mon_Reg);
RTC_Al_DOM_Reg = RTC_Al_DOM_Reg & 0b00111111;
RTC_Al_DOM_Reg = Bcd2Dec(RTC_Al_DOM_Reg);
RTC_Al_Hr_Reg = RTC_Al_Hr_Reg & 0b00111111;
RTC_Al_Hr_Reg = Bcd2Dec(RTC_Al_Hr_Reg);
RTC_Al_Min_Reg = RTC_Al_Min_Reg & 0b01111111;
RTC_Al_Min_Reg = Bcd2Dec(RTC_Al_Min_Reg);
RTC_Al_Sec_Reg = RTC_Al_Sec_Reg & 0b01111111;
RTC_Al_Sec_Reg = Bcd2Dec(RTC_Al_Sec_Reg);
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:29,代码来源:rtc.c
示例7: init_prog
//=============================================================================
void init_prog(void)
{
setup_wdt(WDT_OFF);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16|RTCC_8_BIT);// TIMER0
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_low_volt_detect(FALSE);
setup_oscillator(OSC_32MHZ);
set_tris_a(0xFF);//7F
set_tris_b(0xFF); //FF
set_tris_c(0x94);//94
set_tris_d(0xFF); //02
set_tris_e(0xF0); //f0
set_tris_f(0xFF);//ff
set_tris_g(0xFC); //04
output_a(0x00);
output_b(0x00);
output_c(0x00);
output_d(0x00);
output_e(0x00);
output_f(0x00);
output_g(0x00);
}
开发者ID:suleymancanan,项目名称:RFID-PRJ-TX,代码行数:32,代码来源:ddd.c
示例8: main
int main(void) {
// Initialize serial port for output
uart_init();
stdout = &uart_output;
stdin = &uart_input;
// Setting up interrupts
interrupt_init();
// Disable unused ports to lower consumption
disable_ports();
// Setup SPI
setup_spi(SPI_MODE_0, SPI_MSB, SPI_NO_INTERRUPT, SPI_MSTR_CLK2);
fprintf(stdout,"START\n");
setup_wdt(); // Setup watchdog functions
sei(); // Enable interrupts
while (1) {
enter_sleep();
}
// wdt_disable();
return 0;
}
开发者ID:hkzlab,项目名称:AVR-Experiments,代码行数:30,代码来源:main.c
示例9: board_init_f
void board_init_f(ulong dummy)
{
#ifdef CONFIG_CMD_NAND
/* Enable NAND */
setup_gpmi_nand();
#endif
/* setup clock gating */
ccgr_init();
/* setup AIPS and disable watchdog */
arch_cpu_init();
/* setup AXI */
gpr_init();
board_early_init_f();
/* setup GP timer */
timer_init();
setup_spi();
/* UART clocks enabled and gd valid - init serial console */
preloader_console_init();
/* DDR initialization */
spl_dram_init();
/* Clear the BSS. */
memset(__bss_start, 0, __bss_end - __bss_start);
/* load/boot image from boot device */
board_init_r(NULL, 0);
}
开发者ID:frawang,项目名称:u-boot,代码行数:35,代码来源:pcm058.c
示例10: init_pic
void init_pic()
{
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_32);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters( RTCC_INTERNAL, RTCC_DIV_1 | RTCC_8_BIT);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
EXT_INT_EDGE(L_TO_H);
OUTPUT_B(0);
OUTPUT_C(0);
SET_TRIS_B(0b01000111); //pins B0, B1 and B2 are set to give inputs. b0 is the external interuupt pin
SET_TRIS_C(0b00000000);
SET_TRIS_D(0b00000000);
set_adc_channel(0); //the next read_adc call will read channel 0
}
开发者ID:Manuri,项目名称:People-counting-and-fan-speed-controlling-system,代码行数:26,代码来源:testing3+adc_a.c
示例11: main
void main()
{
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// TODO: USER CODE!!
set_adc_channel(0); // set ref valus
delay_ms(100);
ref_0 =read_adc();
delay_ms(100);
set_adc_channel(3); // set ref valus
delay_ms(100);
ref_3 =read_adc();
delay_ms(100);
output_b(0b11111111);
delay_ms(700);
output_b(0);
while(1){
set_adc_channel(0);
delay_ms(20); // take readings
adc_val_0 =read_adc();
delay_ms(20);
if(adc_val_0 > ref_0+cons){
l_0 =1;
output_high(pin_d7);
delay_ms(500);
}
else{
l_0=0;
output_low(pin_d7);
// delay_ms(500);
}
set_adc_channel(3);
delay_ms(20); // take readings
adc_val_3 =read_adc();
delay_ms(20);
if(adc_val_3> ref_3+cons){
l_3 =1;
output_high(pin_d6);
delay_ms(500);
}
else{
l_3=0;
output_low(pin_d6);
}
}
}
开发者ID:isurusanjeewa,项目名称:Line-Following-Robot,代码行数:60,代码来源:2_sen.c
示例12: main
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16|RTCC_8_bit);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(INT_EXT);
enable_interrupts(INT_EXT1);
enable_interrupts(GLOBAL);
set_tris_a (0b11110000);
set_tris_b (0b00000000);
set_tris_c (0b00000000);
cubeLevelC0 = 0xFF;
cubeLevelC1 = 0x00;
cubeLevelC2 = 0xFF;
cubeLevelC3 = 0x00;
cubeLevelD0 = 0x00;
cubeLevelD1 = 0xFF;
cubeLevelD2 = 0x00;
cubeLevelD3 = 0xFF;
}
开发者ID:gjasper,项目名称:PIC-based-4x4x4-LED-Cube-controller,代码行数:33,代码来源:CUBO_LEDS_4X4+-+BACKUP.c
示例13: main
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
while (TRUE) {
printf("\r\nSinyali Baslatmak icin B tusuna basiniz");
if (getchar() == 'b') //eðer b tuþuna basarsan
{
printf("\n1 hz sinyal aktif edildi\r");
while (1) {
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
}
}
}
开发者ID:akinayturan,项目名称:programing-microprocessor-examples,代码行数:26,代码来源:rs232.c
示例14: RTC_minute
// set alarm to go off every minute
void RTC_minute()
{
int8 RTC_buffer;
setup_spi(SPI_MASTER|SPI_MODE_0_0|SPI_CLK_DIV_16);
// Do not write alarm seconds last. It will disable the interrupt/flag
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8E); // address - Sec
RTC_buffer = spi_read(0b00000000); // data
output_bit(RTC_CS, DISABLE);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8D); // address - Min
RTC_buffer = spi_read(0b10000000); // data
output_bit(RTC_CS, DISABLE);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8C); // address - Hour
RTC_buffer = spi_read(0b10000000); // data
output_bit(RTC_CS, DISABLE);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8B); // address - DOM
RTC_buffer = spi_read(0b11000000); // data
output_bit(RTC_CS, DISABLE);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8A); // address - Month
RTC_buffer = spi_read(0b10000000); // data
output_bit(RTC_CS, DISABLE);
RTC_read_alarm();
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:31,代码来源:rtc.c
示例15: RTC_read
void RTC_read()
{
int8 RTC_buffer;
RTC_buffer = 0;
setup_spi(SPI_MASTER|SPI_MODE_0_0|SPI_CLK_DIV_16);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x00);
RTC_Tenths_Sec_Reg = spi_read(RTC_buffer);
RTC_Sec_Reg = spi_read(RTC_buffer);
RTC_Min_Reg = spi_read(RTC_buffer);
RTC_Hr_Reg = spi_read(RTC_buffer);
RTC_DOW_Reg = spi_read(RTC_buffer);
RTC_DOM_Reg = spi_read(RTC_buffer);
RTC_Mon_Reg = spi_read(RTC_buffer);
RTC_Yr_Reg = spi_read(RTC_buffer);
output_bit(RTC_CS, DISABLE);
RTC_Sec_Reg = Bcd2Dec(RTC_Sec_Reg);
RTC_Min_Reg = Bcd2Dec(RTC_Min_Reg);
RTC_Hr_Reg = Bcd2Dec(RTC_Hr_Reg);
RTC_DOM_Reg = Bcd2Dec(RTC_DOM_Reg);
RTC_Mon_Reg = Bcd2Dec(RTC_Mon_Reg);
RTC_Yr_Reg = Bcd2Dec(RTC_Yr_Reg);
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:27,代码来源:rtc.c
示例16: main
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_EXT);
ext_int_edge(L_to_H);
enable_interrupts(GLOBAL);
output_low(PIN_B7);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
while(TRUE)
{
}
}
开发者ID:romajr,项目名称:Control_PIC_projects,代码行数:25,代码来源:3º+Exemplo.c
示例17: main
void main(){
//CHAR letA[]="A";
//CHAR letB[]="B";
//CHAR letC[]="C";
//CHAR espera[]="teste";
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
glcd_init(ON); //inicializa o display
glcd_fillScreen(0); //limpa display inteiro
//glcd_text57(34, 55, letA, 1, 1);
//glcd_rect(46,53,60,63,1,1);
//glcd_text57(48, 55, letB, 1, 0);
while(TRUE){
glcd_imagem(1);
delay_ms(3000);
glcd_fillScreen(0); //limpa display inteiro
glcd_imagem(2);
delay_ms(3000);
glcd_fillScreen(0); //limpa display inteiro
}
}
开发者ID:ezequieldonhauser,项目名称:DISPLAY_128x64,代码行数:35,代码来源:main.c
示例18: board_init
int board_init(void)
{
struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
clrsetbits_le32(&iomuxc_regs->gpr[1],
IOMUXC_GPR1_OTG_ID_MASK,
IOMUXC_GPR1_OTG_ID_GPIO1);
imx_iomux_v3_setup_multiple_pads(misc_pads, ARRAY_SIZE(misc_pads));
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
#ifdef CONFIG_MXC_SPI
setup_spi();
#endif
imx_iomux_v3_setup_multiple_pads(
usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info0);
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
#ifdef CONFIG_CMD_SATA
setup_sata();
#endif
return 0;
}
开发者ID:ehamine,项目名称:u-boot,代码行数:28,代码来源:nitrogen6x.c
示例19: main
void main()
{
int16 valor;
float tensao;
lcd_init();
setup_adc_ports(AN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_16);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_adc_channel(0);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
while(1)
{
valor = read_adc();
tensao = valor*5.0/1024.0;
printf("ADC = %04ld",valor);
printf(" Tensao = %.3fV\r", tensao);
printf(lcd_putc,"\fADC = %ld",valor);
printf(lcd_putc,"\nTensao = %.3fV",tensao);
delay_ms(250);
}
}
开发者ID:romajr,项目名称:Control_PIC_projects,代码行数:35,代码来源:3ºexemplo.c
示例20: RTC_alarm
// set alarm to wake up at real-time
void RTC_alarm(){
int8 time_error;
int8 RTC_buffer;
RTC_read_alarm();
time_error = get_time();
if (time_error == 0 ){
// RTC does not have a year register - store in EEPROM
RTC_Al_Yr_Reg = RTC_Yr_Data;
write8(ADDR_ALARM_YR, RTC_Al_Yr_Reg);
// Masking AFE bit to ensure alarm output is enabled
RTC_Mon_Data = Dec2Bcd(RTC_Mon_Data);
RTC_Mon_Data = RTC_Mon_Data | 0b10000000;
// Freq DC to 2 MHz ((10/4)/16) = 625 kHz
setup_spi(SPI_MASTER|SPI_MODE_0_0|SPI_CLK_DIV_16);
delay_us(10);
// Do not write alarm seconds last
// ... it disables the interrupt/flag
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8E); // address - Sec
RTC_buffer = spi_read(Dec2Bcd(RTC_Sec_Data)); // data
output_bit(RTC_CS, DISABLE);
delay_us(1); // Delays added 1.020A
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8D); // address - Min
RTC_buffer = spi_read(Dec2Bcd(RTC_Min_Data)); // data
output_bit(RTC_CS, DISABLE);
delay_us(1);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8C); // address - Hour
RTC_buffer = spi_read(Dec2Bcd(RTC_Hr_Data)); // data
output_bit(RTC_CS, DISABLE);
delay_us(1);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8B); // address - DOM
RTC_buffer = spi_read(Dec2Bcd(RTC_DOM_Data)); // data
output_bit(RTC_CS, DISABLE);
delay_us(1);
output_bit(RTC_CS, ENABLE);
RTC_buffer = spi_read(0x8A); // address - Month
RTC_buffer = spi_read(RTC_Mon_Data); // data
output_bit(RTC_CS, DISABLE);
delay_us(1);
RTC_read_alarm();
}
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:60,代码来源:rtc.c
注:本文中的setup_spi函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论