| Nano100BN Series BSP V3.03.002 The Board Support Package for Nano100BN Series

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Basic01 peripheral Functions
NANO100 Library » Nano130_Basic01 Library

## Data Structures
struct | PWM_Capture_T

## Macros
#define | _PWM_Source_Clock 12000000
#define | _PWM_Resolution 65536
#define | _PWM_Prescale_Max 256
#define | _PWM_Duty_Scale 100
#define | _ADC_Clock 300000
#define | SEG_A_ON PA2=0
#define | SEG_B_ON PA3=0
#define | SEG_C_ON PA4=0
#define | SEG_D_ON PA5=0
#define | SEG_E_ON PA6=0
#define | SEG_F_ON PA7=0
#define | SEG_G_ON PD6=0
#define | SEG_H_ON PD7=0
#define | SEG_CONTROL1_ON PD14=1
#define | SEG_CONTROL2_ON PD15=1
#define | SEG_A_OFF PA2=1
#define | SEG_B_OFF PA3=1
#define | SEG_C_OFF PA4=1
#define | SEG_D_OFF PA5=1
#define | SEG_E_OFF PA6=1
#define | SEG_F_OFF PA7=1
#define | SEG_G_OFF PD6=1
#define | SEG_H_OFF PD7=1
#define | SEG_CONTROL1_OFF PD14=0
#define | SEG_CONTROL2_OFF PD15=0
#define | KEY1_INPUT PD12
#define | KEY2_INPUT PE12
#define | KEY3_INPUT PD0
#define | KEY4_INPUT PD1
#define | Buzzer_Power_ON PE6=1
| Control Buzzer module power on. More...
#define | Buzzer_Power_OFF PE6=0
| Control Buzzer module power down. More...
#define | NEC_LDC_MARK 16
#define | NEC_LDC_SPACE 8
#define | NEC_BIT_MARK 1
#define | NEC_ONE_SPACE 3
#define | NEC_ZERO_SPACE 1
#define | NEC_BYTES 4
#define | LED1_ON PB0=0
#define | LED2_ON PB1=0
#define | LED3_ON PE9=0
#define | LED4_ON PE10=0
#define | LED5_ON PE11=0
#define | LED6_ON PD8=0
#define | LED7_ON PD9=0
#define | LED8_ON PC7=0
#define | LED1_OFF PB0=1
#define | LED2_OFF PB1=1
#define | LED3_OFF PE9=1
#define | LED4_OFF PE10=1
#define | LED5_OFF PE11=1
#define | LED6_OFF PD8=1
#define | LED7_OFF PD9=1
#define | LED8_OFF PC7=1

## Typedefs
typedef void(* | IrDA_Code_Exe) (volatile uint8_t *IR_CODE)

## Enumerations
enum | E_Edge { Rising = 0, Falling = 1 }

## Functions
void | Show_Seven_Segment (unsigned char no, unsigned char number)
| This function turn on 7_Segment LED to show numbers. More...
void | Close_Seven_Segment (void)
| This function turn off 7_Segment LED. More...
void | Open_Seven_Segment (void)
| This function turn on 7_Segment LED. More...
void | Initial_KEY_INPUT (void)
| Set Button GPIO to input mode. More...
unsigned char | Get_KEY_INPUT (void)
| This function get button status. More...
void | Open_Buzzer (void)
| This function enable PWM1 module clock and set clock source to start Buzzer module. More...
void | Close_Buzzer (void)
| This function power down the Buzzer module. More...
void | Write_Buzzer (unsigned int frequence, unsigned int duty)
| This function set PWM output frequence and duty to drive Buzzer module. More...
void | Open_CLK_OUT (uint32_t Clock_Source, uint32_t FRQDIV_FSEL)
| This function enable frequency divider module clock, enable frequency divider clock function and configure frequency divider. More...
void | Close_CLK_OUT (void)
| This function disable frequency output function. More...
void | I2C_EEPROM_Init (uint8_t u8Divider)
| This function initializes the I2C module, bit-rate = 100 kHz and enable the corresponding interrupt. More...
void | I2C_EEPROM_Write (uint16_t u16Address, uint8_t u8Data)
| This function do the I2C data writing to EEPROM device. More...
uint8_t | I2C_EEPROM_Read (uint16_t u16Address)
| This function do the I2C data reading from EEPROM device. More...
void | Open_EINT1 (void)
| This function enables EINT1 interrupt and IRQ handler, and configs trigger condition for falling edge. More...
void | SendNEC (uint8_t *data)
| This function is used to transmit IrDA NEC waveform through PC 15 (PWM1_CH3) More...
void | IrDA_NEC_TxRx_Init (IrDA_Code_Exe pfnIrDA_Code_Exe)
| This function is used to initiate PWM for IrDA NEC. More...
void | IrDa_NEC_Rx (uint32_t u32Time)
| This function is used to detect NEC IR procotol. More...
void | initial_led (void)
| Set LED GPIO to output mode. More...
void | LED_on (unsigned int temp)
| This function turn on LED numbers to open or close. More...
void | Open_PWM6_OUT (uint32_t PWM_Frequency, uint32_t PWM_Duty)
void | Close_PWM6_OUT (void)
void | Open_PWM7_Capture (void)
void | Close_PWM7_Capture (void)
void | Get_PWM7_Capture_Data (void)
void | Open_PWM3_Capture (void)
void | Close_PWM3_Capture (void)
void | Get_PWM3_Capture_Data (void)
void | Initial_PWM_DAC (void)
| This function is used to setup multi-function pin of PC12 for PWM1_CH0. More...
void | Write_PWMDAC (void)
| This function is used to set PWM for PWM DAC. More...
void | Initial_PWM_LED (void)
| Set multi-function pins for PWM0 channel 0,1,2. More...
void | PWM_LED (void)
| Set PWM clock enable and HCLK as PWM clock source, PWM frequency is 100Hz, duty 30% and enable output of all PWM channels. More...
void | Open_SPI_Flash (void)
| Open GPIO port for SPI interface and configure this SPI controller as Master, MSB first, clock idle low, TX at falling-edge, RX at rising-edge, 32-bit length transaction, disable the automatic hardware slave select function and SPI serial clock rate = 2 MHz. More...
unsigned int | SpiFlash_ReadMidDid (void)
| Read back the Manufacturer ID and Device ID from SPI Flash device. More...
void | SpiFlash_ChipErase (void)
| This function do the chip erasing to SPI Flash device. More...
unsigned int | SpiFlash_ReadStatusReg1 (void)
| Read back the Status Register 1 from SPI Flash device. More...
unsigned int | SpiFlash_ReadStatusReg2 (void)
| Read back the Status Register 2 from SPI Flash device. More...
void | SpiFlash_WaitReady (void)
| Waiting for the BUSY bit of SPI Flash that be cleared to 0. More...
void | SpiFlash_PageProgram (unsigned char *DataBuffer, unsigned int StartAddress, unsigned int ByteCount)
| This function do the page programming to SPI Flash device. More...
void | SpiFlash_ReadData (unsigned char *DataBuffer, unsigned int StartAddress, unsigned int ByteCount)
| This function do the data reading from SPI Flash device. More...
void | Init_PDMA_CH1_for_SPI0_TX (uint32_t u32SrcAddr)
| This function initializes the PDMA channel 1 for SPI0 transmitting TX and the data that will be transmiitted out are stored in the source buffer. More...
void | Init_PDMA_CH2_for_SPI0_RX (uint32_t u32DstAddr)
| This function initializes the PDMA channel 2 for SPI0 receiving RX and the receiving data will be stored into the destination buffer. More...
unsigned int | SpiFlash_w_PDMA_ReadMidDid (void)
| Read back the Manufacturer ID and Device ID from SPI Flash device. More...
void | SpiFlash_w_PDMA_ChipErase (void)
| This function do the chip erasing to SPI Flash device. More...
unsigned int | SpiFlash_w_PDMA_ReadStatusReg1 (void)
| Read back the Status Register 1 from SPI Flash device. More...
unsigned int | SpiFlash_w_PDMA_ReadStatusReg2 (void)
| Read back the Status Register 2 from SPI Flash device. More...
void | SpiFlash_w_PDMA_WaitReady (void)
| Waiting for the BUSY bit of SPI Flash that be cleared to 0. More...
void | SpiFlash_w_PDMA_PageProgram (unsigned int StartAddress, unsigned int ByteCount)
| This function do the page programming to SPI Flash device. More...
void | SpiFlash_w_PDMA_ReadData (unsigned int StartAddress, unsigned int ByteCount)
| This function do the data reading from SPI Flash device. More...
void | SYS_Init (void)
| This function enables HXT, LXT and LIRC clock and sets HCLK source from HXT to 42MHz. More...
void | Open_Threshold_Knob (void)
void | Close_Threshold_Knob (void)
uint32_t | Get_Threshold_Knob (void)
void | Initial_Timer_Outport (void)
void | initial_Timer_Toggle (void)
| This function is enable TM2 toggle. More...
void | UART0_Init (void)
| Initiate UART0 as 8-N-1 and 115200 BPS. More...
void | Open_Volume_Knob (void)
void | Close_Volume_Knob (void)
uint32_t | Get_Volume_Knob (void)
void | Initial_SEG_GPIO (void)
| Set 7_Segment LED GPIO to output mode. More...
void | Initial_PWM_GPIO (void)
| This function config PC.13 multi-function for PWM to drive Buzzer module, and config PE.6 multi-function for GPIO to control Buzzer power. More...
__INLINE void | I2C_PIN_Init (void)
| Open GPIO port for I2C interface and enable this I2C controller clock and reset it. More...
void | I2C1_IRQHandler (void)
| I2C interrupt handler. Checks the I2C interrupt flag, clears the corresponding event flag and calls the related handler subroutine. More...
void | I2C_MasterRx (uint32_t u32Status)
| This function checks the status of I2C, sets the related control bit and data if needed when this I2C module is master receiver. More...
void | I2C_MasterTx (uint32_t u32Status)
| This function checks the status of I2C, sets the related control bit and data if needed when this I2C module is master transmitter. More...
void | Initial_EINT1_GPIO (void)
| This function initializes PB.15 multi-function for EINT1 to detect external interrupt. More...
void | Mark (uint8_t N)
| This function is used to transmit MASK waveform Pulse = 1/3 duty @38KHz frequency. More...
void | SPACE (uint8_t N)
| This function is used to transmit SPACE waveform. More...
void | initial_close (void)
| Set LED GPIO to input mode. More...
void | PDMA_IRQHandler (void)
| PDMA interrupt handler. Check the PDMA interrupt flag and clear the corresponding event flag. More...
void | Initial_Timer_port (void)
| This function is used to TM2 output and TMR3 capture function. More...
void | initial_Timer_count (void)
| This function is enable TM2 count. More...
void | initial_Timer_capture (void)
| This function is enable TM3 Capture. More...

## Variables
uint32_t | PWM67_Clock
uint32_t | Open_PWM6_OUT_Fail
uint32_t | Open_PWM3_Capture_Fail
uint32_t | Open_PWM7_Capture_Fail
PWM_Capture_T | PWM3
PWM_Capture_T | PWM7
uint32_t | Open_Volume_Knob_Fail

## Detailed Description

## Macro Definition Documentation

## ◆ _ADC_Clock

#define _ADC_Clock 300000

Definition at line 27 of file NuEdu-Basic01_Volume_Knob.h.

## ◆ _PWM_Duty_Scale

#define _PWM_Duty_Scale 100

Definition at line 28 of file NuEdu-Basic01_PWM_Capture.h.

## ◆ _PWM_Prescale_Max

#define _PWM_Prescale_Max 256

Definition at line 27 of file NuEdu-Basic01_PWM_Capture.h.

## ◆ _PWM_Resolution

#define _PWM_Resolution 65536

Definition at line 26 of file NuEdu-Basic01_PWM_Capture.h.

## ◆ _PWM_Source_Clock

#define _PWM_Source_Clock 12000000

Definition at line 25 of file NuEdu-Basic01_PWM_Capture.h.

## ◆ Buzzer_Power_OFF

#define Buzzer_Power_OFF PE6=0

Control Buzzer module power down.

Definition at line 29 of file NuEdu-Basic01_Buzzer.c.

## ◆ Buzzer_Power_ON

#define Buzzer_Power_ON PE6=1

Control Buzzer module power on.

Definition at line 28 of file NuEdu-Basic01_Buzzer.c.

## ◆ KEY1_INPUT

#define KEY1_INPUT PD12

GPIO PD12 for Button1

Definition at line 28 of file NuEdu-Basic01_Button.c.

## ◆ KEY2_INPUT

#define KEY2_INPUT PE12

GPIO PE12 for Button2

Definition at line 29 of file NuEdu-Basic01_Button.c.

## ◆ KEY3_INPUT

#define KEY3_INPUT PD0

GPIO PD0 for Button3

Definition at line 30 of file NuEdu-Basic01_Button.c.

## ◆ KEY4_INPUT

#define KEY4_INPUT PD1

GPIO PD1 for Button4

Definition at line 31 of file NuEdu-Basic01_Button.c.

## ◆ LED1_OFF

#define LED1_OFF PB0=1

Definition at line 40 of file NuEdu-Basic01_LED.c.

## ◆ LED1_ON

#define LED1_ON PB0=0

Definition at line 31 of file NuEdu-Basic01_LED.c.

## ◆ LED2_OFF

#define LED2_OFF PB1=1

Definition at line 41 of file NuEdu-Basic01_LED.c.

## ◆ LED2_ON

#define LED2_ON PB1=0

Definition at line 32 of file NuEdu-Basic01_LED.c.

## ◆ LED3_OFF

#define LED3_OFF PE9=1

Definition at line 42 of file NuEdu-Basic01_LED.c.

## ◆ LED3_ON

#define LED3_ON PE9=0

Definition at line 33 of file NuEdu-Basic01_LED.c.

## ◆ LED4_OFF

#define LED4_OFF PE10=1

Definition at line 43 of file NuEdu-Basic01_LED.c.

## ◆ LED4_ON

#define LED4_ON PE10=0

Definition at line 34 of file NuEdu-Basic01_LED.c.

## ◆ LED5_OFF

#define LED5_OFF PE11=1

Definition at line 44 of file NuEdu-Basic01_LED.c.

## ◆ LED5_ON

#define LED5_ON PE11=0

Definition at line 35 of file NuEdu-Basic01_LED.c.

## ◆ LED6_OFF

#define LED6_OFF PD8=1

Definition at line 45 of file NuEdu-Basic01_LED.c.

## ◆ LED6_ON

#define LED6_ON PD8=0

Definition at line 36 of file NuEdu-Basic01_LED.c.

## ◆ LED7_OFF

#define LED7_OFF PD9=1

Definition at line 46 of file NuEdu-Basic01_LED.c.

## ◆ LED7_ON

#define LED7_ON PD9=0

Definition at line 37 of file NuEdu-Basic01_LED.c.

## ◆ LED8_OFF

#define LED8_OFF PC7=1

Definition at line 47 of file NuEdu-Basic01_LED.c.

## ◆ LED8_ON

#define LED8_ON PC7=0

Definition at line 38 of file NuEdu-Basic01_LED.c.

## ◆ NEC_BIT_MARK

#define NEC_BIT_MARK 1

Definition at line 141 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ NEC_BYTES

#define NEC_BYTES 4

Definition at line 144 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ NEC_LDC_MARK

#define NEC_LDC_MARK 16

Definition at line 139 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ NEC_LDC_SPACE

#define NEC_LDC_SPACE 8

Definition at line 140 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ NEC_ONE_SPACE

#define NEC_ONE_SPACE 3

Definition at line 142 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ NEC_ZERO_SPACE

#define NEC_ZERO_SPACE 1

Definition at line 143 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ SEG_A_OFF

#define SEG_A_OFF PA2=1

Turn off segment A

Definition at line 41 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_A_ON

#define SEG_A_ON PA2=0

Turn on segment A

Definition at line 30 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_B_OFF

#define SEG_B_OFF PA3=1

Turn off segment B

Definition at line 42 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_B_ON

#define SEG_B_ON PA3=0

Turn on segment B

Definition at line 31 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_C_OFF

#define SEG_C_OFF PA4=1

Turn off segment C

Definition at line 43 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_C_ON

#define SEG_C_ON PA4=0

Turn on segment C

Definition at line 32 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_CONTROL1_OFF

#define SEG_CONTROL1_OFF PD14=0

Turn off 7_segment1

Definition at line 49 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_CONTROL1_ON

#define SEG_CONTROL1_ON PD14=1

Turn on 7_segment1

Definition at line 38 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_CONTROL2_OFF

#define SEG_CONTROL2_OFF PD15=0

Turn off 7_segment2

Definition at line 50 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_CONTROL2_ON

#define SEG_CONTROL2_ON PD15=1

Turn on 7_segment2

Definition at line 39 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_D_OFF

#define SEG_D_OFF PA5=1

Turn off segment D

Definition at line 44 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_D_ON

#define SEG_D_ON PA5=0

Turn on segment D

Definition at line 33 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_E_OFF

#define SEG_E_OFF PA6=1

Turn off segment E

Definition at line 45 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_E_ON

#define SEG_E_ON PA6=0

Turn on segment E

Definition at line 34 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_F_OFF

#define SEG_F_OFF PA7=1

Turn off segment F

Definition at line 46 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_F_ON

#define SEG_F_ON PA7=0

Turn on segment F

Definition at line 35 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_G_OFF

#define SEG_G_OFF PD6=1

Turn off segment G

Definition at line 47 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_G_ON

#define SEG_G_ON PD6=0

Turn on segment G

Definition at line 36 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_H_OFF

#define SEG_H_OFF PD7=1

Turn off segment H

Definition at line 48 of file NuEdu-Basic01_7_Segment.c.

## ◆ SEG_H_ON

#define SEG_H_ON PD7=0

Turn on segment H

Definition at line 37 of file NuEdu-Basic01_7_Segment.c.

## Typedef Documentation

## ◆ IrDA_Code_Exe

typedef void(* IrDA_Code_Exe) (volatile uint8_t *IR_CODE)

Definition at line 46 of file NuEdu-Basic01_IrDA_NEC.h.

## Enumeration Type Documentation

## ◆ E_Edge

enum E_Edge

Enumerator
Rising |
Falling |

Definition at line 41 of file NuEdu-Basic01_PWM_Capture.h.

## Function Documentation

## ◆ Close_Buzzer()

void Close_Buzzer | ( | void |  | ) |

This function power down the Buzzer module.

Returns
  None

Definition at line 91 of file NuEdu-Basic01_Buzzer.c.

## ◆ Close_CLK_OUT()

void Close_CLK_OUT | ( | void |  | ) |

This function disable frequency output function.

Returns
  None

Definition at line 73 of file NuEdu-Basic01_ClkOut.c.

## ◆ Close_PWM3_Capture()

void Close_PWM3_Capture | ( | void |  | ) |

Definition at line 332 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Close_PWM6_OUT()

void Close_PWM6_OUT | ( | void |  | ) |

Definition at line 113 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Close_PWM7_Capture()

void Close_PWM7_Capture | ( | void |  | ) |

Definition at line 189 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Close_Seven_Segment()

void Close_Seven_Segment | ( | void |  | ) |

This function turn off 7_Segment LED.

Returns
  None

Definition at line 93 of file NuEdu-Basic01_7_Segment.c.

## ◆ Close_Threshold_Knob()

void Close_Threshold_Knob | ( | void |  | ) |

Definition at line 34 of file NuEdu-Basic01_Threshold_Knob.c.

## ◆ Close_Volume_Knob()

void Close_Volume_Knob | ( | void |  | ) |

Definition at line 47 of file NuEdu-Basic01_ADC_Knob.c.

## ◆ Get_KEY_INPUT()

unsigned char Get_KEY_INPUT | ( | void |  | ) |

This function get button status.

Returns
  Temp Button status

Definition at line 48 of file NuEdu-Basic01_Button.c.

## ◆ Get_PWM3_Capture_Data()

void Get_PWM3_Capture_Data | ( | void |  | ) |

Definition at line 357 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Get_PWM7_Capture_Data()

void Get_PWM7_Capture_Data | ( | void |  | ) |

Definition at line 212 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Get_Threshold_Knob()

uint32_t Get_Threshold_Knob | ( | void |  | ) |

Definition at line 62 of file NuEdu-Basic01_Threshold_Knob.c.

## ◆ Get_Volume_Knob()

uint32_t Get_Volume_Knob | ( | void |  | ) |

Definition at line 64 of file NuEdu-Basic01_ADC_Knob.c.

## ◆ I2C1_IRQHandler()

void I2C1_IRQHandler | ( | void |  | ) |

I2C interrupt handler. Checks the I2C interrupt flag, clears the corresponding event flag and calls the related handler subroutine.

Returns
  None

Definition at line 71 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_EEPROM_Init()

void I2C_EEPROM_Init | ( | uint8_t | u8Divider | ) |

This function initializes the I2C module, bit-rate = 100 kHz and enable the corresponding interrupt.

Parameters

  [in] | u8Divider | A divider of I2C clock source.

Returns
  None

Definition at line 99 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_EEPROM_Read()

uint8_t I2C_EEPROM_Read | ( | uint16_t | u16Address | ) |

This function do the I2C data reading from EEPROM device.

Parameters

  [in] | u16Address | An address of EEPROM that will be read.

Returns
  The data be read out.

Definition at line 260 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_EEPROM_Write()

void I2C_EEPROM_Write | ( | uint16_t | u16Address,
|  | uint8_t | u8Data
| ) |  |

This function do the I2C data writing to EEPROM device.

Parameters

  [in] | u16Address | An address of EEPROM that will be written.
  [in] | u18Data | The data will be written to EEPROM.

Returns
  None

Definition at line 234 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_MasterRx()

void I2C_MasterRx | ( | uint32_t | u32Status | ) |

This function checks the status of I2C, sets the related control bit and data if needed when this I2C module is master receiver.

Parameters

  [in] | u32Status | The current value of I2C status register.

Returns
  None

Definition at line 121 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_MasterTx()

void I2C_MasterTx | ( | uint32_t | u32Status | ) |

This function checks the status of I2C, sets the related control bit and data if needed when this I2C module is master transmitter.

Parameters

  [in] | u32Status | The current value of I2C status register.

Returns
  None

Definition at line 184 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ I2C_PIN_Init()

__INLINE void I2C_PIN_Init | ( | void |  | ) |

Open GPIO port for I2C interface and enable this I2C controller clock and reset it.

Returns
  None

Definition at line 52 of file NuEdu-Basic01_I2C_EEPROM.c.

## ◆ Init_PDMA_CH1_for_SPI0_TX()

void Init_PDMA_CH1_for_SPI0_TX | ( | uint32_t | u32SrcAddr | ) |

This function initializes the PDMA channel 1 for SPI0 transmitting TX and the data that will be transmiitted out are stored in the source buffer.

Parameters

  [in] | u32SrcAddr | A source address for the transmitting data buffer.

Returns
  None

Definition at line 117 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ Init_PDMA_CH2_for_SPI0_RX()

void Init_PDMA_CH2_for_SPI0_RX | ( | uint32_t | u32DstAddr | ) |

This function initializes the PDMA channel 2 for SPI0 receiving RX and the receiving data will be stored into the destination buffer.

Parameters

  [in] | u32DstAddr | A destination address for the receiving data buffer.

Returns
  None

Definition at line 163 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ initial_close()

void initial_close | ( | void |  | ) |

Set LED GPIO to input mode.

Returns
  None

Definition at line 131 of file NuEdu-Basic01_LED.c.

## ◆ Initial_EINT1_GPIO()

void Initial_EINT1_GPIO | ( | void |  | ) |

This function initializes PB.15 multi-function for EINT1 to detect external interrupt.

Returns
  None

Definition at line 33 of file NuEdu-Basic01_Interrupt.c.

## ◆ Initial_KEY_INPUT()

void Initial_KEY_INPUT | ( | void |  | ) |

Set Button GPIO to input mode.

Returns
  None

Definition at line 37 of file NuEdu-Basic01_Button.c.

## ◆ initial_led()

void initial_led | ( | void |  | ) |

Set LED GPIO to output mode.

Returns
  None

Definition at line 54 of file NuEdu-Basic01_LED.c.

## ◆ Initial_PWM_DAC()

void Initial_PWM_DAC | ( | void |  | ) |

This function is used to setup multi-function pin of PC12 for PWM1_CH0.

Returns
  None

Definition at line 51 of file NuEdu-Basic01_PWMDAC.c.

## ◆ Initial_PWM_GPIO()

void Initial_PWM_GPIO | ( | void |  | ) |

This function config PC.13 multi-function for PWM to drive Buzzer module, and config PE.6 multi-function for GPIO to control Buzzer power.

Returns
  None

Definition at line 42 of file NuEdu-Basic01_Buzzer.c.

## ◆ Initial_PWM_LED()

void Initial_PWM_LED | ( | void |  | ) |

Set multi-function pins for PWM0 channel 0,1,2.

Returns
  None

Definition at line 33 of file NuEdu-Basic01_RGBLED.c.

## ◆ Initial_SEG_GPIO()

void Initial_SEG_GPIO | ( | void |  | ) |

Set 7_Segment LED GPIO to output mode.

Returns
  None

Definition at line 56 of file NuEdu-Basic01_7_Segment.c.

## ◆ initial_Timer_capture()

void initial_Timer_capture | ( | void |  | ) |

This function is enable TM3 Capture.

Returns
  none

Definition at line 94 of file NuEdu-Basic01_Timer_Ouput_Capture.c.

## ◆ initial_Timer_count()

void initial_Timer_count | ( | void |  | ) |

This function is enable TM2 count.

Returns
  none

Definition at line 72 of file NuEdu-Basic01_Timer_Ouput_Capture.c.

## ◆ Initial_Timer_Outport()

void Initial_Timer_Outport | ( | void |  | ) |

## ◆ Initial_Timer_port()

void Initial_Timer_port | ( | void |  | ) |

This function is used to TM2 output and TMR3 capture function.

Returns
  none

Definition at line 31 of file NuEdu-Basic01_Timer_Ouput_Capture.c.

## ◆ initial_Timer_Toggle()

void initial_Timer_Toggle | ( | void |  | ) |

This function is enable TM2 toggle.

Returns
  none

Definition at line 49 of file NuEdu-Basic01_Timer_Ouput_Capture.c.

## ◆ IrDa_NEC_Rx()

void IrDa_NEC_Rx | ( | uint32_t | u32Time | ) |

This function is used to detect NEC IR procotol.

Parameters

  [in] | u32Time | is the time length of received bit

Returns
  None

Definition at line 48 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ IrDA_NEC_TxRx_Init()

void IrDA_NEC_TxRx_Init | ( | IrDA_Code_Exe | pfnIrDA_Code_Exe | ) |

This function is used to initiate PWM for IrDA NEC.

Parameters

  [in] | pfnIrDA_Code_Exe | is function pointer that will be executed after received IrDA NEC command

Returns
  None

Definition at line 206 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ LED_on()

void LED_on | ( | unsigned int | temp | ) |

This function turn on LED numbers to open or close.

Parameters

  [in] | temp | Turn on which LED open number

Returns
  None

Definition at line 75 of file NuEdu-Basic01_LED.c.

## ◆ Mark()

void Mark | ( | uint8_t | N | ) |

This function is used to transmit MASK waveform Pulse = 1/3 duty @38KHz frequency.

Parameters

  [in] | N | is time length of MASK

Returns
  None

Definition at line 152 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ Open_Buzzer()

void Open_Buzzer | ( | void |  | ) |

This function enable PWM1 module clock and set clock source to start Buzzer module.

Returns
  None

Definition at line 58 of file NuEdu-Basic01_Buzzer.c.

## ◆ Open_CLK_OUT()

void Open_CLK_OUT | ( | uint32_t | Clock_Source,
|  | uint32_t | FRQDIV_FSEL
| ) |  |

This function enable frequency divider module clock, enable frequency divider clock function and configure frequency divider.

Parameters

  [in] | Clock_Source | is ClkOut function clock source CLK_CLKSEL2_FRQDIV_S_HXT CLK_CLKSEL2_FRQDIV_S_LXT CLK_CLKSEL2_FRQDIV_S_HCLK CLK_CLKSEL2_FRQDIV_S_HIRC
  [in] | FRQDIV_FSEL | is divider output frequency selection

Returns
  None

Output selected clock to FCLKO. The output clock frequency is divided by FRQDIV_FSEL. The formula is: FCLKO frequency = (Clock_Source frequency) / 2^(FRQDIV_FSEL + 1)

Definition at line 44 of file NuEdu-Basic01_ClkOut.c.

## ◆ Open_EINT1()

void Open_EINT1 | ( | void |  | ) |

This function enables EINT1 interrupt and IRQ handler, and configs trigger condition for falling edge.

Returns
  None

Definition at line 46 of file NuEdu-Basic01_Interrupt.c.

## ◆ Open_PWM3_Capture()

void Open_PWM3_Capture | ( | void |  | ) |

Definition at line 273 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_PWM6_OUT()

void Open_PWM6_OUT | ( | uint32_t | PWM_Frequency,
|  | uint32_t | PWM_Duty
| ) |  |

Definition at line 25 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_PWM7_Capture()

void Open_PWM7_Capture | ( | void |  | ) |

Definition at line 132 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_Seven_Segment()

void Open_Seven_Segment | ( | void |  | ) |

This function turn on 7_Segment LED.

Returns
  None

Definition at line 76 of file NuEdu-Basic01_7_Segment.c.

## ◆ Open_SPI_Flash()

void Open_SPI_Flash | ( | void |  | ) |

Open GPIO port for SPI interface and configure this SPI controller as Master, MSB first, clock idle low, TX at falling-edge, RX at rising-edge, 32-bit length transaction, disable the automatic hardware slave select function and SPI serial clock rate = 2 MHz.

Returns
  None

Definition at line 43 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ Open_Threshold_Knob()

void Open_Threshold_Knob | ( | void |  | ) |

Definition at line 5 of file NuEdu-Basic01_Threshold_Knob.c.

## ◆ Open_Volume_Knob()

void Open_Volume_Knob | ( | void |  | ) |

Definition at line 9 of file NuEdu-Basic01_ADC_Knob.c.

## ◆ PDMA_IRQHandler()

void PDMA_IRQHandler | ( | void |  | ) |

PDMA interrupt handler. Check the PDMA interrupt flag and clear the corresponding event flag.

Returns
  None

Definition at line 55 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ PWM_LED()

void PWM_LED | ( | void |  | ) |

Set PWM clock enable and HCLK as PWM clock source, PWM frequency is 100Hz, duty 30% and enable output of all PWM channels.

Returns
  None

Definition at line 47 of file NuEdu-Basic01_RGBLED.c.

## ◆ SendNEC()

void SendNEC | ( | uint8_t * | data | ) |

This function is used to transmit IrDA NEC waveform through PC 15 (PWM1_CH3)

Parameters

  [in] | data | is pointer of trasnmitted data

Returns
  None

Definition at line 174 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ Show_Seven_Segment()

void Show_Seven_Segment | ( | unsigned char | no,
|  | unsigned char | number
| ) |  |

This function turn on 7_Segment LED to show numbers.

Parameters

  [in] | no | Turn on which 7_Segment LED
  [in] | number | 7_Segment LED show number 0~9

Returns
  None

Definition at line 115 of file NuEdu-Basic01_7_Segment.c.

## ◆ SPACE()

void SPACE | ( | uint8_t | N | ) |

This function is used to transmit SPACE waveform.

Parameters

  [in] | N | is time length of SPACE

Returns
  None

Definition at line 164 of file NuEdu-Basic01_IrDA_NEC.c.

## ◆ SpiFlash_ChipErase()

void SpiFlash_ChipErase | ( | void |  | ) |

This function do the chip erasing to SPI Flash device.

Returns
  None

Definition at line 127 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_PageProgram()

void SpiFlash_PageProgram | ( | unsigned char * | DataBuffer,
|  | unsigned int | StartAddress,
|  | unsigned int | ByteCount
| ) |  |

This function do the page programming to SPI Flash device.

Parameters

  [in] | *DataBuffer | A Point that point to source data buffer.
  [in] | StartAddress | A start address of SPI Flash that will be programmed.
  [in] | ByteCount | Byte count number that will be programmed.

Returns
  None

Definition at line 261 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_ReadData()

void SpiFlash_ReadData | ( | unsigned char * | DataBuffer,
|  | unsigned int | StartAddress,
|  | unsigned int | ByteCount
| ) |  |

This function do the data reading from SPI Flash device.

Parameters

  [in] | *DataBuffer | A Point that point to destination data buffer.
  [in] | StartAddress | A start address of SPI Flash that will be read.
  [in] | ByteCount | Byte count number that will be read.

Returns
  None

Definition at line 335 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_ReadMidDid()

unsigned int SpiFlash_ReadMidDid | ( | void |  | ) |

Read back the Manufacturer ID and Device ID from SPI Flash device.

Returns
  Manufacturer ID and Device ID of SPI Flash device. For W25Q16BV, Manufacturer ID: 0xEF; Device ID: 0x14 For W26X16, Manufacturer ID: 0xEF; Device ID: 0x14

Definition at line 71 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_ReadStatusReg1()

unsigned int SpiFlash_ReadStatusReg1 | ( | void |  | ) |

Read back the Status Register 1 from SPI Flash device.

Returns
  Status Register 1 value of SPI Flash device.

Definition at line 169 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_ReadStatusReg2()

unsigned int SpiFlash_ReadStatusReg2 | ( | void |  | ) |

Read back the Status Register 2 from SPI Flash device.

Returns
  Status Register 2 value of SPI Flash device.

Definition at line 203 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SpiFlash_w_PDMA_ChipErase()

void SpiFlash_w_PDMA_ChipErase | ( | void |  | ) |

This function do the chip erasing to SPI Flash device.

Returns
  None

Definition at line 264 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_PageProgram()

void SpiFlash_w_PDMA_PageProgram | ( | unsigned int | StartAddress,
|  | unsigned int | ByteCount
| ) |  |

This function do the page programming to SPI Flash device.

Parameters

  [in] | StartAddress | A start address of SPI Flash that will be programmed.
  [in] | ByteCount | Byte count number that will be programmed.

Returns
  None

Definition at line 396 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_ReadData()

void SpiFlash_w_PDMA_ReadData | ( | unsigned int | StartAddress,
|  | unsigned int | ByteCount
| ) |  |

This function do the data reading from SPI Flash device.

Parameters

  [in] | StartAddress | A start address of SPI Flash that will be read.
  [in] | ByteCount | Byte count number that will be read.

Returns
  None

Definition at line 473 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_ReadMidDid()

unsigned int SpiFlash_w_PDMA_ReadMidDid | ( | void |  | ) |

Read back the Manufacturer ID and Device ID from SPI Flash device.

Returns
  Manufacturer ID and Device ID of SPI Flash device. For W25Q16BV, Manufacturer ID: 0xEF; Device ID: 0x14 For W26X16, Manufacturer ID: 0xEF; Device ID: 0x14

Definition at line 208 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_ReadStatusReg1()

unsigned int SpiFlash_w_PDMA_ReadStatusReg1 | ( | void |  | ) |

Read back the Status Register 1 from SPI Flash device.

Returns
  Status Register 1 value of SPI Flash device

Definition at line 306 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_ReadStatusReg2()

unsigned int SpiFlash_w_PDMA_ReadStatusReg2 | ( | void |  | ) |

Read back the Status Register 2 from SPI Flash device.

Returns
  Status Register 2 value of SPI Flash device

Definition at line 340 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_w_PDMA_WaitReady()

void SpiFlash_w_PDMA_WaitReady | ( | void |  | ) |

Waiting for the BUSY bit of SPI Flash that be cleared to 0.

Returns
  None

Definition at line 374 of file NuEdu-Basic01_SPI_Flash_w_PDMA.c.

## ◆ SpiFlash_WaitReady()

void SpiFlash_WaitReady | ( | void |  | ) |

Waiting for the BUSY bit of SPI Flash that be cleared to 0.

Returns
  None

Definition at line 237 of file NuEdu-Basic01_SPI_Flash.c.

## ◆ SYS_Init()

void SYS_Init | ( | void |  | ) |

This function enables HXT, LXT and LIRC clock and sets HCLK source from HXT to 42MHz.

Returns
  None

Definition at line 37 of file NuEdu-Basic01_System.c.

## ◆ UART0_Init()

void UART0_Init | ( | void |  | ) |

Initiate UART0 as 8-N-1 and 115200 BPS.

Returns
  None

Definition at line 34 of file NuEdu-Basic01_UART.c.

## ◆ Write_Buzzer()

void Write_Buzzer | ( | unsigned int | frequence,
|  | unsigned int | duty
| ) |  |

This function set PWM output frequence and duty to drive Buzzer module.

Returns
  None

Definition at line 78 of file NuEdu-Basic01_Buzzer.c.

## ◆ Write_PWMDAC()

void Write_PWMDAC | ( | void |  | ) |

This function is used to set PWM for PWM DAC.

Returns
  None

Definition at line 33 of file NuEdu-Basic01_PWMDAC.c.

## Variable Documentation

## ◆ Open_PWM3_Capture_Fail

uint32_t Open_PWM3_Capture_Fail

Definition at line 19 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_PWM6_OUT_Fail

uint32_t Open_PWM6_OUT_Fail

Definition at line 18 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_PWM7_Capture_Fail

uint32_t Open_PWM7_Capture_Fail

Definition at line 20 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ Open_Volume_Knob_Fail

uint32_t Open_Volume_Knob_Fail

Definition at line 7 of file NuEdu-Basic01_ADC_Knob.c.

## ◆ PWM3

PWM_Capture_T PWM3

Definition at line 22 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ PWM67_Clock

uint32_t PWM67_Clock

Definition at line 17 of file NuEdu-Basic01_PWM_Capture.c.

## ◆ PWM7

PWM_Capture_T PWM7

Definition at line 23 of file NuEdu-Basic01_PWM_Capture.c.