/////////////////////////////////////////////////////////////////////////////// /// \file nokia.h /// \brief Nokia functions through the SPI3 /// \version 1.0 first release /// \author Pascal Sartoretti (sap at hevs dot ch) /// \date 04-2014 /// \details The LCD is connected to the module inteface bus /////////////////////////////////////////////////////////////////////////////// #ifndef NOKIA_H_ #define NOKIA_H_ #define RST_NOKIA_Pin GPIO_PIN_8 #define RST_NOKIA_GPIO_Port GPIOB #define D_C_NOKIA_Pin GPIO_PIN_9 #define D_C_NOKIA_GPIO_Port GPIOB #define CS_NOKIA_Pin GPIO_PIN_6 #define CS_NOKIA_GPIO_Port GPIOF extern SPI_HandleTypeDef hspi2; extern const size_t gNokiaBufferSize; // to export size of buffer extern uint8_t gNokiaBuffer[]; // to export address of buffer /////////////////////////////////////////////////////////////////////////////// /// \brief Inits the SPI and the Nokia LCD /// \details Setup used pins, SPI3 and LCD for normal usage /////////////////////////////////////////////////////////////////////////////// void Nokia_Init(void); /////////////////////////////////////////////////////////////////////////////// /// \brief Set the memory pointer to a given position /// \param posX Has to be a value between 0 and 83 (nb horizontal pixels) /// \param posY Has to be a value between 0 to 5 (number of lines) /////////////////////////////////////////////////////////////////////////////// void NokiaGotoXY(uint8_t posX, uint8_t posY); /////////////////////////////////////////////////////////////////////////////// /// \brief Clear the display buffer /// \details Setup FSMC interface and 8255 configuration /////////////////////////////////////////////////////////////////////////////// void NokiaClrDisplay(void); /////////////////////////////////////////////////////////////////////////////// /// \brief send the video buffer to the LCD through SPI /////////////////////////////////////////////////////////////////////////////// void NokiaUpdate(void); /////////////////////////////////////////////////////////////////////////////// /// \brief Set a pixel at a given position /// \param posX Has to be a value between 0 and 83 (nb horizontal pixels) /// \param posY Has to be a value between 0 to 47 (nb vertical pixels) /////////////////////////////////////////////////////////////////////////////// void NokiaSetPixel(uint8_t posX, uint8_t posY); /////////////////////////////////////////////////////////////////////////////// /// \brief Clear a pixel at a given position /// \param posX Has to be a value between 0 and 83 (nb horizontal pixels) /// \param posY Has to be a value between 0 to 47 (nb vertical pixels) /////////////////////////////////////////////////////////////////////////////// void NokiaClrPixel(uint8_t posX, uint8_t posY); /////////////////////////////////////////////////////////////////////////////// /// \brief Draw a line at a given position and color /// \param posX1 First X pixel point (0-83) /// \param posY1 First Y pixel point (0-47) /// \param posX2 Second X pixel point /// \param posY2 Second Y pixel point /// \param color Line color (0 = pixel is off, 1 = pixel is on) /////////////////////////////////////////////////////////////////////////////// void NokiaDrawLine(uint8_t posX1, uint8_t posY1, uint8_t posX2, uint8_t posY2, uint8_t color); /////////////////////////////////////////////////////////////////////////////// /// \brief Draw a line at a given position and color /// \param msg Message string to display /// \param posX Position of character in X axis (0-13) /// \param posY Position of character in Y axis (0-5) /// \param posY2 Second Y pixel point /// \param color Text color (0 = inverted video, 1 = normal text) /////////////////////////////////////////////////////////////////////////////// void NokiaMsg(const uint8_t * msg, uint8_t posX, uint8_t posY, uint8_t color); #endif /* NOKIA_H_ */