STM8S/A Standard Peripherals Firmware Library
|
Defines | |
#define | BUFFER_SIZE1 (countof(Tx1_Buffer)-1) |
#define | BUFFER_SIZE2 (countof(Tx2_Buffer)-1) |
#define | countof(a) (sizeof(a) / sizeof(*(a))) |
#define | ENABLE_LCD_MSG_DISPLAY |
#define | sEE_READ_ADDRESS1 0x50 |
#define | sEE_READ_ADDRESS2 (sEE_READ_ADDRESS1 + BUFFER_SIZE1) |
#define | sEE_WRITE_ADDRESS1 0x50 |
#define | sEE_WRITE_ADDRESS2 (sEE_WRITE_ADDRESS1 + BUFFER_SIZE1) |
Enumerations | |
enum | TestStatus { FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED } |
Functions | |
INTERRUPT_HANDLER (TLI_IRQHandler, 0) | |
Top Level Interrupt routine. | |
INTERRUPT_HANDLER (AWU_IRQHandler, 1) | |
Auto Wake Up Interrupt routine. | |
INTERRUPT_HANDLER (CLK_IRQHandler, 2) | |
Clock Controller Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTA_IRQHandler, 3) | |
External Interrupt PORTA Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTB_IRQHandler, 4) | |
External Interrupt PORTB Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTC_IRQHandler, 5) | |
External Interrupt PORTC Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTD_IRQHandler, 6) | |
External Interrupt PORTD Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTE_IRQHandler, 7) | |
External Interrupt PORTE Interrupt routine. | |
INTERRUPT_HANDLER (SPI_IRQHandler, 10) | |
SPI Interrupt routine. | |
INTERRUPT_HANDLER (TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11) | |
Timer1 Update/Overflow/Trigger/Break Interrupt routine. | |
INTERRUPT_HANDLER (TIM1_CAP_COM_IRQHandler, 12) | |
Timer1 Capture/Compare Interrupt routine. | |
INTERRUPT_HANDLER (TIM2_UPD_OVF_BRK_IRQHandler, 13) | |
Timer2 Update/Overflow/Break Interrupt routine. | |
INTERRUPT_HANDLER (TIM2_CAP_COM_IRQHandler, 14) | |
Timer2 Capture/Compare Interrupt routine. | |
INTERRUPT_HANDLER (I2C_IRQHandler, 19) | |
I2C Interrupt routine. | |
INTERRUPT_HANDLER (ADC1_IRQHandler, 22) | |
ADC1 interrupt routine. | |
INTERRUPT_HANDLER (TIM4_UPD_OVF_IRQHandler, 23) | |
Timer4 Update/Overflow Interrupt routine. | |
INTERRUPT_HANDLER (EEPROM_EEC_IRQHandler, 24) | |
Eeprom EEC Interrupt routine. | |
INTERRUPT_HANDLER_TRAP (TRAP_IRQHandler) | |
TRAP interrupt routine. | |
void | main (void) |
Main program. | |
uint32_t | sEE_TIMEOUT_UserCallback (void) |
Example of timeout situation management. | |
Variables | |
volatile uint16_t | NumDataRead = 0 |
uint8_t | Rx1_Buffer [BUFFER_SIZE1] |
uint8_t | Rx2_Buffer [BUFFER_SIZE2] |
volatile TestStatus | TransferStatus1 = FAILED |
volatile TestStatus | TransferStatus2 = FAILED |
uint8_t | Tx1_Buffer [] |
uint8_t | Tx2_Buffer [] |
Define Documentation
#define BUFFER_SIZE1 (countof(Tx1_Buffer)-1) |
Definition at line 47 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
#define BUFFER_SIZE2 (countof(Tx2_Buffer)-1) |
Definition at line 48 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
#define countof | ( | a | ) | (sizeof(a) / sizeof(*(a))) |
Definition at line 53 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
#define ENABLE_LCD_MSG_DISPLAY |
Definition at line 43 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
#define sEE_READ_ADDRESS1 0x50 |
Definition at line 46 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
#define sEE_READ_ADDRESS2 (sEE_READ_ADDRESS1 + BUFFER_SIZE1) |
Definition at line 50 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
#define sEE_WRITE_ADDRESS1 0x50 |
Definition at line 45 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
#define sEE_WRITE_ADDRESS2 (sEE_WRITE_ADDRESS1 + BUFFER_SIZE1) |
Definition at line 49 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
Enumeration Type Documentation
enum TestStatus |
- Enumerator:
FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED FAILED PASSED
Definition at line 39 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Function Documentation
INTERRUPT_HANDLER | ( | TLI_IRQHandler | , |
0 | |||
) |
Top Level Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 72 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | AWU_IRQHandler | , |
1 | |||
) |
Auto Wake Up Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 84 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | CLK_IRQHandler | , |
2 | |||
) |
Clock Controller Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 96 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTA_IRQHandler | , |
3 | |||
) |
External Interrupt PORTA Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 108 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTB_IRQHandler | , |
4 | |||
) |
External Interrupt PORTB Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 120 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTC_IRQHandler | , |
5 | |||
) |
External Interrupt PORTC Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 132 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTD_IRQHandler | , |
6 | |||
) |
External Interrupt PORTD Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 144 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTE_IRQHandler | , |
7 | |||
) |
External Interrupt PORTE Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 156 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | SPI_IRQHandler | , |
10 | |||
) |
SPI Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 207 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM1_UPD_OVF_TRG_BRK_IRQHandler | , |
11 | |||
) |
Timer1 Update/Overflow/Trigger/Break Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 219 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM1_CAP_COM_IRQHandler | , |
12 | |||
) |
Timer1 Capture/Compare Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 231 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM2_UPD_OVF_BRK_IRQHandler | , |
13 | |||
) |
Timer2 Update/Overflow/Break Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 268 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM2_CAP_COM_IRQHandler | , |
14 | |||
) |
Timer2 Capture/Compare Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 280 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | I2C_IRQHandler | , |
19 | |||
) |
I2C Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 347 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | ADC1_IRQHandler | , |
22 | |||
) |
ADC1 interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 425 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM4_UPD_OVF_IRQHandler | , |
23 | |||
) |
Timer4 Update/Overflow Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 452 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER | ( | EEPROM_EEC_IRQHandler | , |
24 | |||
) |
Eeprom EEC Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 465 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
INTERRUPT_HANDLER_TRAP | ( | TRAP_IRQHandler | ) |
TRAP interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 61 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/stm8s_it.c.
void main | ( | void | ) |
Main program.
- Parameters:
-
None
- Return values:
-
None
Definition at line 97 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
References BUFFER_SIZE1, BUFFER_SIZE2, Buffercmp(), CLK_HSIPrescalerConfig(), CLK_PRESCALER_HSIDIV1, LCD_Clear(), LCD_LINE1, LCD_LINE2, LCD_Print(), LCD_SetCursorPos(), NumDataRead, PASSED, Rx1_Buffer, Rx2_Buffer, sEE_DeInit(), sEE_Init(), sEE_READ_ADDRESS1, sEE_READ_ADDRESS2, sEE_ReadBuffer(), sEE_WaitEepromStandbyState(), sEE_WRITE_ADDRESS1, sEE_WRITE_ADDRESS2, sEE_WriteBuffer(), STM8S_EVAL_LCD_Init(), TransferStatus1, TransferStatus2, Tx1_Buffer, and Tx2_Buffer.
uint32_t sEE_TIMEOUT_UserCallback | ( | void | ) |
Example of timeout situation management.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 227 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
References LCD_LINE1, LCD_LINE2, LCD_Print(), and LCD_SetCursorPos().
Referenced by sEE_ReadBuffer(), sEE_WaitEepromStandbyState(), sEE_WriteBuffer(), and sEE_WritePage().
Variable Documentation
volatile uint16_t NumDataRead = 0 |
Definition at line 88 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
uint8_t Rx1_Buffer[BUFFER_SIZE1] |
Definition at line 86 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
uint8_t Rx2_Buffer[BUFFER_SIZE2] |
Definition at line 86 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
volatile TestStatus TransferStatus1 = FAILED |
Definition at line 87 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
volatile TestStatus TransferStatus2 = FAILED |
Definition at line 87 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
"/* STM8S I2C Firmware Library EEPROM driver example: \ buffer 1 transfer into address sEE_WRITE_ADDRESS1 */ \ Example Description \ This firmware provides a basic example of how to use the I2C firmware library and\ an associate I2C EEPROM driver to communicate with an I2C EEPROM device (here the\ example is interfacing with M24C64 EEPROM)\ \ I2C peripheral is configured in Master transmitter during write operation and in\ Master receiver during read operation from I2C EEPROM. \ \ I2C peripheral speed is set to 200kHz and can be configured by \ modifying the relative define in stm8s_eval_i2c_ee.h file.\ \ For M24C64 devices all the memory is accessible through the two-bytes \ addressing mode and need to define block addresses. In this case, only the physical \ address has to be defined (according to the address pins (E0,E1 and E2) connection).\ This address is defined in stm8s_eval_i2c_ee.h (default is 0xA0: E0, E1 and E2 tied to ground).\ The EEPROM addresses where the program start the write and the read operations \ is defined in the main.c file. \ \ First, the content of Tx1_Buffer is written to the EEPROM_WriteAddress1 and the\ written data are read. The written and the read buffers data are then compared.\ Following the read operation, the program waits that the EEPROM reverts to its \ Standby state. A second write operation is, then, performed and this time, Tx2_Buffer\ is written to EEPROM_WriteAddress2, which represents the address just after the last \ written one in the first write. After completion of the second write operation, the \ written data are read. The contents of the written and the read buffers are compared.\ "
Definition at line 56 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().
"/* STM8S I2C Firmware Library EEPROM driver example: \ buffer 2 transfer into address sEE_WRITE_ADDRESS2 */"
Definition at line 84 of file STM8S_StdPeriph_Examples/I2C/I2C_EEPROM/main.c.
Referenced by main().